What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Focusing a window

Focusing a window
Author: Message:
MeEtc
Patchou's look-alike
*****

Avatar
In the Shadow Gallery once again

Posts: 2200
Reputation: 60
38 / Male / Flag
Joined: Nov 2004
Status: Away
O.P. Focusing a window
I'm trying to set a opened window to be focused if the user tries to open a second window instead, so that only one window can be open at the same time. The problem I'm having, is that the variable I'm trying to work with doesn't appear to be a PlusWnd object, but I'm sure it is.

In one block of code, a window is created:
code:
openwnd = MsgPlus.CreateWnd("yass_gui.xml","WndConfig");
openwnd is a global variable.

Now, when this window is open and another is attempted to be opened...
code:
function OnEvent_MenuClicked(ControlId, Location, OriginWnd){
   switch(ControlId){
      case "settings":
         if(openwnd != undefined){
            Debug.Trace(typeof(openwnd));
            Debug.Trace(openwnd.Handle);
            Interop.Call('User32', 'SetForegroundWindow', openwnd.Handle);
            return;
         }
// more code ...
When this runs, I get:
code:
object
Error: unknown (code: -2147418113)
       File: yass_menu.js. Line: 24.
Function OnEvent_MenuClicked returned an error. Code: -2147352567
Line 24 is the second Debug statement.

So, whats going on with the openwnd variable? And how to I set focus to it?
[Image: signature/]     [Image: sharing.png]
I cannot hear you. There is a banana in my ear.
03-14-2008 10:09 PM
Profile PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Focusing a window - by MeEtc on 03-14-2008 at 10:09 PM
RE: Focusing a window - by vikke on 03-14-2008 at 10:24 PM
RE: Focusing a window - by MeEtc on 03-14-2008 at 10:30 PM
RE: RE: Focusing a window - by vikke on 03-14-2008 at 11:13 PM
RE: Focusing a window - by Spunky on 03-14-2008 at 10:58 PM
RE: Focusing a window - by MeEtc on 03-14-2008 at 10:59 PM


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