- Odd Problem with SetParent
- Posted by Matt on May 8th, 2008
Hello to all,
I'm having something of a problem with the WinAPI call SetParent.
Here's the scenario.
I am trying to take an existing program, and run it within my own
window. I can make this
happen, the code looks like this:
/ Remove border and whatnot
long style = GetWindowLong(appWin, GWL_STYLE);
long new_style = WS_CHILD | WS_VISIBLE;
SetWindowLong(appWin, GWL_STYLE, new_style);
// Put it into this form
SetParent(appWin, this.panel1.Handle);
// Move the window to overlay it on this window
MoveWindow(appWin, 0, 0, this.Width, this.Height, true);
SendMessage((int)m_appWin, WM_PAINT, 0, "");
Where appWin is the handle to the main window of the program I start
with Process.Start and
Handle is the handle of the control I want to "reparent" the window
within. It works fine, the
application is "relocated" within my window. However...
For Itunes (which is the program I'm trying to reparent), I can
launch
it, reparent it, and have
it display itself properly. However, once I do, it no longer receives
any mouse clicks. It doesn't
even act as if the mouse is getting to that window. I've checked to
see if the mouse clicks are
going to MY window handle, but they are not.
Any ideas?
Thanks
Matt
- Posted by Scott Seligman on May 8th, 2008
Matt <matttelles@sprynet.com> wrote:
This is unsupported. The SetParent documentation makes this quite
clear:
] The new parent window and the child window must belong to the same
] application.
--
--------- Scott Seligman <scott at <firstname> and michelle dot net> ---------
Tragedy is when I cut my finger. Comedy is when you fall into an open
sewer and die.
-- Mel Brooks
- Posted by Matt on May 8th, 2008
On May 8, 2:53*pm, "Scott Seligman" <selig...@example.com> wrote:
Well, yes, I know this and so does everyone else. However, given that
the window
DOES get reparented (and that others are doing similar things) I'm
simply curious
as to why it wouldn't work.
The strange thing is that I can set the parent fine, and move the
window fine, and it
will react properly. What causes the problem is setting the WS_CHILD
flag on the
application window.
Matt
- problem after problem after problem - winXP wont start! (Help and Support) by Mavirick
- System Restore Tab still has access problem (multi-disk problem?) srrstr.dll error (Performance/Maintainence) by Dallas Overturf
- Problems With Adaptec 2400a RAID Card. (rare problem ? ? ? or Common Problem...? ? ?) (Computer Hardware) by Starz_Kid
- Using Removeparent and setparent on notes (Windows CRM) by Rajat
- SetParent function (Development Resources) by Corno

