1. Orphaned Popups?

How would I create a Popup menu in Win32Lib with no parent, or the Screen as a
parent? I am
using PatRat's Systray.ew to create a System Tray icon and I want a menu to
popup when the user
clicks the icon.

If I try to create a Popup with no parent, I get a "getHandle() failed" error.
If I try to create a Popup with Screen as a parent, I get a "ClientToScreen
failed" error.

~Greg
g.haberek at comcast.net

new topic     » topic index » view message » categorize

2. Re: Orphaned Popups?

On Sun, 23 Mar 2003 20:13:22 -0500, Greg Haberek <g.haberek at comcast.net> 
wrote:

>
> How would I create a Popup menu in Win32Lib with no parent, or the Screen 
> as a parent? I am
> using PatRat's Systray.ew to create a System Tray icon and I want a menu 
> to popup when the user
> clicks the icon.
>
> If I try to create a Popup with no parent, I get a "getHandle() failed" 
> error.
> If I try to create a Popup with Screen as a parent, I get a 
> "ClientToScreen failed" error.
>

Hi Greg,
a couple of questions first.

What problem is caused by having the Popup menu use a parent?

Have you tried using a non-visible parent?

Now, the reason you need a parent is that win32lib calls the API routine 
"TrackPopupMenu" to manage it. And this routine needs a handle to a window 
so that messages can be passed to something. Your application needs to 
receive WM_NOTIFY etc messages to know which menu item has been clicked.


-- 

cheers,
Derek Parnell

new topic     » goto parent     » topic index » view message » categorize

3. Re: Orphaned Popups?

I want to be able to position the Popup right over the System Tray icon. My
Window will be
hidden. The Popup will only popup relative to its parent window. I've only been
able to get it
to popup over the icon if the window is Maximized, since otherwise the mouse
position will be
past the window's edges.

here's what I've got so far:
maximize the window then click the icon towards the top of the system tray, the
Popup will
appear.

-- begin code --
include win32lib.ew

constant MyIcon = extractIcon( {"shell32.dll",14} ) -- globe icon

constant

    Main = create( Window, "Test", 0, 0.2, 0.2, 320, 240, 0 ),
    SysTray = systray_Create( Main ),
    MyPopup = create( Popup, "", Main, 0, 0, 0, 0, 0 ),
    Exit = create( MenuItem, "E&xit", MyPopup, 0, 0, 0, 0, 0 )

systray_SetIcon( SysTray, MyIcon )
systray_Show( SysTray )

procedure Main_w32HClose( integer self, integer event, sequence params )
    systray_Hide( SysTray )
end procedure
setHandler( {Main}, {w32HClose}, routine_id("Main_w32HClose") )

procedure SysTray_onEvent(integer id, atom msg)
sequence pos

    if msg = LeftDown then
        pos = getMousePos()
        popup( MyPopup, pos[1], pos[2] )
        repaintWindow( Main )
        wPuts( Main, sprintf("Clicked (%d, %d)", pos) )
    end if

end procedure
systray_SetEvent( SysTray, routine_id("SysTray_onEvent") )

WinMain( Main, Normal )

-- end code --

----- Original Message -----
From: Derek Parnell <ddparnell at bigpond.com>
To: EUforum <EUforum at topica.com>
Sent: Sunday, March 23, 2003 9:39 PM
Subject: Re: Orphaned Popups?



On Sun, 23 Mar 2003 20:13:22 -0500, Greg Haberek <g.haberek at comcast.net>
wrote:

>
> How would I create a Popup menu in Win32Lib with no parent, or the Screen
> as a parent? I am
> using PatRat's Systray.ew to create a System Tray icon and I want a menu
> to popup when the user
> clicks the icon.
>
> If I try to create a Popup with no parent, I get a "getHandle() failed"
> error.
> If I try to create a Popup with Screen as a parent, I get a
> "ClientToScreen failed" error.
>

Hi Greg,
a couple of questions first.

What problem is caused by having the Popup menu use a parent?

Have you tried using a non-visible parent?

Now, the reason you need a parent is that win32lib calls the API routine
"TrackPopupMenu" to manage it. And this routine needs a handle to a window
so that messages can be passed to something. Your application needs to
receive WM_NOTIFY etc messages to know which menu item has been clicked.


--

cheers,
Derek Parnell



TOPICA - Start your own email discussion group. FREE!

new topic     » goto parent     » topic index » view message » categorize

4. Re: Orphaned Popups?

On Mon, 24 Mar 2003 00:15:48 -0500, Greg Haberek <g.haberek at comcast.net> 
wrote:

>
> I want to be able to position the Popup right over the System Tray icon. 
> My Window will be
> hidden. The Popup will only popup relative to its parent window. I've 
> only been able to get it
> to popup over the icon if the window is Maximized, since otherwise the 
> mouse position will be
> past the window's edges.
>
> here's what I've got so far:
> maximize the window then click the icon towards the top of the system 
> tray, the Popup will
> appear.
>
> -- begin code --
> include win32lib.ew
>
> constant MyIcon = extractIcon( {"shell32.dll",14} ) -- globe icon
>
> constant
>
> Main = create( Window, "Test", 0, 0.2, 0.2, 320, 240, 0 ),
> SysTray = systray_Create( Main ),
> MyPopup = create( Popup, "", Main, 0, 0, 0, 0, 0 ),
> Exit = create( MenuItem, "E&xit", MyPopup, 0, 0, 0, 0, 0 )
>
> systray_SetIcon( SysTray, MyIcon )
> systray_Show( SysTray )
>
> procedure Main_w32HClose( integer self, integer event, sequence params )
> systray_Hide( SysTray )
> end procedure
> setHandler( {Main}, {w32HClose}, routine_id("Main_w32HClose") )
>
> procedure SysTray_onEvent(integer id, atom msg)
> sequence pos
>
> if msg = LeftDown then
> pos = getMousePos()
> popup( MyPopup, pos[1], pos[2] )
> repaintWindow( Main )
> wPuts( Main, sprintf("Clicked (%d, %d)", pos) )
> end if
>
> end procedure
> systray_SetEvent( SysTray, routine_id("SysTray_onEvent") )
>
> WinMain( Main, Normal )

The getMousePos() [BTW, you ought to call getPointerPos() instead], returns 
the pointer relative to the Screen. Also, the pop() routine displays the 
menu at x,y relative to the screen. So, if you need to see the popup menu, 
and I guess who doesn't, you need to calculate  the x,y for it to be 
visible.  Something like ...

   x = mouse.x - popmenu.width + 1
   y = mouse.y - popmenu.height + 1

-- 

cheers,
Derek Parnell

new topic     » goto parent     » topic index » view message » categorize

5. Re: Orphaned Popups?

Hi Greg,
    Try this modified systray_event routine, i'm sure it'll work.

 procedure SysTray_onEvent(integer id, atom msg)
 sequence pos
 
     if msg = LeftDown then
          -- Changes start here
         pos = getPointerPos()
         pos = ClientToScreen(Main,pos[1],pos[2])
         -- Changes end here
         popup( MyPopup, pos[1], pos[2] )
         repaintWindow( Main )
         wPuts( Main, sprintf("Clicked (%d, %d)", pos) )
     end if
 
 end procedure

Best Regards,
    Guillermo Bonvehi
    AKA: KNiXEUR - Caballero Rojo

--- Greg Haberek <g.haberek at comcast.net> wrote:
> 
> I want to be able to position the Popup right over the System Tray
> icon. My Window will be
> hidden. The Popup will only popup relative to its parent window. I've
> only been able to get it
> to popup over the icon if the window is Maximized, since otherwise
> the mouse position will be
> past the window's edges.
> 
<SNIP>

new topic     » goto parent     » topic index » view message » categorize

6. Re: Orphaned Popups?

----- Original Message -----
From: <pampeano at rocketmail.com>
To: "EUforum" <EUforum at topica.com>
Subject: Re: Orphaned Popups?


>
> Hi Greg,
>     Try this modified systray_event routine, i'm sure it'll work.
>
>  procedure SysTray_onEvent(integer id, atom msg)
>  sequence pos
>
>      if msg = LeftDown then
>           -- Changes start here
>          pos = getPointerPos()
>          pos = ClientToScreen(Main,pos[1],pos[2])
>          -- Changes end here
>          popup( MyPopup, pos[1], pos[2] )
>          repaintWindow( Main )
>          wPuts( Main, sprintf("Clicked (%d, %d)", pos) )
>      end if
>
>  end procedure
>
> Best Regards,
>     Guillermo Bonvehi
>     AKA: KNiXEUR - Caballero Rojo


Not really. The getPointerPos() already returns the pointer position
relative to the screen. I suggest that he needs to call the GetMenuRect API
call to find the dimensions of the popup menu, then calculate the top-left
corner screen position of the menu based on that.

----------------
cheers,
Derek Parnell

new topic     » goto parent     » topic index » view message » categorize

7. Re: Orphaned Popups?

Well Derek, i don't want to think right now (I haven't been programming
for a loong time), but it works (i've a program working that way) :)

Best Regards,
     Guillermo Bonvehi

--- Derek Parnell <ddparnell at bigpond.com> wrote:
> 
> Not really. The getPointerPos() already returns the pointer position
> relative to the screen. I suggest that he needs to call the
> GetMenuRect API
> call to find the dimensions of the popup menu, then calculate the
> top-left
> corner screen position of the menu based on that.
> 
> ----------------
> cheers,
> Derek Parnell

new topic     » goto parent     » topic index » view message » categorize

8. Re: Orphaned Popups?

I couldn't find anything on GetMenuRect in the API, where is it? I found
GetMenuItemRect, could
I use that and add up the MenuItem sizes?

----- Original Message -----
From: Derek Parnell <ddparnell at bigpond.com>
Subject: Re: Orphaned Popups?



----- Original Message -----
From: <pampeano at rocketmail.com>
To: "EUforum" <EUforum at topica.com>
Sent: Monday, March 24, 2003 10:33 PM
Subject: Re: Orphaned Popups?


>
> Hi Greg,
>     Try this modified systray_event routine, i'm sure it'll work.
>
>  procedure SysTray_onEvent(integer id, atom msg)
>  sequence pos
>
>      if msg = LeftDown then
>           -- Changes start here
>          pos = getPointerPos()
>          pos = ClientToScreen(Main,pos[1],pos[2])
>          -- Changes end here
>          popup( MyPopup, pos[1], pos[2] )
>          repaintWindow( Main )
>          wPuts( Main, sprintf("Clicked (%d, %d)", pos) )
>      end if
>
>  end procedure
>
> Best Regards,
>     Guillermo Bonvehi
>     AKA: KNiXEUR - Caballero Rojo


Not really. The getPointerPos() already returns the pointer position
relative to the screen. I suggest that he needs to call the GetMenuRect API
call to find the dimensions of the popup menu, then calculate the top-left
corner screen position of the menu based on that.

----------------
cheers,
Derek Parnell



TOPICA - Start your own email discussion group. FREE!

new topic     » goto parent     » topic index » view message » categorize

9. Re: Orphaned Popups?

----- Original Message -----
From: "Derek Parnell" <ddparnell at bigpond.com>
To: "EUforum" <EUforum at topica.com>
Subject: Re: Orphaned Popups?


>
> ----- Original Message -----
> From: <pampeano at rocketmail.com>
> To: "EUforum" <EUforum at topica.com>
> Subject: Re: Orphaned Popups?
>
>
> > Hi Greg,
> >     Try this modified systray_event routine, i'm sure it'll work.
> >
> >  procedure SysTray_onEvent(integer id, atom msg)
> >  sequence pos
> >
> >      if msg = LeftDown then
> >           -- Changes start here
> >          pos = getPointerPos()
> >          pos = ClientToScreen(Main,pos[1],pos[2])
> >          -- Changes end here
> >          popup( MyPopup, pos[1], pos[2] )
> >          repaintWindow( Main )
> >          wPuts( Main, sprintf("Clicked (%d, %d)", pos) )
> >      end if
> >
> >  end procedure
> >
> > Best Regards,
> >     Guillermo Bonvehi
> >     AKA: KNiXEUR - Caballero Rojo
>
>
> Not really. The getPointerPos() already returns the pointer position
> relative to the screen. I suggest that he needs to call the GetMenuRect
API
> call to find the dimensions of the popup menu, then calculate the top-left
> corner screen position of the menu based on that.
>
> ----------------
> cheers,
> Derek Parnell

Hi Derek,
     Guillermo Bonvehi's method works. I would suggest to people to get in
the habit of using
TrackPopupMenuEx Function. The reason i say this is because of the TPMPARAMS
structure which you can fill in and have your popup menu correctly
displayed(clipped) to the screen.

I HTH.......

----------------------------------------------------------------------------
----

The TrackPopupMenuEx function displays a shortcut menu at the specified
location and tracks the selection of items on the shortcut menu. The
shortcut menu can appear anywhere on the screen.

Syntax

BOOL TrackPopupMenuEx(          HMENU hmenu,
    UINT fuFlags,
    int x,
    int y,
    HWND hwnd,
    LPTPMPARAMS lptpm
);

TPMPARAMS Structure

----------------------------------------------------------------------------
----

The TPMPARAMS structure contains extended parameters for the
TrackPopupMenuEx function.

Syntax

typedef struct tagTPMPARAMS {
  UINT cbSize;
  RECT rcExclude;
} TPMPARAMS, *LPTPMPARAMS;
Members

cbSize
Size of structure, in bytes.
rcExclude
Rectangle to exclude when positioning the window, in screen coordinates.
Structure Information

Header Declared in Winuser.h, include Windows.h
Minimum operating systems Windows 95, Windows NT 3.1


-----------------
Jordah
>
>


>
>
> TOPICA - Start your own email discussion group. FREE!
>
>

new topic     » goto parent     » topic index » view message » categorize

10. Re: Orphaned Popups?

Thanks Jordah! TrackPopupMenuEx works, but.... The Popup menu doesn't disappear
right away if I
click off of it. Rather, it seems to 'time out' after 2 or 3 seconds... Is there
any way I can
speed this up? Or force it to close?

----- Original Message -----
From: <jordah at btopenworld.com>
Subject: Re: Orphaned Popups?




----- Original Message -----
From: "Derek Parnell" <ddparnell at bigpond.com>
To: "EUforum" <EUforum at topica.com>
Sent: Monday, March 24, 2003 11:52 AM
Subject: Re: Orphaned Popups?


>
> ----- Original Message -----
> From: <pampeano at rocketmail.com>
> To: "EUforum" <EUforum at topica.com>
> Sent: Monday, March 24, 2003 10:33 PM
> Subject: Re: Orphaned Popups?
>
>
> > Hi Greg,
> >     Try this modified systray_event routine, i'm sure it'll work.
> >
> >  procedure SysTray_onEvent(integer id, atom msg)
> >  sequence pos
> >
> >      if msg = LeftDown then
> >           -- Changes start here
> >          pos = getPointerPos()
> >          pos = ClientToScreen(Main,pos[1],pos[2])
> >          -- Changes end here
> >          popup( MyPopup, pos[1], pos[2] )
> >          repaintWindow( Main )
> >          wPuts( Main, sprintf("Clicked (%d, %d)", pos) )
> >      end if
> >
> >  end procedure
> >
> > Best Regards,
> >     Guillermo Bonvehi
> >     AKA: KNiXEUR - Caballero Rojo
>
>
> Not really. The getPointerPos() already returns the pointer position
> relative to the screen. I suggest that he needs to call the GetMenuRect
API
> call to find the dimensions of the popup menu, then calculate the top-left
> corner screen position of the menu based on that.
>
> ----------------
> cheers,
> Derek Parnell

Hi Derek,
     Guillermo Bonvehi's method works. I would suggest to people to get in
the habit of using
TrackPopupMenuEx Function. The reason i say this is because of the TPMPARAMS
structure which you can fill in and have your popup menu correctly
displayed(clipped) to the screen.

I HTH.......

----------------------------------------------------------------------------
----

The TrackPopupMenuEx function displays a shortcut menu at the specified
location and tracks the selection of items on the shortcut menu. The
shortcut menu can appear anywhere on the screen.

Syntax

BOOL TrackPopupMenuEx(          HMENU hmenu,
    UINT fuFlags,
    int x,
    int y,
    HWND hwnd,
    LPTPMPARAMS lptpm
);

TPMPARAMS Structure

----------------------------------------------------------------------------
----

The TPMPARAMS structure contains extended parameters for the
TrackPopupMenuEx function.

Syntax

typedef struct tagTPMPARAMS {
  UINT cbSize;
  RECT rcExclude;
} TPMPARAMS, *LPTPMPARAMS;
Members

cbSize
Size of structure, in bytes.
rcExclude
Rectangle to exclude when positioning the window, in screen coordinates.
Structure Information

Header Declared in Winuser.h, include Windows.h
Minimum operating systems Windows 95, Windows NT 3.1


-----------------
Jordah
>
>


>
>
> TOPICA - Start your own email discussion group. FREE!
>
>



TOPICA - Start your own email discussion group. FREE!

new topic     » goto parent     » topic index » view message » categorize

11. Re: Orphaned Popups?

Hi Greg,
     I'm sorry, i don't get what you mean exactly. To help me and you, could
you post a demo exposing what you mean then i'll see if i can get its
work-around. I don't think that is a bug. There are a few funny things i
experience with the task bar system tray, in that it takes long to respond
when you close you're program. The icon lasts 2-3 seconds before
disappearing. I think the work-around should be a explicit refresh of the
System Tray.

Anyway, send you demo and we fist on it. :)

Jordah.
----- Original Message -----
From: "Greg Haberek" <g.haberek at comcast.net>
To: "EUforum" <EUforum at topica.com>
Sent: Tuesday, March 25, 2003 5:19 AM
Subject: Re: Orphaned Popups?


>
> Thanks Jordah! TrackPopupMenuEx works, but.... The Popup menu doesn't
disappear right away if I
> click off of it. Rather, it seems to 'time out' after 2 or 3 seconds... Is
there any way I can
> speed this up? Or force it to close?
>
> ----- Original Message -----
> From: <jordah at btopenworld.com>
> To: EUforum <EUforum at topica.com>
> Sent: Monday, March 24, 2003 3:35 PM
> Subject: Re: Orphaned Popups?
>
>
> ----- Original Message -----
> From: "Derek Parnell" <ddparnell at bigpond.com>
> To: "EUforum" <EUforum at topica.com>
> Sent: Monday, March 24, 2003 11:52 AM
> Subject: Re: Orphaned Popups?
>
>
> > ----- Original Message -----
> > From: <pampeano at rocketmail.com>
> > To: "EUforum" <EUforum at topica.com>
> > Sent: Monday, March 24, 2003 10:33 PM
> > Subject: Re: Orphaned Popups?
> >
> >
> > > Hi Greg,
> > >     Try this modified systray_event routine, i'm sure it'll work.
> > >
> > >  procedure SysTray_onEvent(integer id, atom msg)
> > >  sequence pos
> > >
> > >      if msg = LeftDown then
> > >           -- Changes start here
> > >          pos = getPointerPos()
> > >          pos = ClientToScreen(Main,pos[1],pos[2])
> > >          -- Changes end here
> > >          popup( MyPopup, pos[1], pos[2] )
> > >          repaintWindow( Main )
> > >          wPuts( Main, sprintf("Clicked (%d, %d)", pos) )
> > >      end if
> > >
> > >  end procedure
> > >
> > > Best Regards,
> > >     Guillermo Bonvehi
> > >     AKA: KNiXEUR - Caballero Rojo
> >
> >
> > Not really. The getPointerPos() already returns the pointer position
> > relative to the screen. I suggest that he needs to call the GetMenuRect
> API
> > call to find the dimensions of the popup menu, then calculate the
top-left
> > corner screen position of the menu based on that.
> >
> > ----------------
> > cheers,
> > Derek Parnell
>
> Hi Derek,
>      Guillermo Bonvehi's method works. I would suggest to people to get in
> the habit of using
> TrackPopupMenuEx Function. The reason i say this is because of the
TPMPARAMS
> structure which you can fill in and have your popup menu correctly
> displayed(clipped) to the screen.
>
> I HTH.......
>
> --------------------------------------------------------------------------
--
> ----
>
> The TrackPopupMenuEx function displays a shortcut menu at the specified
> location and tracks the selection of items on the shortcut menu. The
> shortcut menu can appear anywhere on the screen.
>
> Syntax
>
> BOOL TrackPopupMenuEx(          HMENU hmenu,
>     UINT fuFlags,
>     int x,
>     int y,
>     HWND hwnd,
>     LPTPMPARAMS lptpm
> );
>
> TPMPARAMS Structure
>
> --------------------------------------------------------------------------
--
> ----
>
> The TPMPARAMS structure contains extended parameters for the
> TrackPopupMenuEx function.
>
> Syntax
>
> typedef struct tagTPMPARAMS {
>   UINT cbSize;
>   RECT rcExclude;
> } TPMPARAMS, *LPTPMPARAMS;
> Members
>
> cbSize
> Size of structure, in bytes.
> rcExclude
> Rectangle to exclude when positioning the window, in screen coordinates.
> Structure Information
>
> Header Declared in Winuser.h, include Windows.h
> Minimum operating systems Windows 95, Windows NT 3.1
>
>
> -----------------
> Jordah
> >
> >
> > TOPICA - Start your own email discussion group. FREE!
> >
> >
> TOPICA - Start your own email discussion group. FREE!
>
>
>
> TOPICA - Start your own email discussion group. FREE!
>
>

new topic     » goto parent     » topic index » view message » categorize

12. Re: Orphaned Popups?

> There are a few funny things i
> experience with the task bar system tray, in that it takes long to respond
> when you close you're program. The icon lasts 2-3 seconds before
> disappearing. I think the work-around should be a explicit refresh of the
> System Tray.

Assuming you have a current NOTIFYICON structure;
...just call Shell_NotifyIconA() with the NIM_DELETE parameter,
to get rid of the icon asap..

Sysinfo2.exw, out of my 'tuts', is an example.

new topic     » goto parent     » topic index » view message » categorize

13. Re: Orphaned Popups?

This is a multi-part message in MIME format.

--Boundary_(ID_fSeNRMlwyesaDD5b5zLjMw)

Perhaps I was misunderstood. The Icon disappears fine when I delete it. It's the
*Popup* menu
that won't disappear! It stays visable and *clickable* even when I click
somewhere else. Also,
the Popup menu won't appear on the first click, I have to click the Icon at
least 2 times to get
it to show.

Maybe it's my machine, I dunno. Anyway, see if you get the same problem. I think
I may be using
TrackPopupMenuEx wrong, perhaps I need to use some flags?

This example requires Systray.ew, which I have attached in a zip file.

-- begin code --
include win32lib.ew
include systray.ew

global constant
    -- flags for TrackPopupMenuEx
    TPM_LEFTBUTTON   = #0000,
    TPM_RIGHTBUTTON   = #0002,
    TPM_LEFTALIGN   = #0000,
    TPM_CENTERALIGN   = #0004,
    TPM_RIGHTALIGN   = #0008,
    TPM_TOPALIGN   = #0000,
    TPM_VCENTERALIGN  = #0010,
    TPM_BOTTOMALIGN   = #0020,
    TPM_HORIZONTAL   = #0000,  -- Horz alignment matters more
    TPM_VERTICAL   = #0040,  -- Vert alignment matters more
    TPM_NONOTIFY   = #0080,  -- Don't send any notification msgs
    TPM_RETURNCMD   = #0100,
    TPM_RECURSE    = #0001,
    TPM_HORPOSANIMATION  = #0400,
    TPM_HORNEGANIMATION  = #0800,
    TPM_VERPOSANIMATION  = #1000,
    TPM_VERNEGANIMATION  = #2000,
    TPM_NOANIMATION   = #4000

constant user32 = open_dll("user32.dll")
constant xTrackPopupMenuEx =
        define_c_func( user32, "TrackPopupMenuEx",
        {C_LONG, C_LONG, C_LONG, C_LONG, C_LONG, C_LONG}, C_LONG )

global function TrackPopupMenuEx(integer menu, atom flags, integer x, integer y,
integer parent,
atom struct)
atom hMenu, hWnd

    hMenu = getHandle(menu)
    hWnd = getHandle(parent)

    return c_func(xTrackPopupMenuEx, {hMenu, flags, x, y, hWnd, struct})
end function

constant

    GlobeIcon = extractIcon( {"shell32.dll",14} ),

    Main = create( Window, "Test", 0, 0.2, 0.2, 320, 240, 0 ),
    SysTray = systray_Create( Main ),
    MyPopup = create( Popup, "", Main, 0, 0, 0, 0, 0 ),
    Exit = create( MenuItem, "E&xit", MyPopup, 0, 0, 0, 0, 0 )

systray_SetIcon( SysTray, GlobeIcon )
systray_Show( SysTray )

procedure Main_w32HClose( integer self, integer event, sequence params )
    systray_Hide( SysTray )
end procedure
setHandler( {Main}, {w32HClose}, routine_id("Main_w32HClose") )

procedure SysTray_onEvent(integer id, atom msg)
sequence pos
integer ret

    if msg = LeftDown then
        pos = getPointerPos()
        ret = TrackPopupMenuEx( MyPopup, 0, pos[1], pos[2], Main, 0 )
        repaintWindow( Main )
        wPuts( Main, sprintf("Clicked: (%d, %d)", pos) )
    end if

end procedure
systray_SetEvent( SysTray, routine_id("SysTray_onEvent") )

procedure Exit_w32HClick( integer self, integer event, sequence params )
    closeWindow( Main )
end procedure
setHandler( {Exit}, {w32HClick}, routine_id("Exit_w32HClick") )

WinMain( Main, Normal )
-- end code --

----- Original Message -----
From: Wolf <wolfritz at KING.IGS.NET>
To: EUforum <EUforum at topica.com>
Sent: Tuesday, March 25, 2003 12:53 PM
Subject: Re: Orphaned Popups?



> There are a few funny things i
> experience with the task bar system tray, in that it takes long to respond
> when you close you're program. The icon lasts 2-3 seconds before
> disappearing. I think the work-around should be a explicit refresh of the
> System Tray.

Assuming you have a current NOTIFYICON structure;
...just call Shell_NotifyIconA() with the NIM_DELETE parameter,
to get rid of the icon asap..

Sysinfo2.exw, out of my 'tuts', is an example.



TOPICA - Start your own email discussion group. FREE!


--Boundary_(ID_fSeNRMlwyesaDD5b5zLjMw)
Content-type: application/x-zip-compressed; name=systray.zip

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu