InputBox使用C ++取消 [英] InputBox Cancel using C++

查看:783
本文介绍了InputBox使用C ++取消的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Embarcadero或Borland C ++中的InputBox组件和一个默认字符串。 Cancel键返回与Enter按钮相同的默认字符串。

I am using the InputBox component in Embarcadero or Borland C++ with a default string. The Cancel key returns the same default string as the Enter button.

根据文档,取消键应返回一个空字符串。

According to the documentation, the Cancel key is supposed to return an empty string.

String s = InputBox("Title", "Prompt", "Default");
if (s == "") return;  // Cancel key pressed
... use string s

StrPtr在VB中。在C ++中有等价的?
VB6 InputBox取消

I have seen a solution using StrPtr in VB. Is there an equivalent in C++? VB6 InputBox Cancel

推荐答案

我发现了一个使用InputQuery而不是InputBox的解决方案。如果选择了取消按钮,InputQuery函数返回FALSE。 DefaultString在Enter上返回。

I have found a solution that uses InputQuery instead of InputBox. The InputQuery functions returns FALSE if the Cancel button is selected. The DefaultString is returned on Enter.

这篇关于InputBox使用C ++取消的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆