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.
A:
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.
Chris Becke
2010-03-15 05:10:31