키오스크 등의 프로그램을 위해 윈도우 타이틀바를 필요치 않으면 Form 속성중 BorderStyle을 0으로 설정하는데
런타임시에 Show/Hide를 하고 싶을때 아래 코드를 참고하자.
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
Private Declare Function GetWindowRect Lib "user32" _
(ByVal hwnd As Long, _
lpRect As RECT) As Long
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
Private Const GWL_STYLE = (-16)
Private Const WS_CAPTION = &HC00000 ' WS_BORDER Or WS_DLGFRAME
Private Const WS_MAXIMIZEBOX = &H10000
Private Const WS_MINIMIZEBOX = &H20000
Private Const WS_THICKFRAME = &H40000
Private Const WS_SYSMENU = &H80000
Private Const SWP_NOSIZE = &H1
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOZORDER = &H4
Private Const SWP_FRAMECHANGED = &H20
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Sub Command1_Click()
SetWindowLong Me.hwnd, GWL_STYLE, _
GetWindowLong(Me.hwnd, GWL_STYLE) And Not (WS_CAPTION)
SetWindowPos Me.hwnd, 0, 0, 0, 0, 0, _
SWP_NOSIZE Or SWP_NOMOVE Or SWP_NOZORDER Or SWP_FRAMECHANGED
End Sub
Private Sub Command2_Click()
SetWindowLong Me.hwnd, GWL_STYLE, _
GetWindowLong(Me.hwnd, GWL_STYLE) Or (WS_CAPTION)
SetWindowPos Me.hwnd, 0, 0, 0, 0, 0, _
SWP_NOSIZE Or SWP_NOMOVE Or SWP_NOZORDER Or SWP_FRAMECHANGED
End Sub
Private Sub Form_Load()
Command1.Caption = "Hide"
Command2.Caption = "Show"
End Sub
'VB6 > Interface' 카테고리의 다른 글
| 폼에 보여줄 영역 만들기(구멍난 폼) (0) | 2013.03.28 |
|---|---|
| 바탕화면 아이콘 Show/Hide (0) | 2013.03.28 |
| 폼 위치, 크기 구하기 (0) | 2013.03.27 |
| 폼 투명도 주기 (0) | 2013.03.27 |
| 폼 타이틀바 이동효과 (0) | 2013.03.26 |