⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 toshowwindows.txt

📁 实现窗口显示功能
💻 TXT
字号:
#include "windows.h" 
#include "stdio.h" 


LRESULT CALLBACK Winsun( 
HWND hwnd, // handle to window 
UINT uMsg, // message identifier 
WPARAM wParam, // first message parameter 
LPARAM lParam // second message parameter 
); 

int APIENTRY WinMain(HINSTANCE hInstance, 
HINSTANCE hPrevInstance, 
LPSTR lpCmdLine, 
int nCmdShow) 
{ 
WNDCLASS classone; 
classone.cbClsExtra=0; 
classone.cbWndExtra=0; 
classone.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH); 
classone.hCursor=LoadCursor(NULL,IDC_ARROW); 
classone.hIcon=LoadIcon(NULL,IDI_ASTERISK); 
classone.hInstance=hInstance; 
classone.lpfnWndProc=Winsun; 
classone.lpszClassName="yy"; 
classone.lpszMenuName=NULL; 
classone.style=CS_HREDRAW|CS_VREDRAW; 

RegisterClass(&classone); 

HWND hwnd; 
hwnd=CreateWindow("yy","jue",WS_OVERLAPPEDWINDOW,0,0,800, 
800,NULL,NULL,hInstance,NULL); 

ShowWindow(hwnd,SW_SHOWNORMAL); 
UpdateWindow(hwnd); 

MSG msg; 
while(GetMessage(&msg,NULL,0,0)) 
{ 
TranslateMessage(&msg); 
DispatchMessage(&msg); 
} 

return 0; 
} 

LRESULT CALLBACK Winsun( 
HWND hwnd, // handle to window 
UINT uMsg, // message identifier 
WPARAM wParam, // first message parameter 
LPARAM lParam // second message parameter 
) 
{ 

switch(uMsg) 
{ 
case WM_PAINT: 
HDC hdc; 
PAINTSTRUCT pss; 
hdc=BeginPaint(hwnd,&pss); 
TextOut(hdc,0,0,"123456",strlen("123456")); 
EndPaint(hwnd,&pss); 
break; 
case WM_CLOSE: 
if(IDYES==MessageBox(hwnd,"yes or no","xz",MB_YESNO)) 
{ 
DestroyWindow(hwnd); 
} 
case WM_DESTROY: 
PostQuitMessage(0); 
break; 

default: 
DefWindowProc(hwnd,uMsg,wParam,lParam); 
} 
return 0; 
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -