www.pudn.com > QQ2009.rar > mAPI.bas, change:2009-11-15,size:5110b


Attribute VB_Name = "mAPI" 
 
Option Explicit 
Public Enum MenuItemType 
    NormalItem 
    SplitItem 
End Enum 
 
Public Type IconStruct 
    Icon As Long 
    Width As Long 
    Height As Long 
End Type 
Public Type MenuItem 
    ID As Long 
    ItemType As MenuItemType 
    Icon As IconStruct 
    Caption As String 
    CaptionLength As Long 
    RECT As RECTF 
End Type 
Public Type POINTAPI 
    x As Long 
    y As Long 
End Type 
Public Type RECT 
    Left As Long 
    Top As Long 
    Right As Long 
    Bottom As Long 
End Type 
 
Public Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long 
Public Declare Function GetWindowRect Lib "user32" (ByVal hWnd As Long, lpRect As RECT) As Long 
Public Declare Function ReleaseCapture Lib "user32" () As Long 
Public Declare Function SetCapture Lib "user32" (ByVal hWnd As Long) As Long 
Public Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer 
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 GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex 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 SetLayeredWindowAttributes Lib "user32" (ByVal hWnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long 
Public Declare Function SetWindowPos Lib "user32" (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cX As Long, ByVal cY As Long, ByVal wFlags As Long) As Long 
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Long) As Long 
Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (pDst As Any, pSrc As Any, ByVal ByteLen As Long) 
Public Declare Sub GetMem4 Lib "msvbvm60.dll" (ByVal Address As Long, ByVal Dst As Long) 
Public Declare Sub PutMem1 Lib "msvbvm60.dll" (ByVal Address As Long, ByVal value As Byte) 
Public Declare Sub PutMem4 Lib "msvbvm60.dll" (ByVal Address As Long, ByVal value As Long) 
 
Public Const LWA_COLORKEY       As Long = &H1 
Public Const LWA_COLORKEY_ALPHA As Long = &H3 
Public Const VK_CAPITAL         As Long = &H14 
Public Const WM_NCACTIVATE      As Long = &H86 
Public Const WM_RBUTTONUP       As Long = &H205 
Public Const WM_MOUSEMOVE       As Long = &H200 
Public Const WM_KEYDOWN         As Long = &H100 
Public Const WM_KEYUP           As Long = &H101 
Public Const WS_EX_LAYERED      As Long = &H80000 
Public Const GWL_WNDPROC        As Long = (-4) 
Public Const GWL_EXSTYLE        As Long = (-20) 
 
Private Declare Function SetCursor Lib "user32" (ByVal hCursor As Long) As Long 
Private Declare Function LoadCursorBynum& Lib "user32" Alias "LoadCursorA" (ByVal hInstance As Long, ByVal lpCursorName As Long) 
Private Declare Function ShowWindow Lib "user32" (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long 
Private Const WS_EX_APPWINDOW   As Long = &H40000 
Private Const SW_HIDE           As Long = 0 
Private Const SW_SHOW           As Long = 5 
Private Const IDC_HAND          As Long = 32649& 
Private hCursor As Long 
 
Public tX As Single, tY As Single 
Public KB_PassTopMost As Boolean 
Public CL_PassTopMost As Boolean 
Public CL_Shown As Boolean 
 
Public Sub ShowInTaskBar2(ByVal hWnd As Long, ByVal fShow As Boolean) 
    Dim lExStyle As Long 
    lExStyle = GetWindowLong(hWnd, GWL_EXSTYLE) 
    lExStyle = IIf(fShow, lExStyle Or WS_EX_APPWINDOW, lExStyle And Not WS_EX_APPWINDOW) 
    ShowWindow hWnd, SW_HIDE 
    lExStyle = SetWindowLong(hWnd, GWL_EXSTYLE, lExStyle) 
    ShowWindow hWnd, SW_SHOW 
End Sub 
 
Public Sub InitHand() 
    hCursor = LoadCursorBynum&(0&, IDC_HAND) 
End Sub 
 
Public Sub SetHand() 
    SetCursor hCursor 
End Sub 
 
Public Function GetCapsLockState() As Boolean 
    GetCapsLockState = (GetKeyState(VK_CAPITAL) Mod &HFF80 = 1) 
End Function 
 
Public Sub CreateRoundRectPath(ByVal x As Single, ByVal y As Single, ByVal Width As Single, ByVal Height As Single, ByVal Arc As Single, ByRef path As Long) 
    GdipCreatePath FillModeAlternate, path 
    GdipAddPathArc path, x, y, Arc, Arc, 180, 90 
    GdipAddPathArc path, x + Width - Arc - 1, y, Arc, Arc, -90, 90 
    GdipAddPathArc path, x + Width - Arc - 1, y + Height - Arc - 1, Arc, Arc, 0, 90 
    GdipAddPathArc path, x, y + Height - Arc - 1, Arc, Arc, 90, 90 
    GdipClosePathFigure path 
End Sub 
 
Public Sub LoadImage(ByVal ImagePath As String, ByRef Ico As IconStruct) 
    GdipLoadImageFromFile StrPtr(ImagePath), Ico.Icon 
    GdipGetImageWidth Ico.Icon, Ico.Width 
    GdipGetImageHeight Ico.Icon, Ico.Height 
End Sub 
 
Sub Main() 
    InitGDIPlus token 
     
    tX = Screen.TwipsPerPixelX 
    tY = Screen.TwipsPerPixelY 
     
    InitAutoBrowser 
    InitHand 
     
    Load frmMain 
    frmMain.Show 
End Sub