| //参数:窗口句柄,消息,消息参数,消息参数 LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { //处理感兴趣的消息 switch (message) { case WM_CREATE: CreateWindow(TEXT("BUTTON"), //控件"类名称" TEXT("按钮(&A)"), WS_CHILD | WS_VISIBLE |BS_PUSHBUTTON, 10, 10, 100, 100, hwnd, (HMENU)1000, //控件ID ((LPCREATESTRUCT) lParam)->hInstance, //实例句柄 NULL); return 0; case WM_DESTROY: //当用户关闭窗口,窗口销毁,程序需结束,发退出消息,以退出消息循环 PostQuitMessage (0) ; return 0 ; } //其他消息交给由系统提供的缺省处理函数 return ::DefWindowProc (hwnd, message, wParam, lParam) ; } |
| typedef struct tagCREATESTRUCT { LPVOID lpCreateParams; HINSTANCE hInstance; //实例句柄 HMENU hMenu; HWND hwndParent; int cy; int cx; int y; int x; LONG style; LPCTSTR lpszName; LPCTSTR lpszClass; DWORD dwExStyle; } CREATESTRUCT, *LPCREATESTRUCT; |
| WM_COMMAND: HIWORD(wParam):通知码(notification code) LOWORD(wParam):控件ID (HWND)lParam: 控件句柄 |
| MSDN-> Platform SDK-> User Interface Services->Windows User Interface->Controls |
| INITCOMMONCONTROLSEX icex;// Ensure that the common control DLL is loaded. icex.dwSize = sizeof(INITCOMMONCONTROLSEX); icex.dwICC = ICC_LISTVIEW_CLASSES; InitCommonControlsEx(&icex); HWND hWndListView =CreateWindowEx(0,WC_LISTVIEW, //WC_LISTVIEW不需要加引号 TEXT(""), WS_CHILD | WS_VISIBLE|WS_BORDER | LVS_ICON | LVS_EDITLABELS | WS_EX_CLIENTEDGE , 10, 10, 100, 100, hwnd, (HMENU)1000, //控件ID ((LPCREATESTRUCT) lParam)->hInstance, //实例句柄 NULL); } ANIMATE_CLASS DATETIMEPICK_CLASS HOTKEY_CLASS MONTHCAL_CLASS PROGRESS_CLASS REBARCLASSNAME STATUSCLASSNAME TOOLBARCLASSNAME TOOLTIPS_CLASS TRACKBAR_CLASS UPDOWN_CLASS WC_COMBOBOXEX WC_HEADER WC_IPADDRESS WC_LISTVIEW WC_PAGESCROLLER WC_TABCONTROL WC_TREEVIEW |
| ComboLBox :The class for the list box contained in a combo box. DDEMLEvent :Windows NT/2000: The class for DDEML events. Message :Windows 2000: The class for a message-only window. #32768 :The class for a menu. #32769 :The class for the desktop window. #32770 :The class for a dialog box. #32771 :The class for the task switch window. #32772 :Windows NT/2000: The class for icon titles. |
最新相关文章
发表评论