Re: Tray icon /Flashwindow
- Posted by Matthew Lewis <MatthewL at KAPCOUSA.COM> Jan 26, 2001
- 740 views
> From: renzo beggia > > I'm trying to add the shell_notifyicon(x,NOTIFYICONDATA) function > > > > but i can't seem to create the typedef (C) NOTIFYICONDATA. > > Can someone help me. To follow current win32lib notation, use this: constant NOTIFYICONDATA_cbSize = allot( DWord ), NOTIFYICONDATA_hWnd = allot( HndlAddr ), NOTIFYICONDATA_uID = allot( Long ), NOTIFYICONDATA_uFlags = allot( Long ), NOTIFYICONDATA_uCallbackMessage = allot( Long ), NOTIFYICONDATA_hIcon = allot( HndlAddr ), NOTIFYICONDATA_szTip = allot( {64, Strz} ), SIZEOF_NOTIFYICONDATA = allotted_size() function struct_NOTIFYICONDATA( atom hWnd, atom uID, atom uFlags, atom uCallbackMessage, atom hIcon, sequence szTip ) atom nid nid = acquire_mem(0, SIZEOF_NOTIFYICONDATA ) store( nid, NOTIFYICONDATA_cbSize, SIZEOF_NOTIFYICONDATA ) store( nid, NOTIFYICONDATA_hWnd, hWnd ) store( nid, NOTIFYICONDATA_uID, uID ) store( nid, NOTIFYICONDATA_uFlags ) store( nid, NOTIFYICONDATA_uCallbackMessage ) store( nid, NOTIFYICONDATA_hIcon, hIcon ) store( nid, NOTIFYICONDATA_szTip, szTip ) return nid end function To initialize and use the struct: atom struct, mset struct = struct_NOTIFYICONDATA( hWnd, uID, uFlags, uCallbackMessage, hIcon, szTip ) mset = new_memset() manage_mem( mset, struct ) ..do stuff release_mem( mset ) > > Also , i tried to add the FlashWindow(hwnd) function in > win32lib.ew, i > think > > it's exactly the same way as ShowWindow() . > > This doesn't seem to work either. (window caption bar does > not flash .) It looks like there are two parameters for FlashWindow. Here's how you should register the function: --BOOL FlashWindow( -- HWND hWnd, // handle of window to flash -- BOOL bInvert // flash status -- ); constant FlashWindow = registerw32Func( user32, "FlashWindow", { C_LONG, C_SHORT }, C_SHORT ) So to call, you need to supply the handle of the window, and the flash status: Parameters hWnd Identifies the window to be flashed. The window can be either open or minimized (iconic). bInvert Specifies whether the window is to be flashed or returned to its original state. The window is flashed from one state to the other if this parameter is TRUE. If it is FALSE, the window is returned to its original state (either active or inactive). Windows NT: If the window is iconic, this parameter is ignored. Windows 95: When an application is iconic, the fInvert parameter is not ignored. If this parameter is TRUE, the taskbar icon window flashes active/inactive. Matt Lewis