Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Window inside other processes frame ?

Status
Not open for further replies.

Mnjaro

Programmer
Apr 21, 2005
2
CA
Is there any way to display window created in another application inside the frame (window) in other application. Circumstances are:

- Application obtains frame-applications window handle with FindWindow(...)
- Application (MFC) creates a window (CDialog ancestor) with Create and gives queried handle as a parent parameter
- Application notifies frame-application with PostMessage that window is created. frame-application then tries to move the window in right position inside its frame

Depending on tricks (SetParent, SetPos etc...) best I can do is that window appears inside frame-applications frame in weird location and does not move regardless what I do. Window is also not displayed properly (transparent caption etc...)

In general (if possible) what would be a proper way to achieve this kind of behauviour ?
 
The last time I actually tried anything like that was on Windows 3.11.

A better way is to just send the application a message and the application will decide what to pop up. You can tell the application the preferred location but the application will actually do the positioning.

Remember that some of the calls are relative to the window frame; others are relative to the top left corner. If you're out by about 50 vertically, you've forgotten the title bar. If you're out by 5 or 10, you've forgotten the frame/margins.

Windows is particularly awkward in that it tells you positions relative to the top left but expects you to tell it positions relative to the parent. If you don't do it correctly, the window just disappears off the screen. There is also the client position and the window position. Make sure you've got the right one. It is quite a bit of arithmetic subtracting heights of title bars etc. This hasn't changed since Windows 2.11.

Sometimes it is in DLUs (Device Logical Units) and sometimes it is in pixels. DLUs are something strange. When I last used them, they were the character height divided by 4. If you switch to one of the Asian languages, the dialogs are reshaped and your bitmaps won't fit anymore.
 
The positioning is not the problem here but the parent of the window to be shown. It is essential that I can show the window created in first process inside the frame window of another process. So, I somehow need to set other processes window as a parent to the one in first process. What will be the best solution to do that ?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top