不要急,看看CreateWindowEx的声明 HWND CreateWindowEx( DWORD dwExStyle, // extended window style LPCTSTR lpClassName, // pointer to registered class name LPCTSTR lpWindowName, // pointer to window name DWORD dwStyle, // window style int x, // horizontal position of window int y, // vertical position of window int nWidth, // window width int nHeight, // window height HWND hWndParent, // handle to parent or owner window HMENU hMenu, // handle to menu, or child-window identifier HINSTANCE hInstance, // handle to application instance LPVOID lpParam // pointer to window-creation data );现在应该清楚了,你的控件ID就是原来菜单句柄的位置,ID是自己设置 应该这样定义hwndCtrl=CreateWindowEx(...,HMENU(自己设置ID,1...n都,但是不能和其他的ID相同),...);
HWND CreateWindowEx(
DWORD dwExStyle, // extended window style
LPCTSTR lpClassName, // pointer to registered class name
LPCTSTR lpWindowName, // pointer to window name
DWORD dwStyle, // window style
int x, // horizontal position of window
int y, // vertical position of window
int nWidth, // window width
int nHeight, // window height
HWND hWndParent, // handle to parent or owner window
HMENU hMenu, // handle to menu, or child-window identifier
HINSTANCE hInstance, // handle to application instance
LPVOID lpParam // pointer to window-creation data
);现在应该清楚了,你的控件ID就是原来菜单句柄的位置,ID是自己设置
应该这样定义hwndCtrl=CreateWindowEx(...,HMENU(自己设置ID,1...n都,但是不能和其他的ID相同),...);