![]() |
| | #1 |
| Registered User Join Date: Apr 2008
Posts: 610
| Limitations on Win32 API functions ... Usually, one has to first define WndProc() function to handle messages and then use WinMain() to create a window. In my case, there's no need to create a new window in the WinMain() function, QUEST has a function GetFrameWindow() which return a handle (HWND). Can i use the WinMain() function but eliminate all the code which creates a new windows, perhaps leave the following lines... Code: ShowWindow(hWnd,iCmdShow);
UpdateWindow(hWnd);
while (GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
|
| csonx_p is offline | |
| | #2 |
| Malum in se Join Date: Apr 2007
Posts: 3,188
| CreateWindow() is what actually creates the window. ShowWindow() displays it. that while loop is the message loop that actually handles displatching the messages to the window procedure (WindProc) for the window you specify. In yoru case you are specifying NULL which means the window for the callign thread. If you want ot manipulate the window that is already created by the application, you need to retrieve a handle to that window, and use that handle in the API calls.
__________________ Until you can build a working general purpose reprogrammable computer out of basic components from radio shack, you are not fit to call yourself a programmer in my presence. This is cwhizard, signing off. |
| abachler is offline | |
| | #3 | |
| Registered User Join Date: Apr 2008
Posts: 610
| Quote:
| |
| csonx_p is offline | |
| | #4 | |
| Mysterious C++ User Join Date: Oct 2007
Posts: 14,785
| Yes, it's possible to specify a new WindowProc using SetWindowLong. It's called subclassing. But what is need of such a thing? Is there some behavior you need to override?
__________________ Using: Microsoft Windows™ 7 Professional (x64), Microsoft Visual Studio™ 2008 Team System I dedicated my life to helping others. This is only a small sample of what they said: "Thanks Elysia. You're a programming master! How the hell do you know every thing?" Quoted... at least once. Quote:
| |
| Elysia is offline | |
| | #5 |
| Registered User Join Date: Apr 2008
Posts: 610
| I need to have control over my frames (draw objects, animate them, listen to messages, etc). But this has to be done on existing frame windows (no need to CreateWindow() in WinMain() )... QUEST tool i'm using uses its own frames |
| csonx_p is offline | |
| | #6 | |
| Mysterious C++ User Join Date: Oct 2007
Posts: 14,785
| I see. In that case, you can specify your own WindowProc using SetWindowLong. It will returns the previous WindowProc function, so you can also use a function pointer and call the old windowproc for any messages your own function doesn't handle.
__________________ Using: Microsoft Windows™ 7 Professional (x64), Microsoft Visual Studio™ 2008 Team System I dedicated my life to helping others. This is only a small sample of what they said: "Thanks Elysia. You're a programming master! How the hell do you know every thing?" Quoted... at least once. Quote:
| |
| Elysia is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Domain for Win32 API | maxorator | General Discussions | 0 | 10-28-2006 10:16 AM |
| Will win32 API programming knowledge in C still aplly to MS Vista? | mr.v. | Windows Programming | 7 | 09-18-2005 08:11 PM |
| Win32 API or Win32 SDK? | jverkoey | General Discussions | 2 | 07-20-2005 03:26 PM |
| Classes and Win32 API, and another Question | philvaira | Windows Programming | 10 | 04-10-2004 07:21 PM |
| pthread api vs win32 thread api | Unregistered | Windows Programming | 1 | 11-20-2001 08:55 AM |