当前位置: 代码迷 >> PB >> 最小化图标消失,该怎么解决
  详细解决方案

最小化图标消失,该怎么解决

热度:31   发布时间:2016-04-29 06:01:30.0
最小化图标消失
我用pb做了一个能最小化到托盘的程序,但是当鼠标移动到图标上时,图标就消失,为什么呢?
附程序:(也是在csdn上淘的)
新建一个窗口w_main   
    
  首先定义Global   External   Functions   
  Public   Function   Integer   Shell_NotifyIcon   (Long   dwMessage,   Any   lpData)   Library   "shell32"   Alias   For   "Shell_NotifyIconA"   
  Public   Function   Long   LoadImage   (Long   hInst,   String   lpsz,   Long   un1,   Long   n1,   Long   n2,   Long   un2)   Library   "user32"   Alias     For   "LoadImageA"     
  Public   Function   Long   DestroyIcon   (Long   hIcon)   Library   "user32"   Alias   For   "DestroyIcon"   
  Public   Function   Long   SetForegroundWindow     (Long   hwnd)   Library   "user32"   Alias   For   "SetForegroundWindow"   
  Public   Function   Long   OpenIcon     (Long   hwnd)   Library   "user32"   Alias   For   "OpenIcon"   
  Public   Function   Long   ShowWindow   (Long   hWnd,   Long   nCmdShow   )   Library   "user32"   Alias   For   "ShowWindow"   
    
  然后定义Instance   Variables   
  Constant   Long   NIM_ADD   =   0   
  Constant   Long   NIM_MODIFY   =   1   
  Constant   Long   NIM_DELETE   =   2   
  Constant   Long   NIF_MESSAGEorNIF_ICONorNIF_TIP   =   7   
  Constant   Long   WM_MOUSEMOVE   =   512   
  Constant   Long   IMAGE_ICON   =   1   
  Constant   Long   LR_LOADFROMFILE   =   16   
  Long   hIcon   
  Boolean   CanClose   
    
  然后定义1个window   structure   
  名称:notifyicondata   
  内容:   
  long cbsize   
  long hwnd   
  long uid   
  long uflags   
  long ucallbackmessage   
  long hicon   
  Any szTip   
    
  然后定义3个window   function   
  1、函数名:setnotifyicondata     
  返回值:notifyicondata   
  参数为   
  integer   hwnd     
  integer   id     
  long   flags     
  long   callbackmessage     
  long   icon     
  string   tip   
  函数体:   
  //   NotifyIconData   SetNotifyIconData   (Long   hWnd,   Long   ID,   Long   Flags,   Long   CallbackMessage,   Long   Icon,   String   Tip)   
    
  Char   MyTip   [64]   
    
  NotifyIconData   NidTemp   
      
  NidTemp.cbSize   =   88   //   Len   (NidTemp)   
  NidTemp.hWnd   =   hWnd   
  NidTemp.uID   =   ID   
  NidTemp.uFlags   =   Flags   
  NidTemp.uCallbackMessage   =   CallbackMessage   
  NidTemp.hIcon   =   Icon   
  相关解决方案