您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ DispatchMessage函数代码示例

51自学网 2021-06-01 20:28:15
  C++
这篇教程C++ DispatchMessage函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中DispatchMessage函数的典型用法代码示例。如果您正苦于以下问题:C++ DispatchMessage函数的具体用法?C++ DispatchMessage怎么用?C++ DispatchMessage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了DispatchMessage函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: WinMain

int PASCALWinMain(HANDLE hInstance, HANDLE hPrevInstance, LPSTR CmdLine, int nCmdShow){    MSG       msg;                      /* MSG structure to pass to windows proc */    WNDCLASS  wndclass;    char      *AppName;                 /* Name for the window */    cbErrHandling (PRINTALL, STOPALL);  /* Set library's error handling */    CmdLine = NULL;                     /* Not used */    AppName = "WINCDEMO";               /* The name of this application */    if(!hPrevInstance)        {        wndclass.style      = CS_HREDRAW | CS_VREDRAW;        wndclass.lpfnWndProc= MainMessageHandler;        wndclass.cbClsExtra = 0;        wndclass.cbWndExtra = 0;        wndclass.hInstance  = hInstance;        wndclass.hIcon      = LoadIcon (hInstance, AppName);        wndclass.hCursor    = LoadCursor (NULL, IDC_ARROW);        wndclass.hbrBackground  = GetStockObject (WHITE_BRUSH);        wndclass.lpszMenuName   = AppName;        wndclass.lpszClassName  = AppName;        RegisterClass (&wndclass);        }    /* create application's Main window                                    */    hWndMain = CreateWindow (AppName,                  /* Window class name          */                             "AInScan Foreground",                             WS_OVERLAPPEDWINDOW,                             CW_USEDEFAULT,           /* Use default X, Y            */                             CW_USEDEFAULT,           /* Use default X, Y            */                             GetSystemMetrics(SM_CXSIZE) * 12,   /* x - fit text      */                             GetSystemMetrics(SM_CYSIZE) * 20,  /* y - fit text      */                             NULL,                    /* Parent window's handle      */                             NULL,                    /* Default to Class Menu       */                             hInstance,               /* Instance of window          */                             NULL);                   /* Create struct for WM_CREATE */    if (hWndMain == NULL)        {        MessageBox(NULL, "Could not create window in WinMain", NULL, MB_ICONEXCLAMATION);        return (1);        }    ShowWindow(hWndMain, nCmdShow);     /* Display main window      */    UpdateWindow(hWndMain);    /* Start a 500ms timer to update display *///    if(!SetTimer(hWndMain, TIMER_NUM, 500, NULL))//        {//        MessageBox(NULL, "Error starting Windows timer", NULL, MB_OK |//                   MB_ICONEXCLAMATION); //       return (1); //       }                                      while(GetMessage(&msg, NULL, 0, 0)) /* Main message loop */        {        TranslateMessage(&msg);        DispatchMessage(&msg);        }    UnregisterClass (AppName, hInstance);    return (msg.wParam);} 
开发者ID:mikanradojevic,项目名称:sdkpub,代码行数:66,


示例2: wWinMain

int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow){	srand(time(NULL));	WNDCLASSEX windowClass;	ZeroMemory(&windowClass, sizeof(WNDCLASSEX));	windowClass.cbSize = sizeof(WNDCLASSEX);	windowClass.hbrBackground = reinterpret_cast<HBRUSH>(COLOR_WINDOW);	windowClass.hInstance = hInstance;	windowClass.lpfnWndProc = WindowProc;	windowClass.lpszClassName = "MainWindow";	windowClass.style = CS_HREDRAW | CS_VREDRAW;	RegisterClassEx(&windowClass);		RECT rect = { 0, 0, WINDOW_WIDTH, WINDOW_HEIGHT };	AdjustWindowRectEx(&rect, WS_OVERLAPPEDWINDOW, false, WS_EX_OVERLAPPEDWINDOW);	HWND windowHandle = CreateWindowEx(WS_EX_OVERLAPPEDWINDOW, windowClass.lpszClassName, "Codrut Niculescu's Tetris Project", WS_OVERLAPPEDWINDOW, 100, 100, (rect.right-rect.left), (rect.bottom-rect.top), NULL, NULL, hInstance, NULL);	if (windowHandle == NULL)	{		return -1;	}	graphics = new Graphics();	if (graphics->Init(windowHandle) == false)	{		delete graphics;		return -1;	}	ShowWindow(windowHandle, nCmdShow);	MSG message;	message.message = WM_NULL;	GameController::Init();	while (message.message != WM_QUIT)	{		if (PeekMessage(&message, NULL, 0, 0, PM_REMOVE))		{			DispatchMessage(&message);		}		else		{			GameController::Update();			// Render!			graphics->BeginDraw();			GameController::Render(graphics);			graphics->EndDraw();			GameController::FinishedBlock();					}	}	delete graphics;	return 0;}
开发者ID:codrut-n,项目名称:FunTetris,代码行数:66,


示例3: WinMain

/* ************************************* 功能	显示一个窗口**************************************/int WINAPI WinMain(HINSTANCE hinstance,                    HINSTANCE hPrevInstance,                    LPSTR lpCmdLine,                    int nCmdShow) {         WNDCLASSEX wcx;         // 窗口类    HWND hwnd;              //  窗口句柄         MSG msg;                // 消息    BOOL fGotMessage;       // 是否成功获取消息    hinst = hinstance;      // 应用程序实例句柄,保存为全局变量    // 填充窗口类的数据结构    wcx.cbSize = sizeof(wcx);          // 结构体的大小    wcx.style = CS_HREDRAW |         CS_VREDRAW;                    // 样式:大小改变时重绘界面     wcx.lpfnWndProc = MainWndProc;     // 窗口消息处理函数     wcx.cbClsExtra = 0;                // 不使用类内存    wcx.cbWndExtra = 0;                // 不使用窗口内存     wcx.hInstance = hinstance;         // 所属的应用程序实例句柄     wcx.hIcon = LoadIcon(NULL,         IDI_APPLICATION);              // 图标:默认    wcx.hCursor = LoadCursor(NULL,         IDC_ARROW);                    // 光标:默认    wcx.hbrBackground = (HBRUSH)GetStockObject(         WHITE_BRUSH);                  // 背景:白色    wcx.lpszMenuName =  NULL;          // 菜单:不使用    wcx.lpszClassName = "MainWClass";  // 窗口类名     wcx.hIconSm = (HICON)LoadImage(hinstance, // 小图标        MAKEINTRESOURCE(5),        IMAGE_ICON,         GetSystemMetrics(SM_CXSMICON),         GetSystemMetrics(SM_CYSMICON),         LR_DEFAULTCOLOR);     // 注册窗口类    if(!RegisterClassEx(&wcx))    {        return 1;    }    // 创建窗口     hwnd = CreateWindow(         "MainWClass",        // 窗口名        "CH 2-3",            // 窗口标题         WS_OVERLAPPEDWINDOW, // 窗口样式          CW_USEDEFAULT,       // 水平位置X:默认         CW_USEDEFAULT,       // 垂直位置Y:默认        CW_USEDEFAULT,       // 宽度:默认        CW_USEDEFAULT,       // 高度:默认         (HWND) NULL,         // 父窗口:无         (HMENU) NULL,        // 菜单:使用窗口类的菜单         hinstance,           // 应用程序实例句柄         (LPVOID) NULL);      // 窗口创建时数据:无     if (!hwnd)     {        return 1;     }    // 显示窗口     ShowWindow(hwnd, nCmdShow);     UpdateWindow(hwnd);         // 消息循环    while (        (fGotMessage = GetMessage(&msg, (HWND) NULL, 0, 0)) != 0         && fGotMessage != -1)     {         TranslateMessage(&msg);         DispatchMessage(&msg);     }     return msg.wParam; } 
开发者ID:Trietptm-on-Coding-Algorithms,项目名称:CodeLibrary,代码行数:77,


示例4: WinMain

//.........这里部分代码省略.........	}	windowMessage = RegisterWindowMessage("poepulse_PulseCursor");	if (!windowMessage) {		MessageBox(NULL,"Failed to register custom message!", NULL, NULL);		return 1;	}	theDll = LoadLibrary("poepmod.dll");	if (!theDll) {		MessageBox(NULL,"Failed to load poepmod.dll!", NULL, NULL);		return 1;	}	hookProc = GetProcAddress(theDll,"[email
C++ DispatchMessageA函数代码示例
C++ Dispatch函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。