还有个问题 是
如果不通过资源文件的编辑 如
怎么在Register()函数中直接创建菜单 及其ID?
我尝试过这么弄
[ 本帖最后由 有容就大 于 2012-5-9 21:24 编辑 ]
如果不通过资源文件的编辑 如
程序代码:
GuiTextMenu MENU BEGIN MenuItem "Run Console" CM_CONSOLE END
怎么在Register()函数中直接创建菜单 及其ID?
我尝试过这么弄
程序代码:
static char szMenuName[] = "Run Console"; HMENU hMenu; //////////////////////////////////// // Register the window //////////////////////////////////// #pragma argsused BOOL Register(HINSTANCE hInst) { WNDCLASSEX wcx; HICON hIcon = (HICON)LoadImage(NULL, "Icon.ico", IMAGE_ICON, 0, 0, LR_LOADFROMFILE); HCURSOR hCursor = (HCURSOR)LoadImage(NULL, "Hand.cur", IMAGE_CURSOR, 0, 0, LR_LOADFROMFILE); hMenu = CreateMenu(); AppendMenu(hMenu, 0, CM_CONSOLE, szMenuName); wcx.cbSize = sizeof(wcx); wcx.style = CS_HREDRAW | CS_VREDRAW; wcx.lpfnWndProc = WndProc; wcx.hInstance = hInst; wcx.cbClsExtra = 0; wcx.cbWndExtra = 0; wcx.hCursor = hCursor; wcx.hIcon = hIcon; wcx.hIconSm = hIcon; wcx.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); wcx.lpszMenuName = szMenuName;// ??? szMenuName 起不到任何作用啊 wcx.lpszClassName = szAppName; return (RegisterClassEx(&wcx)); // The function here is very important }
[ 本帖最后由 有容就大 于 2012-5-9 21:24 编辑 ]
梅尚程荀
马谭杨奚