SysTray Balloon Message

548 views
Skip to first unread message

Yakano

unread,
Nov 9, 2021, 1:21:54 PM11/9/21
to Harbour Users
Hi everyone In my application, there is an option to add reminders at a certain time of a date. When that time is reached, I display a message in the systray using NirCmd [https://www.nirsoft.net/utils/nircmd.html] with the command <Start NirCmd.exe trayballoon "Text_to_Alert" "Icon.ico" 10000>. Well that works and it is not urgent, but (just curious) does anyone know if this can be achieved from Harbour without using third party apps ??? Thanks

pcordonet

unread,
Nov 10, 2021, 6:36:50 AM11/10/21
to Harbour Users
Hi, Yakano

This code works!!!


*--------------------------------------------------------* 
Function MsgBalloon( cMessage, cTitle ) 

ShowNotifyInfo( 0, .F. , NIL, NIL, NIL, NIL ) 
ShowNotifyInfo( 0, .T. , Nil, Nil, cMessage, cTitle ) 

Return Nil 

#pragma BEGINDUMP 
#define _WIN32_IE      0x0500 
#define HB_OS_WIN_32_USED 
#define _WIN32_WINNT 0x0400 
#define HB_OS_WIN_32_USED 
#define _WIN32_WINNT 0x0400 
#include <windows.h> 
#include <commctrl.h> 
#include <shlobj.h> 
#include "hbapi.h" 
#include "hbvm.h" 
#include "hbstack.h" 
#include "hbapiitm.h" 
#define HDIB HANDLE 
//#include <windows.h>
//#include <winbase.h>

#include "hbapiitm.h" 
//#include "hbset.h" 
//#include "hbapierr.h" 
extern HANDLE  hb_hInstance;
static void ShowNotifyInfo(HWND hWnd, BOOL bAdd, HICON hIcon, LPSTR szText, LPSTR szInfo, LPSTR szInfoTitle); 
HB_FUNC ( SHOWNOTIFYINFO ) 
HICON hIcon;
if ( ISNUM( 3 ) )
{
hIcon = LoadIcon( ( HINSTANCE ) hb_hInstance, MAKEINTRESOURCE( hb_parni( 3 ) ) );
}
else
{
hIcon = ( HICON ) LoadImage( ( HINSTANCE ) NULL, hb_parc( 3 ), IMAGE_ICON, 0, 0, LR_LOADFROMFILE );
}
   ShowNotifyInfo( (HWND) hb_parnl(1), (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 

This 
El dia dimarts, 9 de novembre de 2021 a les 19:21:54 UTC+1, Yakano va escriure:

Yakano

unread,
Nov 10, 2021, 12:00:50 PM11/10/21
to Harbour Users
Hello pcordonet Thanks for your quick response and for the code. Unfortunately, I'm pretty rusty and I can't link your code correctly. When linking I get this ... [...]
hbmk2: Enlazando... KK.exe .hbmk/win/mingw/KK.o:KK.c:(.text+0x19b): undefined reference to `ISNUM' .hbmk/win/mingw/KK.o:KK.c:(.text+0x26d): undefined reference to `hb_hInstance' collect2.exe: error: ld returned 1 exit status hbmk2[kk]: Error: Ejecutando enlazador. 1
[...] Maybe I have forgotten to include a library in the KK.hbp, but which one? I have this in KK.hbp (from other code tests) [...]
hbwin.hbc hbhttpd.hbc xhb.hbc -b -lhbct -lhbnf -lhbwin #-lhbvpdf -lhbxpp -lhbssl -lhbcurl #-lcurl
[...] Any ideas? Thanks !!!

pcordonet

unread,
Nov 11, 2021, 4:07:06 AM11/11/21
to Harbour Users
Hi, 
I'm sorry, my code works fine with xhb.com.

I can't help to borrow to harbour.

Thanks.
Pere



El dia dimecres, 10 de novembre de 2021 a les 18:00:50 UTC+1, Yakano va escriure:

Yakano

unread,
Nov 11, 2021, 11:31:36 AM11/11/21
to Harbour Users
Hi Pere

I am using ... Harbour Make (hbmk2) 3.2.0dev (r2021-04-28 18:02)

Any help is welcome 

Thanks!

Auge & Ohr

unread,
Nov 11, 2021, 1:03:53 PM11/11/21
to Harbour Users
hi,

instead of ISNUM() we can use  hb_ISNUM()
looking for hb_hInstance it "seems Outdate"

Version 1.0.1 (2008-09-10)
- Removed hb_hInstance, hb_hPrevInstance, s_iCmdShow, s_WinMainParam
  old undocumented public variables. 3rd parties should use
  official hb_winmainArgGet() API to get these values.
  This feature is also HB_LEGACY_LEVEL dependent, therefore it will
  be finalized in 1.1, until then, old symbols will still work.

Jimmy

Auge & Ohr

unread,
Nov 11, 2021, 1:11:02 PM11/11/21
to Harbour Users
hi,

use GetInstance() instead of hb_hInstanceand now it work

Jimmy

Maurizio la Cecilia

unread,
Nov 12, 2021, 5:32:06 AM11/12/21
to harbou...@googlegroups.com
Hi,
AFAIK GetInstance() seems to be FiveWin related, not a pure Harbour or contrib function.
Best regards.
--
Maurizio
--
--
You received this message because you are subscribed to the Google
Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: http://groups.google.com/group/harbour-users

---
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/harbour-users/b71f2d5c-5c2c-4047-a246-e1135555c89dn%40googlegroups.com.


Maurizio la Cecilia

unread,
Nov 12, 2021, 6:13:16 AM11/12/21
to harbou...@googlegroups.com
Hi Yakano,
the code below is working flawlessly for me:



Function MsgBalloon( cMessage, cTitle )

   ShowNotifyInfo( 0, .F. , NIL, NIL, NIL, NIL )
   ShowNotifyInfo( 0, .T. , Nil, Nil, cMessage, cTitle )

   Return Nil

#pragma BEGINDUMP

      #include <windows.h>
      #include <commctrl.h>
      #include <shlobj.h>

      #include "hbapi.h"
      #include "hbvm.h"
      #include "hbstack.h"
      #include "hbapiitm.h"
      #define HDIB HANDLE

      #include "hbapiitm.h"


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

      HB_FUNC ( SHOWNOTIFYINFO )
      {

         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) hb_parnl(1), (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



Please, test it and report if it's the same for you.
Best regards.
--
Maurizio
--
--
You received this message because you are subscribed to the Google
Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: http://groups.google.com/group/harbour-users

---
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-user...@googlegroups.com.

Yakano

unread,
Nov 12, 2021, 7:08:18 AM11/12/21
to Harbour Users
Hi Jimmy and Maurizio, tanks for your helps!

Maurizio, your code returns me  these errors...

hbmk2: Compilando...
KK.prg: In function 'ShowNotifyInfo':
KK.prg:6640:31: error: 'NIF_INFO' undeclared (first use in this function); did you mean 'RIP_INFO'?
KK.prg:6640:31: note: each undeclared identifier is reported only once for each function it appears in
KK.prg:6641:14: error: 'NOTIFYICONDATA {aka struct _NOTIFYICONDATAA}' has no member named 'dwInfoFlags'
KK.prg:6641:36: error: 'NIIF_INFO' undeclared (first use in this function); did you mean 'NIF_INFO'?
KK.prg:6644:23: error: 'NOTIFYICONDATA {aka struct _NOTIFYICONDATAA}' has no member named 'szInfo'
KK.prg:6645:23: error: 'NOTIFYICONDATA {aka struct _NOTIFYICONDATAA}' has no member named 'szInfoTitle'
hbmk2[kk]: Error: Ejecutando compilador C/C++. 1

I hope it was usefull....

Thanks again

Maurizio la Cecilia

unread,
Nov 12, 2021, 7:39:30 AM11/12/21
to harbou...@googlegroups.com
Hum...
What kind of compiler are you using?
I'm compiling with MinGW 11.2 and the only message displayed is:

C:\SVN\wce\..\hbsys\hbs_misc.prg: In function 'HB_FUN_SHOWNOTIFYINFO':
C:\SVN\wce\..\hbsys\hbs_misc.prg:1094:26: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
 1094 |          ShowNotifyInfo( (HWND) hb_parnl(1), (BOOL) hb_parl(2), hIcon , (LPSTR) hb_parc(4), (LPSTR) hb_parc(5), (LPSTR) hb_parc(6) );
      |

--
Maurizio

d s

unread,
Nov 12, 2021, 7:50:11 AM11/12/21
to Harbour Users
Hi,
just to report. Example sent by Maurizio works on my pc.
Harbour 3.2.0 (r2019-04-11)
MinGW 6.3.0.
Thank you Maurizio.

Best regards.
Simo.


Yakano

unread,
Nov 12, 2021, 8:06:04 AM11/12/21
to Harbour Users
Hi Maurizio

I don't know, it's was installed by Harbour 3.0, then some 3.2 and now the last from official web. It was transparent to me and it's working...

How can I check wich version I am using?

Regards

Yakano

unread,
Nov 12, 2021, 8:06:36 AM11/12/21
to Harbour Users
Hi Simo, thanks!

Maurizio la Cecilia

unread,
Nov 12, 2021, 12:16:34 PM11/12/21
to harbou...@googlegroups.com
Hi Yakano,
hb_Version( 1 ) does the job.
If you are compiling with last nightly build, the compiler version should be 6.3.
Anyway, reading the received errors, it seems you're lacking of some include file.
Instead, looking at my code, I found that the lines below can be deleted (one of them is a duplicated include and the define of HBDIB is unnecessary):

      #define HDIB HANDLE

      #include "hbapiitm.h"

Bye.
--
Maurizio

Auge & Ohr

unread,
Nov 12, 2021, 2:33:56 PM11/12/21
to Harbour Users
hi,

> AFAIK Get-instance() seems to be FiveWin related, not a pure Harbour or contrib function.
you are right.
when use HMG Constribution, instead of MiniGUI, i got "[-Wimplicit-function-declaration]"
so GetModuleHandle( NULL ) is the right Way

but "header" is to much ... you need only
#pragma BEGINDUMP
    #include <windows.h>
    #include "hbapi.h"

Jimmy
p.s. i have Problem with Windows Insider 22499 where it does no work ...

Maurizio la Cecilia

unread,
Nov 12, 2021, 8:01:06 PM11/12/21
to harbou...@googlegroups.com
Hi Jimmy,
my OS is Windows 11 21H2 (build 22000.318) and it works until now.
You're right about the unneeded header files inclusion, I just tried to solve the GetInstance() problem.

Anyway, after a deeper look to MsgBalloon() I tried to enhance the function proposed by Yakano adding two parameters.
1. the icon to be displayed to the left of the title
2. the type of the icon to be displayed to the left of the message can be set not only to info icon, but also to other types covered by the API function

The code is:
/*------------------------------------------------------
MsgBalloon( cMessage, [ cTitle ], [ xIcon ], [ nFlags ] ) -> nil
Copyright 2007-2013 Grigory Filatov <gfil...@inbox.ru>
Parameters:
cMessage        -> info text
cTitle          -> info title
xIcon           -> resource id / resource name / filename
                   of the icon displayed to the left of the title
nFlags          -> bit masked icon flags (default = WIN_NIIF_INFO)
                   for the icon displayed to the left of the message
                  set from ShellNotifyIcon() dwInfoFlags values:
                  #define WIN_NIIF_NONE                      0x00000000
                  #define WIN_NIIF_INFO                      0x00000001
                  #define WIN_NIIF_WARNING                   0x00000002
                  #define WIN_NIIF_ERROR                     0x00000003
                  #define WIN_NIIF_USER                      0x00000004
                  #define WIN_NIIF_NOSOUND                   0x00000010
                  #define WIN_NIIF_LARGE_ICON                0x00000020
                  #define WIN_NIIF_RESPECT_QUIET_TIME        0x00000080
                  #define WIN_NIIF_ICON_MASK                 0x0000000F
                  if nFlags is used via symbolic names it's needed to include "hbwin.ch" in source
Samples:
MsgBallon( "Some text" )
MsgBallon( "Some text", "A title" )
MsgBallon( "Some text", "A title", 123 )  123 is the id of the icon set in resource file
MsgBallon( "Some text", "A title", "PRGICON" ) "PRGICON" is the icon name set in resource file
MsgBallon( "Some text", "A title", "c:\path\icon.ico" )
MsgBallon( "Some text", "A title", "c:\path\icon.ico", NIIF_ERROR ) same as previous, but with an error icon
MsgBallon( "Some text", "A title", "c:\path\icon.ico", NIIF_USER + NIIF_NOSOUND ) no sound, same icon as title icon
--------------------------------------------------------*/
function MsgBalloon( cMessage, cTitle, xIcon, nFlags )
   ShowNotifyInfo( 0, .F. , xIcon, NIL, NIL, NIL, NIL )
   ShowNotifyInfo( 0, .T. , xIcon, NIL, cMessage, cTitle, hb_defaultValue( nFlags, 1 ) )
   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, int nFlags );
      HB_FUNC ( SHOWNOTIFYINFO )
      {
         HICON hIcon;
         if ( HB_ISNUM( 3 ) )
         {
            hIcon = LoadIcon( ( HINSTANCE ) GetModuleHandle( NULL ), MAKEINTRESOURCE( hb_parni( 3 ) ) );
         }
         else
         {
            hIcon = LoadIcon( ( HINSTANCE ) GetModuleHandle( NULL ), hb_parc( 3 ) );
            if ( hIcon == NULL )
               hIcon = ( HICON ) LoadImage( ( HINSTANCE ) NULL, hb_parc( 3 ), IMAGE_ICON, 0, 0, LR_LOADFROMFILE );
         }
         ShowNotifyInfo( (HWND) hb_parnl(1), (BOOL) hb_parl(2), hIcon , (LPSTR) hb_parc(4), (LPSTR) hb_parc(5), (LPSTR) hb_parc(6), hb_parni( 7 ) );
      }
      static void ShowNotifyInfo(HWND hWnd, BOOL bAdd, HICON hIcon, LPSTR szText, LPSTR szInfo, LPSTR szInfoTitle, INT nFlags )
      {
          NOTIFYICONDATA nid;
          ZeroMemory( &nid, sizeof(nid) );
          nid.cbSize        = sizeof(NOTIFYICONDATA);
          nid.hIcon         = hIcon;
          nid.hWnd          = hWnd;
          nid.uID           = 0;
          nid.uFlags        = NIF_INFO | NIF_ICON;
          nid.dwInfoFlags   = nFlags;
          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

Any suggestion is very appreciated.
Best regards.
--
Maurizio

Auge & Ohr

unread,
Nov 12, 2021, 8:29:47 PM11/12/21
to Harbour Users
hi Maurizio,

based on your Idea i have try to load Icon from "Resource"

   // Resource "Number"
   ShowNotifyInfo( 0, .T. , 10002 , NIL, cMessage, cTitle )

but it need to modify *.RC to use it

#define A2MAIN 10002
A1MAIN          ICON RES\BOLOV.ICO
A2MAIN          ICON RES\BOLOR.ICO

Jimmy

Maurizio la Cecilia

unread,
Nov 12, 2021, 8:39:42 PM11/12/21
to Harbour User Group
Yes, but also
10002  ICON  RES\BOLOV.ICO
should work.

To avoid any change in .rc, the call should be
MsgBalloon( "Any text", "Any title", "A1MAIN" )
--
Maurizio

Auge & Ohr

unread,
Nov 12, 2021, 10:03:35 PM11/12/21
to Harbour Users

hi,

> MsgBalloon( "Any text", "Any title", "A1MAIN" )

but i got no "own" Icon when use "String" ?
that is why i have used

#define A2MAIN 10002

in *.RC

> 10002  ICON  RES\BOLOV.ICO

that Way it also work

Jimmy

Maurizio la Cecilia

unread,
Nov 13, 2021, 3:16:21 AM11/13/21
to Harbour User Group
Sorry, the correct call for your sample  should be obviously
MsgBalloon( "Any text", "Any title", "A2MAIN" )
and on my side it's showing correctly the icon to the left of the program name.
To display same icon to the left of the message text you should use
MsgBalloon( "Any text", "Any title", "A2MAIN", WIN_NIIF_USER ). 
Maybe a problem of the insider build?
--
Maurizio

José M. C. Quintas

unread,
Nov 13, 2021, 10:44:56 AM11/13/21
to harbou...@googlegroups.com

To know: On \harbour34\contrib\hbwin\win_shell.c


/* win_ShellNotifyIcon( [<hWnd>], [<nUID>], [<nMessage>], [<hIcon>],
                        [<cTooltip>], [<lAddDel>],
                        [<cInfo>], [<nInfoTimeOut>], [<cInfoTitle>], [<nInfoFlags>] ) --> <lOK> */
HB_FUNC( WIN_SHELLNOTIFYICON )


José M. C. Quintas

Yakano

unread,
Nov 15, 2021, 1:54:33 AM11/15/21
to Harbour Users
Hello everyone and thank you all again. 

Maurizio, hb_Version(1) returns MinGW GNU C 7.3 (32-bit). 

To avoid possible influences from other libraries / include / define I have copied your last code to a separate file and after "hbmk2 MsgBalon.prg" I still get the same errors and I still do not know why. 

Harbour 3.2.0dev (r2104281802)
Copyright (c) 1999-2021, https://harbour.github.io/
Compiling 'MsgBalon.prg'...
Lines 100, Functions/Procedures 2
Generating C source output to 'C:\Users\aitsl\AppData\Local\Temp\hbmk_23wymy.dir\MsgBalon.c'... Done.
MsgBalon.prg: In function 'ShowNotifyInfo':
MsgBalon.prg:84:31: error: 'NIF_INFO' undeclared (first use in this function); did you mean 'RIP_INFO'?
MsgBalon.prg:84:31: note: each undeclared identifier is reported only once for each function it appears in
MsgBalon.prg:85:14: error: 'NOTIFYICONDATA {aka struct _NOTIFYICONDATAA}' has no member named 'dwInfoFlags'
MsgBalon.prg:88:23: error: 'NOTIFYICONDATA {aka struct _NOTIFYICONDATAA}' has no member named 'szInfo'
MsgBalon.prg:89:23: error: 'NOTIFYICONDATA {aka struct _NOTIFYICONDATAA}' has no member named 'szInfoTitle'
hbmk2: Error: Ejecutando compilador C/C++. 1

HB32 installations have always been official and without changing or adding absolutely anything (I am a low-power user). I attach the files involved if you can confirm that they are correct, because <windows.h> is dated 2011 and I found it strange, since "hbapi.h" is from 2021.

Any suggestions are welcome. 

Thank you all very much.
Best regards.
windows.h
MsgBalon.prg
hbapi.h

Yakano

unread,
Nov 15, 2021, 2:10:42 AM11/15/21
to Harbour Users
I forgot to mention that, for checking, I re-downloaded harbour-nightly-win.7z and found no <windows.h> in "hb32\comp\mingw\include\windows.h". It's normal???

d s

unread,
Nov 15, 2021, 2:37:16 AM11/15/21
to Harbour Users
Hi Yakano
I have commented code lines from 1 to 38 in example you sent. I left only MsgBalloon function.
Then compiled with no problems. All works fine.
I work on Windows 10 64-bit machine, but with MinGW 32 bit compiler, gcc version 7.3.0 .

Best regards,
Simo.





 

Yakano

unread,
Nov 15, 2021, 3:02:42 AM11/15/21
to Harbour Users
Hi Simo

I have "same" work configuration ... Windows10x64bits and  hb_Version(1)="MinGW GNU C 7.3 (32-bit)."  (But I don't know the differences between "gcc" and "GNU C", both 7.3)

Can you share your "windows.c"? I can't found it...

Thanks!

Yakano

unread,
Nov 15, 2021, 3:04:27 AM11/15/21
to Harbour Users
<windows.h>  ... Sorry :'(

Auge & Ohr

unread,
Nov 15, 2021, 3:15:14 AM11/15/21
to Harbour Users
hi,

the 1st Version had some #Include with "seems" not need

in my HMG Constribution Environment "shellapi.h" is include but if you use "plain" harbour you need to include it yourself.

"shellapi.h" is on my PC under
32 Bit
c:\hmg.3.4.4\MINGW\i686-w64-mingw32\include\shellapi.h
64 Bit
c:\hmg.3.4.4\MinGW-64\x86_64-w64-mingw32\include\shellapi.h

and include NIF_INFO and NOTIFYICONDATA Structure

Jimmy

d s

unread,
Nov 15, 2021, 3:24:28 AM11/15/21
to Harbour Users
HI Yakano
I am sending you windows.h found in my  ... \comp\mingw\i686-w64-mingw32\include folder.
To be honest I do not touch MinGW files. I have installed MinGW and use it as is, no modifications.

Best regards,
Simo.
windows.h

Yakano

unread,
Nov 15, 2021, 6:11:15 AM11/15/21
to Harbour Users
Hi Simo

Finally I have found the original <windows.h> file in [https://github.com/jonasstrandstedt/MinGW/blob/master/MinGW/include/windows.h] and it is the same as the one I have, except for some irrelevant empty lines.

I see that yours is quite different from mine, I'll test it in an encapsulated environment and I'll tell you ...
 

One more question: When you compile the code that I sent in the MsgBalon.prg file, you add something to "hbmk2 MsgBalon.prg" or you get it with just that command and, therefore, you can generate a text mode executable that shows the Balloon notification ???

Thanks 

Yakano

unread,
Nov 15, 2021, 6:14:39 AM11/15/21
to Harbour Users
Hi Jimmy

I have #include <shellapi.h> in the MsBalon.prg code, but no changes, it still gives the same result with the same error messages.

Thanks 

Yakano

unread,
Nov 15, 2021, 6:21:39 AM11/15/21
to Harbour Users
Hi again Simo

Your <windows.h> don't fix the errors and even makes it more complex (for me). That's de new output...

Harbour 3.2.0dev (r2104281802)
Copyright (c) 1999-2021, https://harbour.github.io/
Compiling 'MsgBalon.prg'...
Lines 100, Functions/Procedures 2
Generating C source output to 'C:\Users\aitsl\AppData\Local\Temp\hbmk_gslpsy.dir\MsgBalon.c'... Done.
In file included from G:/hb32/comp/mingw/i686-w64-mingw32/include/winscard.h:12:0,
                 from G:/hb32/comp/mingw/include/windows.h:97,
                 from MsgBalon.prg:50:
G:/hb32/comp/mingw/i686-w64-mingw32/include/winsmcrd.h:17:29: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'ULONG'
   typedef unsigned __LONG32 ULONG;
                             ^~~~~
G:/hb32/comp/mingw/i686-w64-mingw32/include/winsmcrd.h:175:5: error: expected specifier-qualifier-list before '__C89_NAMELESS'
     __C89_NAMELESS union {
     ^~~~~~~~~~~~~~
In file included from G:/hb32/comp/mingw/include/windows.h:114:0,
                 from MsgBalon.prg:50:
G:/hb32/comp/mingw/i686-w64-mingw32/include/stralign.h:35:3: error: unknown type name 'PUWSTR'; did you mean 'PCWSTR'?
   PUWSTR ua_wcscpy(PUWSTR Destination,PCUWSTR Source);
   ^~~~~~
   PCWSTR
G:/hb32/comp/mingw/i686-w64-mingw32/include/stralign.h:35:20: error: unknown type name 'PUWSTR'; did you mean 'PCWSTR'?
   PUWSTR ua_wcscpy(PUWSTR Destination,PCUWSTR Source);
                    ^~~~~~
                    PCWSTR
G:/hb32/comp/mingw/i686-w64-mingw32/include/stralign.h:35:39: error: unknown type name 'PCUWSTR'; did you mean 'PCWSTR'?
   PUWSTR ua_wcscpy(PUWSTR Destination,PCUWSTR Source);
                                       ^~~~~~~
                                       PCWSTR
G:/hb32/comp/mingw/i686-w64-mingw32/include/stralign.h:37:16: error: unknown type name 'PUWSTR'
   __CRT_INLINE PUWSTR ua_wcscpy(PUWSTR Destination,PCUWSTR Source) { return wcscpy(Destination,Source); }
                ^~~~~~
G:/hb32/comp/mingw/i686-w64-mingw32/include/stralign.h:37:33: error: unknown type name 'PUWSTR'; did you mean 'PCWSTR'?
   __CRT_INLINE PUWSTR ua_wcscpy(PUWSTR Destination,PCUWSTR Source) { return wcscpy(Destination,Source); }
                                 ^~~~~~
                                 PCWSTR
G:/hb32/comp/mingw/i686-w64-mingw32/include/stralign.h:37:52: error: unknown type name 'PCUWSTR'; did you mean 'PCWSTR'?
   __CRT_INLINE PUWSTR ua_wcscpy(PUWSTR Destination,PCUWSTR Source) { return wcscpy(Destination,Source); }
                                                    ^~~~~~~
                                                    PCWSTR
hbmk2: Error: Ejecutando compilador C/C++. 1

Auge & Ohr

unread,
Nov 15, 2021, 6:24:21 AM11/15/21
to Harbour Users
hi,

have you add
#include <shellapi.h>

after
#pragma BEGINDUMP

and "shellapi.h" exist in same Folder ?

Jimmy

Yakano

unread,
Nov 15, 2021, 6:52:09 AM11/15/21
to Harbour Users
Hi, Jimmy

Yes I have both, <windows.h> and <shellapi.h> in same folder "\comp\mingw\include".

Even, I can find NIF_INFO and NOTIFYICONDATA as you can see on attached files.log.

I'm confused...

NIF_INFO.log
NOTIFYICONDATA.log
MsgBalon.prg

KennyOoi

unread,
Nov 15, 2021, 8:27:32 AM11/15/21
to Harbour Users
hi Yakano ,
i have try your code compile with my own build harbour,with no error.
only add return after MsgBallon( "Some text", "A title", "g:\ait\ait.ico" )
and change the function MsgBalloon( cMessage, cTitle, xIcon, nFlags ) to
function MsgBallon( cMessage, cTitle, xIcon, nFlags )

Harbour Build Info
---------------------------
Version: Harbour 3.2.0dev (r2104281802)
Compiler: MinGW GNU C 11.1 (32-bit)
Platform: Windows 7 6.1 SP1
PCode version: 0.3
ChangeLog last entry: 2021-04-28 20:02 UTC+0200 Aleksander Czajcz
l)
ChangeLog ID: 4643587824552fd877e7f02ad11596e0b30c465d
Built on: Sep 25 2021 20:03:45
Extra C compiler options: -DHB_GC_AUTO -DHB_NO_TRACE
Build options: (Clipper 5.3b) (Clipper 5.x undoc)

d s

unread,
Nov 15, 2021, 9:56:40 AM11/15/21
to Harbour Users


Hi Yakano,
When I compile the code that you sent iI do it with "hbmk2 MsgBalon.prg hbmk.hbm".
So I am sending to you my hbmk.hbm. It contains lines that I need when compiling my application.

Best regards,
Simo.

HBMK.HBM

Maurizio la Cecilia

unread,
Nov 15, 2021, 12:36:56 PM11/15/21
to harbou...@googlegroups.com
Hi Yakano,
did you add hbwin.ch in your .hbp/.hbm file?

IMHO the problem isn't related to windows.h, but to shellapi.h

To deeper investigate, you should search shellapi.h  for
typedef struct _NOTIFYICONDATAA
and for
#define NIF_INFO 0x00000010

If both present the only suspect I can have is about the NOTIFYICONDATAA version, because if a V1 version is detected no dwInfoFlags are expected to be present.

Reading shellapi.h content, you'll find:
#define NOTIFYICONDATAA_V1_SIZE FIELD_OFFSET (NOTIFYICONDATAA, szTip[64])
#define NOTIFYICONDATAA_V2_SIZE FIELD_OFFSET (NOTIFYICONDATAA, guidItem)
#define NOTIFYICONDATAA_V3_SIZE FIELD_OFFSET (NOTIFYICONDATAA, hBalloonIcon)

As you can see, the V1 is cutting most of the structure.
You can also compare your shellapi.h to mine, as I'm attaching it to this message.

Anyway, did you read the suggestion by Quintas?
You could directly use hbwin.lib to achieve the same result bypassing the suffered problems...
Please, let me know if about your shellapi.h and if you need some help about using the hbwin solution, even if it should be trivial to do.

Best regards.
--
Maurizio

shellapi.h

Yakano

unread,
Nov 15, 2021, 1:14:35 PM11/15/21
to Harbour Users
Hi to all

KennyOoi
Bad luck, it doesn't work either. Add return and rename the function, it gives the same errors

Simo
Bad luck too, including your "hbm" doesn't change anything and gives the same errors 

Maurizio
Now I'm not using ".hbp/.hbm" because I thinked this could be the problem (but in both cases give same results)
I saw JoséQuintas, but I thinked it was a sugestion for HB34. Isnt it?
Your <shellapi.h> and mine are quite differents, I try with yours and I get differents error below (not sure that was good...)
Harbour 3.2.0dev (r2104281802)
Copyright (c) 1999-2021, https://harbour.github.io/
Compiling 'MsgBalon.prg'...
Lines 103, Functions/Procedures 2
Generating C source output to 'C:\Users\aitsl\AppData\Local\Temp\hbmk_yf4du5.dir\MsgBalon.c'... Done.
In file included from G:/hb32/comp/mingw/include/windows.h:83:0,
                 from MsgBalon.prg:52:
G:/hb32/comp/mingw/include/shellapi.h:315:5: error: expected specifier-qualifier-list before '__C89_NAMELESS'
     __C89_NAMELESS union {
     ^~~~~~~~~~~~~~
G:/hb32/comp/mingw/include/shellapi.h:336:5: error: expected specifier-qualifier-list before '__C89_NAMELESS'
     __C89_NAMELESS union {
     ^~~~~~~~~~~~~~
G:/hb32/comp/mingw/include/shellapi.h:400:5: error: expected specifier-qualifier-list before '__MINGW_EXTENSION'
     __MINGW_EXTENSION __int64 i64Size;
     ^~~~~~~~~~~~~~~~~
G:/hb32/comp/mingw/include/shellapi.h:453:5: error: expected specifier-qualifier-list before '__C89_NAMELESS'
     __C89_NAMELESS union {
     ^~~~~~~~~~~~~~
G:/hb32/comp/mingw/include/shellapi.h:476:5: error: expected specifier-qualifier-list before '__C89_NAMELESS'
     __C89_NAMELESS union {
     ^~~~~~~~~~~~~~
MsgBalon.prg: In function 'ShowNotifyInfo':
MsgBalon.prg:88:14: error: 'NOTIFYICONDATA {aka struct _NOTIFYICONDATAA}' has no member named 'dwInfoFlags'
MsgBalon.prg:92:24: error: 'NOTIFYICONDATA {aka struct _NOTIFYICONDATAA}' has no member named 'szInfoTitle'; did you mean 'szInfo'?
hbmk2: Error: Ejecutando compilador C/C++. 1

Best Regards and Thanks for helping me

windows.h
shellapi.h

Pete

unread,
Nov 15, 2021, 1:29:47 PM11/15/21
to Harbour Users
Hi,
... as complement to what Jose Quintas and Mauricio have already suggested, here is a sample code to try.
(pure and simple harbour code).

compile:
hbmk2 notify.prg hbwin.hbc
notify.prg

Yakano

unread,
Nov 15, 2021, 2:04:06 PM11/15/21
to Harbour Users

Hi Pete I'm testing José's suggestion (thanks Mr. Quintas) and your own code and it compiles and links without problems, but when I run it, it does nothing (returns .F.). for both calls to win_ShellNotifyIcon. This is the output after "hbmk2 notify.prg hbwin.hbc" (I just added "?" To know the return of win_ShellNotifyIcon)

G:\hb32\AIT32\KK\MsgBalloon>hbmk2 notify.prg hbwin.hbc hbmk2: Procesando script local: hbmk.hbm Harbour 3.2.0dev (r2104281802) Copyright (c) 1999-2021, https://harbour.github.io/ Compiling 'notify.prg'... Lines 14, Functions/Procedures 1 Generating C source output to 'C:\Users\aitsl\AppData\Local\Temp\hbmk_1ddtsu.dir\notify.c'... Done. G:\hb32\AIT32\KK\MsgBalloon>notify.exe .F. .F. I'm starting to look like the clumsiest of the class, but no suggestion works for me, not even the simplest ...  But I keep trying and any suggestions are welcome. Thanks to * ALL *

Message has been deleted

Pete

unread,
Nov 15, 2021, 3:04:31 PM11/15/21
to Harbour Users
G:\hb32\AIT32\KK\MsgBalloon>notify.exe .F. .F.
 
so, the function `win_ShellNotifyIcon()`  for some reason fails.
 
I'm starting to look like the clumsiest of the class, but no suggestion works for me, not even the simplest ...  
 
please don't loose your courage ... ;-)
 
But I keep trying and any suggestions are welcome.

add this line after  both calls of win_ShellNotifyIcon()
   ? wapi_GetLastError()
usually it helps to identify the reason of failure.

regards,
Pete
 

José M. C. Quintas

unread,
Nov 15, 2021, 5:13:47 PM11/15/21
to harbou...@googlegroups.com

hbwin on harbour 3.4 has too many other functions.

I would like to see same routines on harbour 3.2 and Xharbour.

On this way, hwgui, minigui and others can use standards routines for windows.

Harbour/xHarbour becomes more powerfull, and libraries more standard, without need to multiply API Windows functions and/or C routines to use with harbour/xharbour.

José M. C. Quintas

Auge & Ohr

unread,
Nov 15, 2021, 8:14:04 PM11/15/21
to Harbour Users
hi,

not sure but i "think" you need Manifest to work.

IMHO to use "only" Hbmk2 it is hard to find out what is missing.
i recommend to use a "full-Constribution" where most are include.

as i can say it work with HMG and MiniGUI Extended Version.
both include *.BAT ( Builkd.BAT or Compile.BAT ) which call HbMK2 and SET all PATH

Jimmy

Yakano

unread,
Nov 16, 2021, 4:03:28 AM11/16/21
to Harbour Users
Hello
Pete I do not know if it helps, the return of wapi GetLastError is zero and no notification on screen on my Windows10x64 (!)

G:\hb32\AIT32\KK\MsgBalloon>hbmk2 notify.prg hbwin.hbc Harbour 3.2.0dev (r2104281802) Copyright (c) 1999-2021, https://harbour.github.io/ Compiling 'notify.prg'... Lines 14, Functions/Procedures 1 Generating C source output to 'C:\Users\aitsl\AppData\Local\Temp\hbmk_2bcl6p.dir\notify.c'... Done. G:\hb32\AIT32\KK\MsgBalloon>notify.exe .F. 0 .F. 0

José
I'm not sure I'll be able to make the leap to HB 3.4 by myself (you can see my problems on 3.2, 3.4 may be a nightmare for me). I'm half retired and fully rusty, but I'm just a little curious and I try to make "my legacy" a totally independent third-party app.

Jimmy
I have tried it with the usual HBP that I use for the rest of my application (which works without problem for my app), but the error messages are the same. I have also used an HBP (which I attach) only with what is necessary and it reports the same errors. I'm at a dead end ...
Thanks to *ALL*
MsgBalon.hbp
notify.prg
MsgBalon.prg

José M. C. Quintas

unread,
Nov 16, 2021, 4:44:49 AM11/16/21
to harbou...@googlegroups.com

/*
PTESBALLOON
*/

PROCEDURE pTesBalloon

   STATIC nMsg := 1

   MsgBalloon( "NFE autorizada " + Ltrim( Str( nMsg ) ), "NFE autorizada " + Ltrim( Str( nMsg++ ) ) )

   RETURN

FUNCTION MsgBalloon( cSubTitle, cMsg, hIcon )

   IF hIcon == Nil
      hIcon := "AppIcon"
   ENDIF
   hIcon := ze_IconFromResource( hIcon )

   win_ShellNotifyIcon( , , , , , .F. )
   win_ShellNotifyIcon( , , , hIcon, , .T., cMsg, , cSubTitle,,"JPA " + AppEmpresaNome() )

   RETURN Nil


FUNCTION ze_IconFromResource( cIcon, nWidth, nHeight )

   RETURN wapi_LoadImage( wapi_GetModuleHandle(), cIcon, WIN_IMAGE_ICON, nWidth, nHeight, WIN_LR_DEFAULTSIZE )

Using Harbour 3.4 + mingw 7.3

José M. C. Quintas

Yakano

unread,
Nov 16, 2021, 5:14:16 AM11/16/21
to Harbour Users
Hi José

YEEEES, YOU DID IT !!!

It works for me too (HB 3.2 + mingw 7.3)

Where could I find more information about the parameters that win_ShellNotifyIcon uses and some examples on how to use them ?

Muchas gracias, José.

Thanks to *ALL*

Maurizio la Cecilia

unread,
Nov 16, 2021, 5:30:07 AM11/16/21
to harbou...@googlegroups.com
Hi Yakano,
after José Quintas suggestion I'd migrated  the function from your code to pure Harbour based on hbwin library.
On my side the function works correctly. I'd test all cases of resource icon name/id and icon file name as parameters.
Here is it:

/*------------------------------------------------------
hbs_NotifyIcon( cMessage, [ cTitle ], [ xIcon ], [ nFlags ] ) -> .T./.F.
Copyright 2007-2013 Grigory Filatov <gfil...@inbox.ru>
Parameters:
cMessage        -> info text
cTitle          -> info title
xIcon           -> resource id / resource name / filename
                   of the icon
nFlags          -> bit masked icon flags (default = WIN_NIIF_INFO)
                   for the icon displayed to the left of the message
                  set from ShellNotifyIcon() dwInfoFlags values:
                  #define WIN_NIIF_NONE                      0x00000000
                  #define WIN_NIIF_INFO                      0x00000001
                  #define WIN_NIIF_WARNING                   0x00000002
                  #define WIN_NIIF_ERROR                     0x00000003
                  #define WIN_NIIF_USER                      0x00000004
                  #define WIN_NIIF_NOSOUND                   0x00000010
                  #define WIN_NIIF_LARGE_ICON                0x00000020
                  #define WIN_NIIF_RESPECT_QUIET_TIME        0x00000080
                  #define WIN_NIIF_ICON_MASK                 0x0000000F
                  if nFlags is used via symbolic names it's needed to include "hbwin.ch" in source
Samples:
#include "hbwin.ch"
hbs_NotifyIcon( "Some text" )
hbs_NotifyIcon( "Some text", "A title" )
hbs_NotifyIcon( "Some text", "A title", 123 )   // 123 is the id of the icon set in resource file
hbs_NotifyIcon( "Some text", "A title", "PRGICON" ) // "PRGICON" is the icon name set in resource file
hbs_NotifyIcon( "Some text", "A title", "c:\path\icon.ico" )
hbs_NotifyIcon( "Some text", "A title", "c:\path\icon.ico", WIN_NIIF_ERROR ) // same as previous, but with an error icon
hbs_NotifyIcon( "Some text", "A title", "c:\path\icon.ico", WIN_NIIF_USER + WIN_NIIF_NOSOUND ) // no sound, same icon as title icon
--------------------------------------------------------*/
function hbs_NotifyIcon( cMessage, cTitle, xIcon, nFlags )
   local hWnd := wapi_GetModuleHandle()
   local hIcon
   if Empty( hIcon := wapi_LoadImage( hWnd, xIcon, WIN_IMAGE_ICON ) ) .and. ;
      Empty( hIcon := wapi_LoadImage( , xIcon, WIN_IMAGE_ICON, , , WIN_LR_LOADFROMFILE ) )
      return .f.
   endif
   win_ShellNotifyIcon( hWnd, , , , , .f. )
   return win_ShellNotifyIcon( hWnd, , , hIcon, , .t., cMessage, , cTitle, nFlags )

Obviously you need to add hbwin.hbc to your command line or .hbp/.hbm file and hbwin.ch to your code.
Please test it and report if this solution is working on your side.

Based on Jimmy suggestion, I'd try to strip out the manifest from my resource file to test if the lack of manifest is the problem on your side, but this way my exe exits abruptedly.
In effect the Jimmy suggestion could be important, because the OS compatibility results in a different support for Windows controls and APIs.
You should try to add the manifest to your resource file, mainly if also with hbs_NotifyIcon() your test fails.

--
Maurizio 

Yakano

unread,
Nov 16, 2021, 7:25:26 AM11/16/21
to Harbour Users
Hi Maurizio

YEEEES, IT WORKS FOR ME !!!

No need to add "manifest" (well, sorry but I don't know what it really means, excuse me).

Just a very small question: Is it possible to change the name of the executable that appears to the right of the icon, for the text that we want to show, as does Micro$oft ?

For example "hb_gtInfo (HB_GTI_WINTITLE)" instead of FileName.exe, which is used by default. That would be ... simply perfect!

Muchas gracias, Maurizio.

Thanks to *ALL*
TrayBallon.png

Maurizio la Cecilia

unread,
Nov 16, 2021, 11:36:31 AM11/16/21
to harbou...@googlegroups.com
Hi Yakano,
the displayed app name doesn't depend on function parameters, but on file infos.

To achieve the aim you should add to your resource file a section as below:

VS_VERSION_INFO VERSIONINFO
    FILEVERSION     1,2,3,0                            // the wanted version of your exe file
    PRODUCTVERSION  1,2,3,0                    // commonly same as above, but is referred to the package distribution
    FILEOS          VOS__WINDOWS32
    FILETYPE        VFT_APP
    FILESUBTYPE     VFT2_UNKNOWN
    FILEFLAGSMASK   0x00000000
    FILEFLAGS       0x00000000
BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "04100352"
        BEGIN
            VALUE "Comments", "Any comment you want insert"
            VALUE "CompanyName", "Your software house name"
            VALUE "FileDescription", "That's the description you want see in notify!!!"    //   <============== see here
            VALUE "FileVersion", "1.2.3.0"                   // same as version info above, but stringified
            VALUE "InternalName", ""
            VALUE "LegalCopyright", "©2021 Your_Software_House_Name"
            VALUE "LegalTrademarks", ""
            VALUE "OriginalFilename", "the_true_filename_of_your_app.exe"
            VALUE "PrivateBuild", ""
            VALUE "ProductName", "A descriptive name for your app"
            VALUE "ProductVersion", "1.2.3.0"       // commonly same as "FileVersion", but is referred to the package distribution
            VALUE "SpecialBuild", ""
        END
    END
    BLOCK "VarFileInfo"
    BEGIN
        VALUE "Translation", 0x040A, 0x0352    // choose the codes from language and code page values from https://docs.microsoft.com/it-it/windows/win32/intl/code-page-identifiers
    END
END

As you can see, the "FileDescription" is your field.

Best regards.
--
Maurizio

José M. C. Quintas

unread,
Nov 16, 2021, 12:24:15 PM11/16/21
to harbou...@googlegroups.com
Look again:

   win_ShellNotifyIcon( , , , , , .F. )
   win_ShellNotifyIcon( , , , hIcon, , .T., cMsg, , cSubTitle,,"JPA " + AppEmpresaNome() )

/* win_ShellNotifyIcon( [<hWnd>], [<nUID>], [<nMessage>], [<hIcon>],
                        [<cTooltip>], [<lAddDel>],
                        [<cInfo>], [<nInfoTimeOut>], [<cInfoTitle>], [<nInfoFlags>] ) --> <lOK> */

There are 3 text parameters, default is application name.

José M. C. Quintas

jmcqu...@gmail.com

unread,
Nov 16, 2021, 12:51:58 PM11/16/21
to Harbour Users

jmcqu...@gmail.com

unread,
Nov 16, 2021, 1:02:23 PM11/16/21
to Harbour Users
More complete here, with data structure

José M. C. Quintas

Maurizio la Cecilia

unread,
Nov 16, 2021, 1:02:39 PM11/16/21
to harbou...@googlegroups.com
Hi José,
you're passing a one more parameter to the function.
look again at the skeleton of the function: ten parameters are expected and the appname you're passing is the eleventh:

   win_ShellNotifyIcon( 1,2 ,3 ,4 hIcon,5 ,6  .T.,7 cMsg, 8, 9 cSubTitle,10,11 "JPA " + AppEmpresaNome() )

/* win_ShellNotifyIcon( 1 [<hWnd>],2  [<nUID>], 3 [<nMessage>], 4 [<hIcon>],
                        5 [<cTooltip>], 6 [<lAddDel>],
                        7 [<cInfo>], 8 [<nInfoTimeOut>], 9 [<cInfoTitle>], 10 [<nInfoFlags>] ) --> <lOK> */

I looked at the C source of win_ShellNotifyIcon() and no reference to eleventh parameter is present.

I figure that this eleventh parameter is present in Harbour 3.4, but Yakano is using 3.2 as me.
I'll look at Harbour 3.4 sources and if I'll find more than 10 parameters I'll try to import them into 3.2.

Thanks for the info.
--
Maurizio

Maurizio la Cecilia

unread,
Nov 16, 2021, 1:24:31 PM11/16/21
to harbou...@googlegroups.com
Hi José,
sorry but no reference to the eleventh parameter is present in 3.4 neither in 3.2, thus this parameter is obviously ignored.
Did you test the sample you showed?
I'm surprised if it's working on your side.
Please, test again and report.
--
Maurizio

Il 16/11/2021 18:24, José M. C. Quintas ha scritto:

Yakano

unread,
Nov 16, 2021, 1:32:35 PM11/16/21
to Harbour Users
Hello Mauricio and José I have never used a resource file, since my executables are console mode, and I have only assigned an icon in the .HBP file, that was it. With Harbour I am beginning to discover a fascinating 32-bit world. I don't want to sound insolent, but I was thinking that by doing hWnd: =wapi_GetModuleHandle () we were picking up just that or similar information to deliver to win_ShellNotifyIcon(). I also thought that this information could be modified, although I don't know how because the debugger doesn't allow me to edit that variable (pointer) and I don't know the structure of the information it stores. If this way is correct, it would be interesting to be able to change the variable (pointer) hWnd, which is passed as a parameter.

I thought José was referring to [<cTooltip>], but I have put a value there and (apparently) nothing changes, FileName.exe still appears, but it continues to work without error.

Sorry I can't help, the code you reference is out of my orbit. You are from another planet ...;-) Thanks!

Maurizio la Cecilia

unread,
Nov 16, 2021, 2:15:33 PM11/16/21
to harbou...@googlegroups.com
Hi Yakano,
simply create a text file, i.e. <app_name>.rc, and copy the section I sent. Modify the values in base of your needs and save.
Add the <app_name>.rc to the list of files into your .hbp file. Rebuild. That's all.
If all works fine, right clicking on your exe and opening Properties->Details you'll find the info you typed and the notify appname should change.

About the hWnd, there is no way to edit a pointer and would be very dangerous to allow it.

About the José suggestion, the overflowing parameter is just ignored (it's how Harbour does normally) and so the program works without error.
Best regards.
--
Maurizio

Yakano

unread,
Nov 16, 2021, 2:34:43 PM11/16/21
to Harbour Users
Hello Maurizio I have followed your instructions, but it failed with error on line 4. I have looked for ".rc" in the group and I have found a post from Jimmy [https://groups.google.com/g/harbour-users/c/Ed6oQRH5UKE/m/lrYtT9yqDgAJ] and I have used his structure (I have only removed the last line that starts with A1MAIN) and it works just like you told me. You have almost led me by the hand to get it, you are Great! Thanks to *ALL*

José M. C. Quintas

unread,
Nov 16, 2021, 3:47:39 PM11/16/21
to harbou...@googlegroups.com

I was wrong.

When I change test from isolated module to application, name changes, but not the parameter, it is the information inside resource.

on Windows 10, balloon is showed on right notifications too.


José M. C. Quintas

Reply all
Reply to author
Forward
0 new messages