我用的是vs 2003
用vc写个sdk程序 不用mfc
添加了一个设置热键的窗口
开始都好
就是往那个窗口加个 hot key 控件
编译后就看不到了
不知道为什么
奇怪啊

解决方案 »

  1.   

    int WinMain(HINSTANCE, HINSTANCE, LPTSTR, int nCmdLine)
    {
    INITCOMMONCONTROLSEX icc;
    icc.dwSize=sizeof(INITCOMMONCONTROLSEX);
    icc.dwICC=ICC_HOTKEY_CLASS;
    InitCommonControlsEx(&icc);
    ......
    return 0;
    }
      

  2.   

    直接写啦:
    RegisterHotKey(NULL,0x0001,MOD_CONTROL|MOD_SHIFT,VK_X);//热键为Ctrl+Alt+X
    接着在消息循环中这样写:
    case WM_HOTKEY:
       if (int(msg.wParam)==0x0001)
       ...
      

  3.   

    chehw(chehw) 写的是什么意思?icc.dwICC=ICC_HOTKEY_CLASS;
    InitCommonControlsEx(&icc);看不懂
      

  4.   

    使用Windows Common Controls控件时需要先初始化。
    #include <commctrl.h>
    #pragma comment(lib,"comctl32.lib")一般可在WinMain中调用InitCommonControls();或InitCommonControlsEx(&icc);
    其中icc.dwICC指明你需要使用哪一种控件。
    如Treeview: ICC_TREEVIEW_CLASSES;
    ListView: ICC_LISTVIEW_CLASSES;
    Toolsbar, statusbar: ICC_BAR_CLASSES;
    hotkey: ICC_HOTKEY_CLASSES;
    等等。
    详细说明可直接查MSDN
      

  5.   

    直接写啦:
    RegisterHotKey(NULL,0x0001,MOD_CONTROL|MOD_SHIFT,VK_X);//热键为Ctrl+Alt+X
    接着在消息循环中这样写:
    case WM_HOTKEY:
       if (int(msg.wParam)==0x0001)
       ...
      

  6.   

    1 初始化Windows Common Controls控件时
    InitCommonControlsEx(&icc);
    2
    直接用RegisterHotKey()生成一个全局的HotKey然后在消息映射中响应即可