[VB] 최상위 폼 설정하기

VB 2015. 5. 23. 09:00

■ 최상위 폼 설정하기 예제

----------------------------------------------------------------------------------------------------

SetTopMostForm pForm.hwnd, True ' 최상위 폼 설정하기

 

SetTopMostForm pForm.hwnd, False ' 최상위 폼 설정 취소하기

----------------------------------------------------------------------------------------------------

 

■ 최상위 폼 설정하기

----------------------------------------------------------------------------------------------------

Public Const HWND_TOPMOST = -1

Public Const HWND_NOTOPMOST = -2

 

Public Const SWP_FRAMECHANGED = &H20

Public Const SWP_NOMOVE = &H2

Public Const SWP_NOSIZE = &H1

Public Const SWP_SHOWME = SWP_FRAMECHANGED Or SWP_NOMOVE Or SWP_NOSIZE

 

Declare Function SetWindowPos Lib "user32" (ByVal lWindowHandle As Long, ByVal lInsertAfterWindowHandle As Long, ByVal lX As Long, ByVal lY As Long, ByVal lWidth As Long, ByVal lHeight As Long, ByVal lFlag As Long) As Long

 

Public Function SetTopMostForm(lWindowHandle As Long, bTopMost As Boolean)

 

    Call SetWindowPos(lWindowHandle, IIf(bTopMost, HWND_TOPMOST, HWND_NOTOPMOST), 0&, 0&, 0&, 0&, SWP_SHOWME)

 

End Function

----------------------------------------------------------------------------------------------------

Posted by 사용자 icodebroker
TAG

댓글을 달아 주세요