//1.找到回调函数WindProcedure,有些书是WndProc //2.定义一个HWND hwndButton //3.在switch(Msg)下的case WM_CREATE: 添加如下代码 hwndButton=CreateWindow(TEXT("button"),//必须为:button TEXT("anniu"),//按钮上显示的字符 WS_CHILD | WS_VISIBLE, 0,0,20,20, hWnd,(HMENU)0, ((LPCREATESTRUCT)lParam)->hInstance,NULL); //4.运行就可以了 /*备注:下面是CreateWindow()函数的参数 HWND CreateWindow( LPCTSTR lpClassName, LPCTSTR lpWindowName, DWORD dwStyle, int x, int y, int nWidth, int nHeight, HWND hWndParent, HMENU hMenu, HANDLE hInstance, PVOID lpParam ); */
Win32编程---在窗体添加一个按钮
最新推荐文章于 2022-07-10 10:19:45 发布