小编use*_*319的帖子

include <x> vs include <xh>

我知道我们总是包含一个头文件,那为什么我会找到一些头文件

#include<iostream>
Run Code Online (Sandbox Code Playgroud)

没有.h扩展名但是有些头文件

#include<windows.h>
Run Code Online (Sandbox Code Playgroud)

使用.h扩展名,我也尝试将add.h添加到某些头文件,如iostream.h,但是没有用,所以在包含文件时添加.h扩展名并不执行此操作之间有什么区别.

感谢所有的回复...非常感谢

c++ header-files

2
推荐指数
1
解决办法
455
查看次数

WINAPI GetMessage HWND

我正在使用Win32 API创建窗口,我遇到了这个部分的问题:

GetMessage(&message, NULL, 0, 0);
Run Code Online (Sandbox Code Playgroud)

我的问题是,当我尝试更改第二个参数(hwnd),它将接收消息到我之前做的窗口时,它不起作用; 例如,当我尝试关闭窗口时,它只隐藏并且不关闭.

这是完整的代码:

#include <windows.h>

LRESULT CALLBACK WinProc(HWND window, UINT message, WPARAM wParam, LPARAM lParam);

int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nCmdShow)
{
  WNDCLASS window;
  window.cbClsExtra = NULL;
  window.cbWndExtra = NULL;
  window.hbrBackground = (HBRUSH)COLOR_BACKGROUND;
  window.hCursor = LoadCursor(hInst, IDC_ARROW);
  window.hIcon = NULL;
  window.hInstance = hInst;
  window.lpfnWndProc = WinProc;
  window.lpszClassName = "WINDOW";
  window.lpszMenuName = NULL;
  window.style = CS_HREDRAW | CS_VREDRAW;

  RegisterClass(&window);

  HWND hwnd = CreateWindow("WINDOW", "Win32 Window Application", WS_OVERLAPPEDWINDOW | WS_VISIBLE, …
Run Code Online (Sandbox Code Playgroud)

c++ winapi hwnd window-messages

2
推荐指数
1
解决办法
3528
查看次数

标签 统计

c++ ×2

header-files ×1

hwnd ×1

winapi ×1

window-messages ×1