Minggu, 18 September 2011

Mengubah ukuran tampilan form (Sizable toolwindow) menggunakan SetWindowLong API function

'Paste kode ini pada Modul

Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Public Const WS_EX_TOOLWINDOW = &H80&
Public Const GWL_EXSTYLE = (-20)

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 Const SWP_FRAMECHANGED = &H20
Public Const SWP_NOMOVE = &H2
Public Const SWP_NOZORDER = &H4
Public Const SWP_NOSIZE = &H1


'Paste code ini pada form code

Private Sub Form_Load()
Dim xx As Long

xx = GetWindowLong(hwnd, GWL_EXSTYLE)
xx = SetWindowLong(hwnd, GWL_EXSTYLE, _
xx Or WS_EX_TOOLWINDOW)

SetWindowPos hwnd, 0, 0, 0, 0, 0, _
SWP_FRAMECHANGED Or SWP_NOMOVE Or _
SWP_NOZORDER Or SWP_NOSIZE
End Sub

Tidak ada komentar:

Posting Komentar