《windows程序设计》声音与音乐那章的一个例子TESTMIC.C,里面有这么一段,用于弹出一个对话框,
我在rc文件中创建一个对话框后运行该程序,却总看不到对话框,而是得到MessageBox里的内容,
试了好久,不知道为什么,请各位指教一下.#include <windows.h>
#include "resource.h"#define ID_TIMER 1BOOL CALLBACK DlgProc (HWND, UINT, WPARAM, LPARAM) ;TCHAR szAppName [] = TEXT ("TestMci") ;int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow){
if (-1 == DialogBox (hInstance, TEXT("TESTMCI"), NULL, DlgProc))
{
MessageBox (NULL, TEXT ("This program requires Windows NT!"),
szAppName, MB_ICONERROR) ;
}
return 0 ;
}
我在rc文件中创建一个对话框后运行该程序,却总看不到对话框,而是得到MessageBox里的内容,
试了好久,不知道为什么,请各位指教一下.#include <windows.h>
#include "resource.h"#define ID_TIMER 1BOOL CALLBACK DlgProc (HWND, UINT, WPARAM, LPARAM) ;TCHAR szAppName [] = TEXT ("TestMci") ;int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow){
if (-1 == DialogBox (hInstance, TEXT("TESTMCI"), NULL, DlgProc))
{
MessageBox (NULL, TEXT ("This program requires Windows NT!"),
szAppName, MB_ICONERROR) ;
}
return 0 ;
}
HINSTANCE hInstance,
LPCTSTR lpTemplate,
HWND hWndParent,
DLGPROC lpDialogFunc); lpTemplate
[in] Long pointer to the dialog box template. This parameter is either the pointer to a null-terminated character string that specifies the name of the dialog box template or an integer value that specifies the resource identifier of the dialog box template. If the parameter specifies a resource identifier, its high-order word must be zero and its low-order word must contain the identifier. You can use the MAKEINTRESOURCE macro to create this value.
然后我在rc文件里把对话框命名为"TestMci" 或者"TESTMCI"都不对
http://blog.csdn.net/hityct1/archive/2008/12/28/3624857.aspx对话框资源要存在。
DialogBox (hInstance, TEXT("TESTMCI"), NULL, DlgProc);你用TEXT做什么?
返回值是:has exited with code 0 (0x0).