开发者

How can I load my own window instead of default window with win32 API

I've created a simple dialog box in my .rc file . How can I view this box instead of the default one of VS 2008.

alt text http://photo.开发者_运维问答1280.com/images/1wc/9MFOA0UI/win32.jpeg


This question doesn't make a lot of sense. All I can imagine is that you are calling the MessageBox API. In order to display a dialog stored in a resource, you need to call DialogBoxParam. Your main.cpp would look something like:

#include <windows.h>
#include "resource.h" // this file is automatically made by the resource editor

int CALLBACK WinMain(HINSTANCE hInstSelf,HINSTANCE,LPSTR,int)
{
  return DialogBoxParam(hInstSelf,MAKEINTRESOURCE( IDD_DIALOG1 ),NULL,NULL,0);
}

You need to swap IDD_DIALOG1 with the resource id you gave the dialog in the resource editor. Ive left the DialogProc NULL, but thats only going to work for simple dialogs with an IDCLOSE button.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜