投稿日 | : 2003/11/22(Sat) 01:43 |
投稿者 | : Starfish |
Eメール | : |
URL | : |
タイトル | : Re: 親フォームのように設定したい |
MSDNでは、以下の記述がありますが、SetWindowLong 関数でそれなりに動くようです。
You must not call SetWindowLong with the GWL_HWNDPARENT index to change the parent
of a child window. Instead, use the SetParent function.
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _
(ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Const GWL_HWNDPARENT = (-8)
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Sub Command1_Click()
Dim lngReturnValue As Long
Dim lngHwnd As Long
lngHwnd = FindWindow(vbNullString, "無題 - メモ帳")
lngReturnValue = SetWindowLong(Me.hwnd, GWL_HWNDPARENT, lngHwnd)
End Sub
マイクロソフトで使うなといっているので、使う場合は十分に検証をしてください。