Option Compare Database
Option Explicit
Public Const HWND_TOP = 0
Public Const HWND_BOTTOM = 1
Public Const HWND_TOPMOST = -1
Public Const HWND_NOTOPMOST = -2
Public Const SW_SHOW = 5
Public Const SW_HIDE = 0
Public Const SWP_NOSIZE = &H1
Public Const SWP_NOMOVE = &H2
Public Const SWP_SHOWWINDOW = &H40
Public Const SW_MAXIMIZE = 3
Declare PtrSafe Function SetWindowPos Lib "user32" _
(ByVal Hwnd As LongPtr, _
ByVal hWndInsertAfter As LongPtr, _
ByVal x As Long, _
ByVal y As Long, _
ByVal cx As Long, _
ByVal cy As Long, _
ByVal wFlags As Long _
) As Long
Declare PtrSafe Function ShowWindow Lib "user32" _
(ByVal Hwnd As LongPtr, _
ByVal nCmdShow As Long _
) As Long
Option Compare Database
Option Explicit
'境界線スタイル:なし、スクロールバーとかは非表示にしておく
Private Sub Form_Close()
ShowWindow Application.hWndAccessApp, SW_SHOW
End Sub
Private Sub Form_Load()
If Not Me.PopUp Then Exit Sub
ShowWindow Application.hWndAccessApp, SW_HIDE
ShowWindow Me.Hwnd, SW_MAXIMIZE
End Sub
Private Sub cmdClose_Click()
DoCmd.Close
End Sub
Private Sub コマンド2_Click()
DoCmd.OpenForm "フォーム2"
End Sub
Private Sub Form_Load()
If Not Me.PopUp Then Exit Sub
SetWindowPos Me.Hwnd, HWND_TOPMOST, 0, 0, _
0, 0, SWP_NOSIZE Or SWP_NOMOVE Or SWP_SHOWWINDOW
End Sub
これでいいか?なんの考慮もしてない。Alt+Tabなど抑制はしない。これ以降はお好みでどうぞ。
なんの考えもなくコード書くもんじゃないと悟った夜。
0 件のコメント:
コメントを投稿