What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Plug-Ins » Manipulating window position given hwnd

Manipulating window position given hwnd
Author: Message:
eSouL
Junior Member
**


Posts: 36
Joined: Oct 2005
O.P. Manipulating window position given hwnd
Hi,

My plugin hides a conversation window (IMessengerConversationWnd object) by changing its 'Left' property to -20000, before opening my own custom window using ShowWindow API (such that it is non-modular). I do this because I need the conversation window to be active (minimized is not good enough) yet not visible.

Problem is, I want to restore the conversation window position when the user closes my custom window, presumably during Form_QueryUnload event. Now I have the hwnd to the conversation window, but how do I change its Left property?

I am using VB6 by the way.

Please offer suggestions. Thanks in advance!

This post was edited on 10-19-2005 at 10:22 AM by eSouL.
10-19-2005 10:21 AM
Profile E-Mail PM Find Quote Report
RaceProUK
Elite Member
*****

Avatar

Posts: 6073
Reputation: 57
39 / Male / Flag
Joined: Oct 2003
RE: Manipulating window position given hwnd
I think a better solution would be to hide the window the proper way, by using ShowWindow() with the HWND.
[Image: spartaafk.png]
10-19-2005 01:58 PM
Profile PM Web Find Quote Report
eSouL
Junior Member
**


Posts: 36
Joined: Oct 2005
O.P. RE: Manipulating window position given hwnd
I can't use ShowWindow(). I need to PostMessage() to the conversation window so I have to activate the window for a brief moment before returning control to my custom window. If the conversation window is visible on screen, it will create flickerings when I do so. Hence it needs to stay at a negative x position area. But I want a way to bring it back. The MoveWindow() function is a bit buggy.
10-19-2005 03:02 PM
Profile E-Mail PM Find Quote Report
Millenium_edition
Veteran Member
*****

Avatar

Posts: 1787
Reputation: 57
Joined: Apr 2003
RE: Manipulating window position given hwnd
GetWindowRect and SetWindowPos?

This post was edited on 10-19-2005 at 03:11 PM by Millenium_edition.
10-19-2005 03:11 PM
Profile E-Mail PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: Manipulating window position given hwnd
quote:
Originally posted by eSouL
I can't use ShowWindow(). I need to PostMessage() to the conversation window so I have to activate the window for a brief moment before returning control to my custom window. If the conversation window is visible on screen, it will create flickerings when I do so. Hence it needs to stay at a negative x position area. But I want a way to bring it back. The MoveWindow() function is a bit buggy.
API's like MoveWindow(), etc aren't buggy at all. They work absolutely perfect. The use of them (aka your own code) is most likely buggy if you experience abnormalities.

Instead of hiding a window you can also minimize it. in general speaking, activating a window, showing/hiding it, restoring/minimizing it are three different independant things.

Also, why do you need PostMessage()? It is quite possible that with another method you do not need the 'PostMessage() approach' at all. Also, in normal circumstances, this API doesn't require you to activate a window, since it send its message to the handle of a window, not to the activate window. But all this depends on what you want do and what your current code is.

But why do you ask how to change the 'Left' coordinate of a window when you first said:
quote:
Originally posted by eSouL
My plugin hides a conversation window (IMessengerConversationWnd object) by changing its 'Left' property to -20000
Don't this mean you already know how to set the 'Left'?...

Finally, to simply change a coordinate you indeed could also use SetWindowPos(), like ME said. But this is in general, it highly depends on your overall code. Because most stuff can be greatly optimized or done in another shorter approach. And many Window API's already contain ways to set coordinates strait away, without using additional API's. So it all strongly depends on your current code to do it in the proper and/or efficient way.

PS: notice that I linked all the API's talked about to the MSDN Library. This should be your number one stop to get info about the API's (not some other website which only provides half the info) ;)

This post was edited on 10-19-2005 at 08:33 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
10-19-2005 08:03 PM
Profile PM Find Quote Report
eSouL
Junior Member
**


Posts: 36
Joined: Oct 2005
O.P. RE: Manipulating window position given hwnd
Thanks for the reply Cookie. After reading them, I tried to rewrite some part of my code and indeed, much to my delight, PostMessage can be sent to a hidden window :D SetWindowPos worked fine too but now that I don't need to change coordinates, I return to the good old ShowWindow function. Thanks again!
10-20-2005 04:03 AM
Profile E-Mail PM Find Quote Report
RaceProUK
Elite Member
*****

Avatar

Posts: 6073
Reputation: 57
39 / Male / Flag
Joined: Oct 2003
RE: Manipulating window position given hwnd
quote:
Originally posted by eSouL
I return to the good old ShowWindow function.
Which is what I suggested before!
quote:
Originally posted by raceprouk
I think a better solution would be to hide the window the proper way, by using ShowWindow() with the HWND.

This post was edited on 10-27-2005 at 12:04 PM by RaceProUK.
[Image: spartaafk.png]
10-27-2005 12:04 PM
Profile PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On