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

📄 generic.c

📁 win32ASM教程
💻 C
字号:
#include <windows.h>#include "resource.h"static HINSTANCE hInst;static char szWindowClass[]="GENERIC";LRESULT CALLBACK WndProc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam);BOOL CALLBACK AboutDlgProc(HWND hDlg,UINT message,WPARAM wParam,LPARAM lParam);int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nShowCmd){	WNDCLASSEXA wcex;	HWND hWnd;	MSG msg;	hInst=hInstance;	if(!hPrevInstance)	{		wcex.cbSize=sizeof(WNDCLASSEXA);		wcex.style=CS_HREDRAW|CS_VREDRAW;		wcex.cbClsExtra=0;		wcex.cbWndExtra=0;		wcex.lpfnWndProc=WndProc;		wcex.hInstance=hInstance;		wcex.hIcon=LoadIconA(hInstance,IDI_APPLICATION);		wcex.hCursor=LoadCursorA(0,IDC_ARROW);		wcex.hbrBackground=(HBRUSH)(COLOR_WINDOW+1);		wcex.lpszMenuName=MAKEINTRESOURCE(IDR_MAINMENU);		wcex.lpszClassName=szWindowClass;		wcex.hIconSm=LoadIconA(hInstance,IDI_APPLICATION);		if(!RegisterClassExA(&wcex)) return FALSE;	}	hWnd=CreateWindowExA(0,szWindowClass,"Generic",WS_OVERLAPPEDWINDOW,						 CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,						 0,0,hInstance,NULL);	if(!hWnd) return FALSE;	ShowWindow(hWnd,nShowCmd);	UpdateWindow(hWnd);	while(GetMessageA(&msg,0,0,0))	{		TranslateMessage(&msg);		DispatchMessageA(&msg);	}	return msg.wParam;}LRESULT CALLBACK WndProc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam){	HDC hDC;	PAINTSTRUCT ps;	switch(message)	{	case WM_COMMAND:		switch(LOWORD(wParam))		{		case IDM_EXIT:			SendMessageA(hWnd,WM_CLOSE,0,0);			return 0;		case IDM_ABOUT:			DialogBoxParamA(hInst,MAKEINTRESOURCE(IDD_ABOUT),hWnd,(DLGPROC)AboutDlgProc,0);			return 0;		default:			return DefWindowProcA(hWnd,message,wParam,lParam);		}	case WM_PAINT:		hDC=BeginPaint(hWnd,&ps);		EndPaint(hWnd,&ps);		return 0;	case WM_DESTROY:		PostQuitMessage(0);		return 0;	default:		return DefWindowProcA(hWnd,message,wParam,lParam);	}	return -1;}BOOL CALLBACK AboutDlgProc(HWND hDlg,UINT message,WPARAM wParam,LPARAM lParam){	switch(message)	{	case WM_INITDIALOG:		return TRUE;	case WM_COMMAND:		if((LOWORD(wParam)==IDOK)||(LOWORD(wParam)==IDCANCEL))		{			EndDialog(hDlg,LOWORD(wParam));			return TRUE;		}		return FALSE;	default:		return FALSE;	}}

⌨️ 快捷键说明

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