对话框有问题 [英] A problem with dialogbox

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

问题描述

先生,我是Windows编程的初学者。我在Win32 API中创建了一个对话框。我的对话框只包含一个名为复制的IDOK按钮。我没有在对话框中启用最大化和最小化按钮但是有关闭按钮(不是带有IDCLOSE的按钮)我的意思是在顶部看到的关闭按钮对话框的右上角就像这样[X]。



我已经添加了创建对话框的所有资源,并且我的对话框已经成功创建。但是现在我已经编码了一个没有争论的&在名为open的单独文件上没有返回类型函数。我的愿望是点击复制按钮调用函数(进行函数调用),所以我这样做了,



Sir, I am a beginner in windows programming. I have created a dialog box in Win32 API. My dialog box consists of only one push button named "Copy" for IDOK.I have not enabled the maximize and minimize buttons in my dialog box but has close button(not push button with an IDCLOSE) I mean the close button seen in the top right corner of the dialogbox like this [X].

I have added all the resources for creating the dialogbox and my dialog box has created successfully.But now I have coded a without argument & without return type function on a seperate file named "open". My wish is to call the function(To make a function call) on clicking the "Copy" button so I did this,

case ID_HELP_COPY:
			{
				DialogBox(hInst, MAKEINTRESOURCE(IDD_DIALOG1), hWnd, Help);
			case IDOK:
			{
				open();
				break;
			}
			}





我的可执行文件中没有错误和警告。点击复制按钮文件已成功创建。

问题:

它也会在关闭对话框时创建文件而不单击复制按钮即右上角按钮

我添加了一个休息声明,但它是没用的。



我错过了什么吗?



请帮助我这位先生。



谢谢



There were no errors and warnings in my executable.And by clicking the "Copy" button the file has created successfully.
problem:
It also creates file on closing the dialog without clicking the copy button i.e. The top right corner button
I have added a break statement but it is of no use.

Have I missed anything?

Kindly help me with this sir.

Thank you

推荐答案

Quote:

DialogBox(hInst,MAKEINTRESOURCE(IDD_DIALOG1),hWnd,Help);

case IDOK:

{

open();

休息;

}

DialogBox(hInst, MAKEINTRESOURCE(IDD_DIALOG1), hWnd, Help);
case IDOK:
{
open();
break;
}



应该是(我猜)


Should be (I guess)

if ( DialogBox(hInst, MAKEINTRESOURCE(IDD_DIALOG1), hWnd, Help) == IDOK )
{
  open();
}
break;


这篇关于对话框有问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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