1. SysTray integration

Content-type: text/plain; charset=us-ascii
Content-Disposition: inline



Hi everyone,

I've been playing around with Euphoria for a while now, and have a
few Win32 projects underway, using David Cuny's win32lib.

My experience of Windows programming is limited, however I have begun
to look at Bernard Ryan's WIN32API.EW library as well.

My question is regarding the use of the Shell_NotifyIcon function
and the UWM_SYSTRAY Windows constant.  This constant is not defined
in the WIN32API.EW file, and the Borland Win32 help file does not seem
to have it either.  The C example I was working from is attached.
(See attached file: tray42.C)
Is this the correct method for integrating with the System Tray, and if
so, what is the correct value of UWM_SYSTRAY?

All help is greatly appreciated, and hopefully I should have some
small applications ready soon.

Regards,

Dave

--
David M Foulds                     | e: dmfoulds at knowledgeassociates.com
Applications Developer             | t: +44 (0) 1223 421834
Knowledge Associates International | f: +44 (0) 1223 421284
http://www.knowledgeassociates.com |

Content-type: application/octet-stream;
        name="tray42.C"

new topic     » topic index » view message » categorize

2. Re: SysTray integration

DAVID:
  After include the windows library you would added the following:

  constant UWM_SYSTRAY = WM_USER + 1

  constant UM_TOOLTIPS = 10

  The UWM_SYSTRAY is a USER defined Windows Message called SYSTRAY
  and the #define in the "C" code defines this as being equal to
  the WM_USER + 1 ( WM_USER is defined in the library ).

  In other words you the programmer defines this message and is not
  defined by windows.

  also UM_TOOLTIPS is a User Message called TOOLTIPS

  That is why they are not defined in the library

Bernie

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

3. Re: SysTray integration

Hi all,

I too have been looking into Shell_NotifyIcon, etc. and was surprised not to
see any sort of wrapper available for Eu.  (In addition to tray42.c, I
stumbled upon ntray ~ see http://indigo.ie/~pjn ~ an MFC wrapper class that
seems robust).  This got me thinking, am I out on a limb here using Euphoria
for a "tool" window service considering the overhead of the interpreter...?
Can't be any worse than using MFC, right?  But seriously, how would I go
about limiting the memory usage and task priority of such an Eu app -- is
this something that should be left to C?

Best Regards,
Wes


-----Original Message-----
From: Euphoria Programming for MS-DOS
[mailto:EUPHORIA at LISTSERV.MUOHIO.EDU]On Behalf Of David Foulds
Sent: Monday, October 18, 1999 1:28 PM
To: EUPHORIA at LISTSERV.MUOHIO.EDU
Subject: SysTray integration




Hi everyone,

I've been playing around with Euphoria for a while now, and have a
few Win32 projects underway, using David Cuny's win32lib.

My experience of Windows programming is limited, however I have begun
to look at Bernard Ryan's WIN32API.EW library as well.

My question is regarding the use of the Shell_NotifyIcon function
and the UWM_SYSTRAY Windows constant.  This constant is not defined
in the WIN32API.EW file, and the Borland Win32 help file does not seem
to have it either.  The C example I was working from is attached.
(See attached file: tray42.C)
Is this the correct method for integrating with the System Tray, and if
so, what is the correct value of UWM_SYSTRAY?

All help is greatly appreciated, and hopefully I should have some
small applications ready soon.

Regards,

Dave

--
David M Foulds                     | e: dmfoulds at knowledgeassociates.com
Applications Developer             | t: +44 (0) 1223 421834
Knowledge Associates International | f: +44 (0) 1223 421284
http://www.knowledgeassociates.com |

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

4. Re: SysTray integration

Hi Bernie,

Yes, I just thought this morning that the U in UWM_SYSTRAY might mean it
was a user-defined constant.  I should read the examples I work from
more closely in future 8-)

I do have a follow-on Windows question though.  The test app (based on
your DEMO1API.EXW file) no longer has syntax errors, but when I run it I
get the following error:

    Can not store the value of 5851040 into a Structure at offset 7
    Value not within limits of the C_CHAR type

I suspect that this is referring to the way I am setting the tooltip in
the NOTIFYICONDATA structure.

The C example uses this to set the tooltip in the structure:
    char *tooltip= "SysTray Test";
    strcpy(nid.szTip, tooltip);

The Euphoria code I'm using includes:
    atom szTip
    szTip = allocate_string("SysTray Test")
    ...
    Nid = DeclareStructure("NOTIFYICONDATA",{})
    ...
    StoreIn(Nid, 7, szTip)

Obviously this is wrong, but after reading the 'C Structures' section of
the 'Platform-Specific Issues for Euphoria' document, I am still non the
wiser.  Thanks for any help.

Regards,

Dave

--
David M Foulds                     | e: dmfoulds at knowledgeassociates.com
Applications Developer             | t: +44 (0) 1223 421834
Knowledge Associates International | f: +44 (0) 1223 421284
http://www.knowledgeassociates.com |

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

5. Re: SysTray integration

>The C example uses this to set the tooltip in the structure:
>    char *tooltip= "SysTray Test";
>    strcpy(nid.szTip, tooltip);
>
>The Euphoria code I'm using includes:
>    atom szTip
>    szTip = allocate_string("SysTray Test")
>    ...
>    Nid = DeclareStructure("NOTIFYICONDATA",{})
>    ...
>    StoreIn(Nid, 7, szTip)

Dave:

    First notice that the "C" code uses ( strcpy(nid.szTip, tooltip); )
    That is because nid szTip is a 64 char array not a szPOINTER
    So you have to do the following"

    sequence MyszTip

    -- NOTE: not a null terminated because the szTip array
    --  is already filled with zeros. You can not store a 0 value
    --  ( only a "0" ) in a character location unless you poke it
    --  directly into the structure.
    MyszTip = "SysTray Test"

    for i = 0 to length(MyszTip)-1 do
      StoreIn(Nid, 7+i, MyszTip[i+1])
    end for

    The szTip in the NOTIFYICONDATA structure is an array of 64 characters
    yet in some the documentaion they call it a pointer. But in your "C"
    example it uses the strcpy which indicates to me that my structure is
    correct in using aa array.

    There is more than one version this structure.
    The one in my library is version 4

    PS just a reminder to remember any structure that is not defined
     in the library can always be defined with DeclareCustomStructure.

Bernie

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

Search



Quick Links

User menu

Not signed in.

Misc Menu