Windows API (VB)

VB 范例金典

1-1

Private Declare Function CreatePolygonRgn Lib "gdi32" (lpPoint As POINTAPI, ByVal nCount As Long, ByVal nPolyFillMode As Long) As Long
Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long

1-2

Private Declare Function FlashWindow Lib "user32" (ByVal hwnd As Long, ByVal bInvert As Long) As Long

1-4

Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" _
(ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _
(ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Const GWL_EXSTYLE = (-20)
Const WS_EX_TRANSPARENT = &H20&

 1-5

Private Declare Function CreateRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function CombineRgn Lib "gdi32" (ByVal hDestRgn As Long, ByVal hSrcRgn1 As Long, ByVal hSrcRgn2 As Long, ByVal nCombineMode As Long) As Long
Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Long) As Long

Const RGN_DIFF = 4  

1-6

Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)Me.PaintPicture Picture1.Picture, i * 10, 0, , , i * 10, 10, 10, Me.Height, vbSrcCopy

 1-8

Private 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

SetWindowPos(Me.hwnd, -1, 0, 0, 0, 0, 3) ‘’设置窗体总是最前

SetWindowPos(Me.hwnd, -2, 0, 0, 0, 0, 3)  ''取消设置

1-10

MDI form

Project-> add mdi  

Dim NewDocument As New ChildForm '﹚'新建子窗口
NewDocument.Show

 ParentForm.arrange vbTileVertical

ParentForm.arrange vbTileHorizontal

1-11

Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long

Private Const WM_SYSCOMMAND = &H112   ‘移动指令
Private Const SC_MOVE = &HF010&
Private Const HTCAPTIO = 2

原文地址:https://www.cnblogs.com/gosteps/p/3060718.html