[fpc-devel] NotifyIconData not flexible enougth

Felipe Monteiro de Carvalho felipemonteiro.carvalho at gmail.com
Sat Nov 10 10:38:47 CET 2007


Hello,

The _NOTIFYICONDATA structure and other similar ones on ShellAPI have
different versions choosen based on IFDEFs:

       _NOTIFYICONDATAA         = record
                                   cbSize               : DWORD;
                                   hWnd                 : HWND;
                                   uID                  : UINT;
                                   uFlags               : UINT;
                                   uCallbackMessage     : UINT;
                                   hIcon                : HICON;
                                   {$ifdef IELower5}
                                    szTip               : array[0..63] of CHAR;
                                   {$else}
                                    szTip               : array[0..127] of CHAR;
                                   {$endif}
                                   {$ifdef IEhigherEqual5}
                                    dwState             : DWORD;
                                    dwStateMask         : DWORD;
                                    szInfo              : array[0..255] of CHAR;
                                    DUMMYUNIONNAME      : record
                                                           case longint of
                                                               0 : (
uTimeout : UINT );
                                                               1 : (
uVersion : UINT );
                                                              end;
                                    szInfoTitle : array[0..63] of CHAR;
                                    dwInfoFlags : DWORD;
                                   {$endif}
                                   {$ifdef IEHighEq6}
                                    guidItem : GUID;
                                   {$endif}
                                   end;

But this is a problem, because then we can't use new versions of the
structure on Lazarus unless we rebuild this package with special
options.

Also, the ifdefs talk about Internet Explorer versions. The MS Docs
talk about simply structure versions:
http://msdn2.microsoft.com/en-us/library/bb773352.aspx

I would rather use the microsoft nomenclature so it's clear which
structure versions we are dealing with.

One solution would be to split the structure in  _NOTIFYICONDATAA,
_NOTIFYICONDATAA_V5,  _NOTIFYICONDATAA_V6, etc

But then we have a problem that the api that uses this structure is typed:

Function Shell_NotifyIconA( dwMessage: Dword;lpData:
PNOTIFYICONDATAA):Bool;external 'shell32.dll' name
'Shell_NotifyIconA';

One solution would be changing lpData type to untyped pointer, so one
can use any structure with it.

Any other ideas about this problem, and solutions for it?

thanks,
-- 
Felipe Monteiro de Carvalho



More information about the fpc-devel mailing list