c++ windows 窗体小程序

  • h4_519723
    了解作者
  • 14.7MB
    文件大小
  • rar
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-04-09 22:51
    上传日期
使用windows API 编的窗体小程序,能够很好地学习窗体编程
窗体程序.rar
  • WinMain
  • Debug
  • cl.command.1.tlog
    736B
  • vc60.pdb
    76KB
  • link.300.write.1.tlog
    2B
  • WinMain.pdb
    1.9MB
  • rc.command.1.tlog
    576B
  • CL.read.1.tlog
    19KB
  • vc100.idb
    515KB
  • mt.read.1.tlog
    422B
  • link.5408-cvtres.read.1.tlog
    2B
  • link-cvtres.read.1.tlog
    2B
  • link.read.1.tlog
    3.1KB
  • WinMain_manifest.rc
    210B
  • rc.read.1.tlog
    326B
  • link.write.1.tlog
    912B
  • link.300-cvtres.write.1.tlog
    2B
  • CL.write.1.tlog
    402B
  • WinMain.exe
    413KB
  • link.5408.read.1.tlog
    2B
  • link.300.read.1.tlog
    2B
  • WinMain.exe.embed.manifest
    406B
  • WinMain.sbr
    0B
  • vc100.pdb
    268KB
  • WinMain.log
    1.3KB
  • WinMain.exe.embed.manifest.res
    472B
  • link.5408.write.1.tlog
    2B
  • WinMain.lastbuildstate
    97B
  • link.command.1.tlog
    1.5KB
  • WinMain.unsuccessfulbuild
    0B
  • link.5408-cvtres.write.1.tlog
    2B
  • mt.write.1.tlog
    354B
  • WinMain.exe.intermediate.manifest
    381B
  • mt.command.1.tlog
    410B
  • link.300-cvtres.read.1.tlog
    2B
  • WinMain.ilk
    1MB
  • rc.write.1.tlog
    334B
  • link-cvtres.write.1.tlog
    2B
  • ipch
  • winmain-829b9d1c
  • winmain-1539ed89.ipch
    43.6MB
  • WinMain.sln
    880B
  • WinMain.dsw
    539B
  • WinMain.plg
    248B
  • WinMain.vcxproj
    6KB
  • WinMain.cpp
    2.2KB
  • WinMain.sdf
    29MB
  • WinMain.dsp
    3.4KB
  • WinMain.ncb
    41KB
  • WinMain.vcxproj.user
    143B
  • WinMain.suo
    10KB
  • WinMain.opt
    58.5KB
内容介绍
#include <windows.h> #include <stdio.h> using namespace std; LRESULT CALLBACK WinSunProc( HWND hwnd, // handle to window UINT uMsg, // message identifier WPARAM wParam, // first message parameter LPARAM lParam // second message parameter ); int WINAPI WinMain( HINSTANCE hInstance, // handle to current instance HINSTANCE hPrevInstance, // handle to previous instance LPSTR lpCmdLine, // command line int nCmdShow // show state ) { string str="qwe"; WNDCLASS wndcls; wndcls.cbClsExtra=0; wndcls.cbWndExtra=0; wndcls.hbrBackground=(HBRUSH)GetStockObject(BLACK_BRUSH); wndcls.hCursor=LoadCursor(NULL,IDC_CROSS); wndcls.hIcon=LoadIcon(NULL,IDI_ERROR); wndcls.hInstance=hInstance; wndcls.lpfnWndProc=WinSunProc; wndcls.lpszClassName="Weixin2003"; wndcls.lpszMenuName=NULL; wndcls.style=CS_HREDRAW | CS_VREDRAW; RegisterClass(&wndcls); HWND hwnd; hwnd=CreateWindow("Weixin2003","北京维新科学技术培训中心",WS_OVERLAPPEDWINDOW, 0,0,600,400,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 WinSunProc( HWND hwnd, // handle to window UINT uMsg, // message identifier WPARAM wParam, // first message parameter LPARAM lParam // second message parameter ) { switch(uMsg) { case WM_CHAR: char szChar[20]; sprintf(szChar,"char is %d",wParam); MessageBox(hwnd,szChar,"weixin",0); break; case WM_LBUTTONDOWN: MessageBox(hwnd,"mouse clicked","weixin",0); HDC hdc; hdc=GetDC(hwnd); TextOut(hdc,0,50,"计算机编程语言培训",strlen("计算机编程语言培训")); ReleaseDC(hwnd,hdc); break; case WM_PAINT: HDC hDC; PAINTSTRUCT ps; hDC=BeginPaint(hwnd,&ps); TextOut(hDC,0,0,"维新培训",strlen("维新培训")); EndPaint(hwnd,&ps); break; case WM_CLOSE: if(IDYES==MessageBox(hwnd,"是否真的结束?","weixin",MB_YESNO)) { DestroyWindow(hwnd); } break; case WM_DESTROY: PostQuitMessage(0); break; default: return DefWindowProc(hwnd,uMsg,wParam,lParam); } return 0; }
评论
    相关推荐