【发布时间】:2011-08-02 08:13:06
【问题描述】:
在运行时单击按钮时如何调整全局 hwnd 变量的大小?
或者只是在运行时调整窗口大小的任何方式。 即
HWND hwnd; //global
int buttonid = 250; // an id for a button
//also global
int WINAPI wWinMain(/*blah blah blah */) {
//blah blah blah
hwnd = CreateWindowEx(
0,
L"WindowClass",
L"Window",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT,
300, 275,
NULL,
NULL,
hInstance,
NULL
);
HWND mybutton = CreateWindow(
L"BUTTON",
L"Button",
WS_VISIBLE | WS_CHILD | WS_TABSTOP,
14, 13,
250, 200,
hwnd,
(HMENU)buttonid,
hInstance,
NULL
);
//blah blah blah
}
LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lparam) {
switch(uMsg) {
case WM_COMMAND:
if(buttonid==wParam) {
//this is where i want the code for resizing hwnd so when you click the
//button it resizes the window
}
}
}
【问题讨论】:
标签: winapi resize window height