首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

如何才能实现这个功能呢?

2012-02-03 
怎么才能实现这个功能呢???我用以下代码现实了最小化到系统栏里,但同时又想调整窗体,应该怎么做??Module1P

怎么才能实现这个功能呢???
我用以下代码现实了最小化到系统栏里,但同时又想调整窗体,应该怎么做??

' ' ' ' ' 'Module1

Public   Type   NOTIFYICONDATA
        cbSize   As   Long
        hwnd   As   Long
        uID   As   Long
        uFlags   As   Long
        uCallbackMessage   As   Long
        hIcon   As   Long
        szTip   As   String   *   64
End   Type

Public   Declare   Function   Shell_NotifyIcon   Lib   "shell32.dll "   Alias   "Shell_NotifyIconA "   (ByVal   dwMessage   As   Long,   lpData   As   NOTIFYICONDATA)   As   Long
Public   Declare   Function   GetWindowLong   Lib   "user32 "   Alias   "GetWindowLongA "   (ByVal   hwnd   As   Long,   ByVal   nIndex   As   Long)   As   Long
Public   Declare   Function   SetWindowLong   Lib   "user32 "   Alias   "SetWindowLongA "   (ByVal   hwnd   As   Long,   ByVal   nIndex   As   Long,   ByVal   dwNewLong   As   Long)   As   Long
Public   Declare   Function   CallWindowProc   Lib   "user32 "   Alias   "CallWindowProcA "   (ByVal   lpPrevWndFunc   As   Long,   ByVal   hwnd   As   Long,   ByVal   Msg   As   Long,   ByVal   wParam   As   Long,   ByVal   lParam   As   Long)   As   Long
Public   Declare   Function   SetForegroundWindow   Lib   "user32 "   (ByVal   hwnd   As   Long)   As   Long

Public   Const   NIM_ADD   =   &H0
Public   Const   NIM_MODIFY   =   &H1
Public   Const   NIM_DELETE   =   &H2
Public   Const   WM_MOUSEMOVE   =   &H200
Public   Const   WM_USER   =   &H400
Public   Const   WM_NOTIFYICON   =   WM_USER   +   &H100
Public   Const   NIF_MESSAGE   =   &H1
Public   Const   NIF_ICON   =   &H2
Public   Const   NIF_TIP   =   &H4
Public   Const   uID   =   830214
Public   Const   GWL_WNDPROC   =   -4
Public   Const   WM_LBUTTONDOWN   =   &H201
Public   Const   WM_LBUTTONDBLCLK   =   &H203
Public   Const   WM_RBUTTONDOWN   =   &H204
Public   Const   WM_RBUTTONUP   =   &H205
Public   Const   WM_NCLBUTTONDBLCLK   =   &HA3

Public   pnid   As   NOTIFYICONDATA
Public   lpPrevWndFunc   As   Long

Public   Function   WindowProc(ByVal   hwnd   As   Long,   ByVal   uMsg   As   Long,   ByVal   wParam   As   Long,   ByVal   lParam   As   Long)   As   Long
        If   hwnd   =   Form1.hwnd   And   uMsg   =   WM_USER   +   100   Then
                Select   Case   lParam
                        Case   WM_LBUTTONDOWN


                                '左击图标代码,如   PopupMenu   mnu
                        Case   WM_LBUTTONDBLCLK
                                Form1.WindowState   =   vbNormal
                                Form1.Show
                                '左双击图标代码,如   PopupMenu   mnu
                        Case   WM_RBUTTONDOWN
                                Call   SetForegroundWindow(Form1.hwnd)
                                Form1.PopupMenu   Form1.mnu
                                '右击图标代码,如   PopupMenu   mnu
                End   Select
        Else
                WindowProc   =   CallWindowProc(lpPrevWndFunc,   Form1.hwnd,   uMsg,   wParam,   lParam)
        End   If
End   Function


' ' ' ' ' ' 'form1
Private   Sub   Form_Load()
        lpPrevWndFunc   =   GetWindowLong(Me.hwnd,   GWL_WNDPROC)
        Call   SetWindowLong(Me.hwnd,   GWL_WNDPROC,   AddressOf   WindowProc)
        With   pnid
                .cbSize   =   Len(pnid)
                .hwnd   =   Form1.hwnd
                .uID   =   uID
                .uFlags   =   NIF_MESSAGE   Or   NIF_ICON   Or   NIF_TIP
                .uCallbackMessage   =   WM_USER   +   100
                .hIcon   =   Me.Icon
                .szTip   =   "Hello!   Everyone! "   &   Chr$(0)
        End   With
        Shell_NotifyIcon   NIM_ADD,   pnid
End   Sub

Private   Sub   mnuTRY1_Click()
frmAbout.Show   vbModal,   Me
End   Sub
Private   Sub   Form_QueryUnload(Cancel   As   Integer,   UnloadMode   As   Integer)
        Call   Shell_NotifyIcon(NIM_DELETE,   pnid)
        pnid.uID   =   vbNull
        Call   SetWindowLong(Form1.hwnd,   GML_WNDPROC,   lpPrevWndFunc)
End   Sub

Private   Sub   Form_Resize()
        If   Me.WindowState   =   vbMinimized   Then   Me.Hide
End   Sub
同时我用了TIMER控件,当时间到的时候就     FORM1.HEIGHT=600



怎么才能实现这个功能呢???


[解决办法]
问题写得真让人摸不着头脑···表达差强人意点了···

不明白说什么
[解决办法]
...想想你窗体怎么还原的。。。
[解决办法]
UP
[解决办法]
没看明白什么意思.....

偶从小语文学得X.......

热点排行