有人遇到过类似的问题么,谢谢附上我的程序// nethookApp.cpp : Defines the entry point for the application.
//#include "stdafx.h"
#include "resource.h"// 程序中全局变量的定义
TCHAR szAppName[] = "program";// 程序中函数的定义
LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);//////////////////////////////////////////////////////////////////////
// 函数名称 : WinMain() //
// 函数功能 : 开始程序,创建窗口 //
//////////////////////////////////////////////////////////////////////
int APIENTRY WinMain ( HINSTANCE hInstance ,
HINSTANCE hPrevInstance ,
PSTR szCmdLine ,
int iCmdShow)
{
HWND hwnd; // 窗口句柄
MSG msg; // 消息变量
WNDCLASSEX ws; // 视窗类
// 定义视窗类
ws.cbSize  = sizeof (ws);
ws.cbClsExtra  = 0;
ws.cbWndExtra  = DLGWINDOWEXTRA;
ws.hbrBackground  = (HBRUSH) (COLOR_BTNFACE+1);
ws.hCursor  = LoadCursor (NULL, IDC_ARROW);
ws.hIcon  = LoadIcon (hInstance, NULL);
ws.hIconSm  = NULL;
ws.hInstance  = hInstance;
ws.lpfnWndProc  = WndProc;
ws.lpszClassName  = szAppName;
ws.lpszMenuName  = NULL;
ws.style  = CS_HREDRAW | CS_VREDRAW; // 注册视窗类
if (!RegisterClassEx (&ws)){
MessageBox (NULL, "RegisterClass Error", "Error", MB_ICONERROR);
return 0;
} // 创建窗口
hwnd = CreateDialog (hInstance , szAppName , NULL , NULL); ShowWindow (hwnd, iCmdShow);
UpdateWindow (hwnd); // 消息循环
while(GetMessage (&msg, NULL, 0, 0)){
TranslateMessage (&msg);
DispatchMessage (&msg);
}
return msg.wParam;
}//////////////////////////////////////////////////////////////////////
// 函数名称 : WndProc() //
// 函数功能 : 处理 "Program" 窗口消息 //
//////////////////////////////////////////////////////////////////////
LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message){
case WM_INITDIALOG:
MessageBox (NULL, "dfasdf", NULL, MB_OK);
break; case WM_DESTROY:
PostQuitMessage (0);
return 0;
}
return DefWindowProc (hwnd, message, wParam, lParam);
}当中那个WM_INITDIALOG消息里面的MessageBox始终无法弹出来,不知道各位是怎么做的?