Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Setparent and SetPos : Buttons/menus not accessible

16 views
Skip to first unread message

vivek

unread,
Feb 14, 2012, 1:56:12 AM2/14/12
to
Hi,

I am working on windows form application using c#.
I need to set parent a thick client application inside a tab
control(tab page)
The code to set parent is

[DllImport("user32.dll", SetLastError = true)]
static extern IntPtr SetParent(IntPtr hWndChild, IntPtr
hWndNewParent);

SetParent(<thick client application handle>, tabpage handle)

and then am using setwindowpos function to set its position in tab
page

SetWindowPos((int)<thick client application handle>, 0, 0, 0,
this.Width, 0, (uint)SWP_NOZORDER | (uint)SWP_NOSIZE |
(uint)SWP_SHOWWINDOW);

This code works fine in win xp. But for some Win 7 machines after
doing setparent and setpos , the menus and the buttons on that thick
client doesn't work. i.e. they does not response to mouse clicks.
Although the keystrokes works i.e. if i do a tab and press enter
buttons will respond. What is wrong with my code?
Please provide your inputs on the same.

Thanks
Vivek

Fred

unread,
Feb 14, 2012, 3:35:38 AM2/14/12
to

"vivek" <vivek...@gmail.com> a écrit dans le message de news:
c947e2b3-4c0e-42c3...@v6g2000pba.googlegroups.com...
> Hi,
>
> I am working on windows form application using c#.
> I need to set parent a thick client application inside a tab
> control(tab page)

If it is in another process, you cannot do that.


vivek

unread,
Feb 14, 2012, 6:32:34 AM2/14/12
to
On Feb 14, 1:35 pm, "Fred" <f...@hallison.fr> wrote:
> "vivek" <vivek.c...@gmail.com> a écrit dans le message de news:
> c947e2b3-4c0e-42c3-8a1c-afcd3df20...@v6g2000pba.googlegroups.com...
>
> > Hi,
>
> > I am working on windows form application using c#.
> > I need to set parent a thick client application inside a tab
> > control(tab page)
>
> If it  is in another process, you cannot do that.

Hi Fred,

I am not sure about this, but my concern is that it is working on Win
XP, so why its behaviour is different in Win 7

Rohini

unread,
Mar 4, 2016, 8:15:43 AM3/4/16
to
Same problem i am facing...have you got the solution for it??


Big Bad Bob

unread,
May 9, 2016, 7:01:14 PM5/9/16
to
On 03/04/16 05:15, Rohini so wittily quipped:
> Same problem i am facing...have you got the solution for it??
>
>

maybe you need to call 'EnableWindow' on them after re-setting the
owner, or set their Z order properly, or one of those kinds of things...
or force them to update/re-paint with an 'UpdateWindow' call.


0 new messages