how can i create a child window in Win32 API?
is it possible with CreateWindowEx() ?
how can i create a child window in Win32 API?
is it possible with CreateWindowEx() ?
Please take the time to read through the material referenced when you first asked this question.
There's also a thread, a couple of posts down from this, Learning Windows Programming, that contains information that is both relevant and helpful to your enquiry.
Searching this board will bring up plenty of information to help you get started.
But the short answer is, yes, you can.
CProgramming FAQ
Caution: this person may be a carrier of the misinformation virus.
Create the window with the WS_CHILD style and set the hWndParent, to the child window's Parent.
yea it works now, thanks for the help =)
I have another problem:
i want to pass the handle of the main window to a function, but not a copy of the handle - the handle itself.
but the disable just won't work. i tried to get a reference to the handle:Code:void foo(HWND hwnd) { DisableWindow(hwnd, FALSE); } HWND hwndMain; foo(hwndMain);
but it doesn't work either.Code:void foo(HWND& hwnd);
what's the solution?
This code dose what you would expect, the function DisableWindow is called on the window handle passed to the function named foo. I'm not aware of a windows function named DisableWindow did you mean to use EnableWindow?Originally Posted by hiya
oops yea, i meant enable.
well, the function really work but it's not exactly how i do it, thought it will work the same.
anyway, here's my code more or less:
and this isn't working... why?Code:class Wnd { protected: HWND hwnd; HWND hwndParent; public: Wnd(HWND hParent):hwndParent(hParent) {} void foo() { EnableWindow(hwndParent, FALSE); } } Wnd obj(hwndMain); obj.foo();
Probably because hwndMain/hwndParent isn't a valid window handle - what does IsWindow have to say about it?
CProgramming FAQ
Caution: this person may be a carrier of the misinformation virus.
hwndMain is a valid window handle and hwndParent\hParent isn't.
why is that? it works in any function but in a class...
found my problem: i created that object before i created a window for the hwndMain
thanks