henry100 has asked for the wisdom of the Perl Monks concerning the following question:

I want to add My perl programs(exe) to status area .
Does anyone know how to do it via Win32::API?

THX a lot......

###my perlscript is following #####. my $myapi = new Win32::API("shell32", "Shell_NotifyIcon", ['P', 'P'], +'N') or die Win32::FormatMessage(Win32::GetLastError()); ###Following is from MSDN #######. typedef struct _NOTIFYICONDATA { DWORD cbSize; HWND hWnd; UINT uID; UINT uFlags; UINT uCallbackMessage; HICON hIcon; TCHAR szTip[64]; DWORD dwState; //Version 5.0 DWORD dwStateMask; //Version 5.0 TCHAR szInfo[256]; //Version 5.0 union { UINT uTimeout; //Version 5.0 UINT uVersion; //Version 5.0 } DUMMYUNIONNAME; TCHAR szInfoTitle[64]; //Version 5.0 DWORD dwInfoFlags; //Version 5.0 } NOTIFYICONDATA, *PNOTIFYICONDATA;

how to set structure and the cbSize .....nid.cbSize = sizeof(NOTIFYICONDATA)

Edit kudra, 2001-08-20 Added code tags

Replies are listed 'Best First'.
Re: How to add icon to status area via Win32::API?
by jplindstrom (Monsignor) on Aug 19, 2001 at 18:08 UTC
    I assume you want to add your program to the system tray (the small icons to the right in the task bar), is that right?

    In that case, download Win32::GUI and look at Win32::GUI::NotifyIcon.

    If what you really want is for your program to show up in the regular task bar, create a Win32::GUI window without a parent window, that will make it appear in the task bar.

    http://sourceforge.net/projects/perl-win32-gui

    /J

      That's right. I understand Win32::GUI is work. But I use TK. So, it seems I need to use API? Right? But ,THX
        Not neccessarily. Since what you want to implement using Win32::API (with great difficulty I guess) is already present in Win32::GUI, why not use it? The only downside I can see is the overhead.

        It is most likely possible to combine the main event loop in Tk with the one in Win32::GUI; Just call Win32::GUI::DoEvents() as often as possible from within Tk's idle event loop (whatever it is called, I don't know Tk that well).

        /J