TrayBallon for Fivewin

TrayBallon for Fivewin

Postby Jimmy » Tue Feb 21, 2023 6:33 am

hi,

i have look into Sample c:\fwh\samples\testtray.prg which use CLASS TTrayIcon()
but it "just" show how to use Icon in TaskTray
https://learn.microsoft.com/en-us/windows/win32/api/shellapi/nf-shellapi-shell_notifyicona

this what CLASS TTrayIcon() use
Code: Select all  Expand view
 ::lSuccess = Shell_NotifyIcon( If( lAdd, NIM_ADD, NIM_MODIFY ), @c )

but Shell_NotifyIcon() can have "more" Parameter than Microsoft say
Image
TrayBallon will "fly-out" like Windows Message
you can change Icon and use Resource or from Disk

have a look at HB_FUNC ( SHOWNOTIFYINFO ) in Demo CODE
Code: Select all  Expand view
#include "Fivewin.ch"
PROCEDURE MAIN
   MsgBalloon("Hello Fivewin-Forum","Tip from Jimmy")
RETURN

Function MsgBalloon( cMessage, cTitle )
   // NEED before
   ShowNotifyInfo( 0, .F. , NIL, NIL, NIL, NIL )

   // this all work
   ShowNotifyInfo( 0, .T. , Nil, Nil, cMessage, cTitle )

   // Resource "Number" or "Name"
   //  ShowNotifyInfo( 0, .T. , 10002   , "large Text not working", cMessage, cTitle )
   //  ShowNotifyInfo( 0, .T. ,"A2MAIN" , "large Text not working", cMessage, cTitle )

   // load from Disk
   //  ShowNotifyInfo( 0, .T. , ".\RES\BOLOR.ICO" , "large Text  not working", cMessage, cTitle )

Return Nil

#pragma BEGINDUMP

#include <windows.h>
#include "hbapi.h"

static void ShowNotifyInfo(HWND hWnd, BOOL bAdd, HICON hIcon, LPSTR szText, LPSTR szInfo, LPSTR szInfoTitle);

HB_FUNC ( SHOWNOTIFYINFO )
{
   #ifndef _WIN64
      HWND hWnd = ( HWND ) hb_parnl( 1 );
   #else
      HWND hWnd = ( HWND ) hb_parnll( 1 );
   #endif

   HICON hIcon;
   if ( HB_ISNUM( 3 ) )
   {
      hIcon = LoadIcon( ( HINSTANCE ) GetModuleHandle (NULL), MAKEINTRESOURCE( hb_parni( 3 ) ) );
   }
   else
   {
      hIcon = ( HICON ) LoadImage( ( HINSTANCE ) NULL, hb_parc( 3 ), IMAGE_ICON, 0, 0, LR_LOADFROMFILE );
   }


   ShowNotifyInfo( (HWND) hWnd, (BOOL) hb_parl(2), hIcon , (LPSTR) hb_parc(4), (LPSTR) hb_parc(5), (LPSTR) hb_parc(6) );

}

static void ShowNotifyInfo(HWND hWnd, BOOL bAdd, HICON hIcon, LPSTR szText, LPSTR szInfo, LPSTR szInfoTitle)
{
    NOTIFYICONDATA nid;

    ZeroMemory( &nid, sizeof(nid) );

    nid.cbSize        = sizeof(NOTIFYICONDATA);
    nid.hIcon         = hIcon;
    nid.hWnd         = hWnd;
    nid.uID            = 0;
    nid.uFlags        = NIF_INFO | NIF_TIP | NIF_ICON ;
    nid.dwInfoFlags   = NIIF_INFO ;

    lstrcpy( nid.szTip, TEXT(szText) );
    lstrcpy( nid.szInfo, TEXT(szInfo) );
    lstrcpy( nid.szInfoTitle, TEXT(szInfoTitle) );

    if(bAdd)
        Shell_NotifyIcon( NIM_ADD, &nid );
    else
        Shell_NotifyIcon( NIM_DELETE, &nid );

    if(hIcon)
        DestroyIcon( hIcon );
}

#pragma ENDDUMP
 
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: TrayBallon for Fivewin

Postby Jimmy » Tue Feb 21, 2023 8:02 am

hi,

i have to say sorry while that CODE seems only run under 32 Bit "right"

under 64 Bit it does not "fly-out" :(
but are in Info-"List" and Tray-Icon show "filled"

i have to figure out why it does not react like i want under 64 Bit
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: TrayBallon for Fivewin

Postby Silvio.Falconi » Tue Feb 21, 2023 11:54 am

toast was created because it seems that the ShowNotifyInfo() function
in Windows Seven it didn't work
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: TrayBallon for Fivewin

Postby Silvio.Falconi » Tue Feb 21, 2023 11:58 am

Jimmy wrote:hi,

i have to say sorry while that CODE seems only run under 32 Bit "right"

under 64 Bit it does not "fly-out" :(
but are in Info-"List" and Tray-Icon show "filled"

i have to figure out why it does not react like i want under 64 Bit


How we can to modify the colors and erase the name of hwnd ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7061
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 100 guests