游戏开发论坛

 找回密码
 立即注册
搜索
查看: 1105|回复: 0

无法相应销毁对话框消息

[复制链接]

20

主题

84

帖子

84

积分

注册会员

Rank: 2

积分
84
发表于 2010-1-10 18:38:00 | 显示全部楼层 |阅读模式
#include "stdafx.h"

HWND g_hWnd;                    // Window handle
char g_szClass[] = "EnumDemo";  // Class name

LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
  switch(uMsg) {
    case WM_DESTROY:
      PostQuitMessage(0);
      break;
       
  default:return DefWindowProc(hWnd, uMsg, wParam, lParam);
  }

return 0;
  
}

int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{
g_hWnd = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_DIALOG), 0, NULL);
  UpdateWindow(g_hWnd);
  ShowWindow(g_hWnd, nCmdShow);
  MSG Msg;
  while(GetMessage(&Msg, NULL, 0, 0)) {
    TranslateMessage(&Msg);
    DispatchMessage(&Msg);
  }
  return 0;

}


上面的对话框无法关闭 为什么?
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

作品发布|文章投稿|广告合作|关于本站|游戏开发论坛 ( 闽ICP备17032699号-3 )

GMT+8, 2025-6-16 11:54

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表