Q://问了无数大虾,可无一人知道??!!用VC和SDK(不用MFC)编程如何将HINST_COMMCTRL系统提供的图形按钮改成自己的位图? //问题:如何将HINST_COMMCTRL系统提供的图形按钮改成自己的位图?问题在下面!我有注释! #include <windows.h> #include <commdlg.h> #include <stdio.h> #include <stdlib.h> #include <commctrl.h> #include "窗口类控件示例.h" OPENFILENAME ofn; HWND hStatusBar,hToolBar; HINSTANCE hInst; int RightEnd[2]; LPNMHDR lpnmhdr; LPTOOLTIPTEXT lpttext; //定义工具栏按钮 TBBUTTON tbButton[]= { STD_FILENEW,IDM_NEW,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0,0,0, STD_FILEOPEN,IDM_OPEN,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0,0,0, STD_FILESAVE,IDM_SAVE,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0,0,0, 0,0,TBSTATE_ENABLED,TBSTYLE_SEP,0,0,0,0, STD_CUT,IDM_CUT,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0,0,0, STD_COPY,IDM_COPY,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0,0,0, STD_PASTE,IDM_PASTE,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0,0,0, }; LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInst, LPSTR lpszCmdLine, int nCmdShow) { HWND hwnd ; MSG Msg ; HACCEL hAccel; WNDCLASS wndclass ; char lpszMenuName[]="Menu"; char lpszClassName[] = "窗口类控件"; char lpszTitle[]= "窗口类控件示例";
wndclass.style = 0; wndclass.lpfnWndProc = WndProc ; wndclass.cbClsExtra = 0 ; wndclass.cbWndExtra = 0 ; wndclass.hInstance = hInstance ; wndclass.hIcon = LoadIcon( NULL, IDI_APPLICATION) ; wndclass.hCursor = LoadCursor( NULL, IDC_ARROW) ; wndclass.hbrBackground = GetStockObject( WHITE_BRUSH) ; wndclass.lpszMenuName = lpszMenuName ; wndclass.lpszClassName = lpszClassName ;
if( !RegisterClass( &wndclass)) { MessageBeep(0) ; return FALSE ; } hwnd = CreateWindow(lpszClassName, lpszTitle, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,, CW_USEDEFAULT, NULL, NULL, hInstance, NULL) ; ShowWindow( hwnd, nCmdShow) ; UpdateWindow(hwnd); InitCommonControls(); //初始化通用控件 hInst=hInstance; hAccel=LoadAccelerators(hInst,lpszMenuName); while( GetMessage(&Msg, NULL, 0, 0)) { if (!TranslateAccelerator(hwnd,hAccel,&Msg)) { TranslateMessage( &Msg) ; DispatchMessage( &Msg) ; } } return Msg.wParam; }
LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { static char szFilter[] = "Text Files (*.TXT)
Tags:作者:佚名
0
- 好的评价 如果您觉得此文章好,就请您
0%(0)
- 差的评价 如果您觉得此文章差,就请您
0%(0)
评论摘要(共 0 条,得分 0 分,平均 0 分)
查看完整评论
|