4. YOL
Bir Modül Oluşturup Aşağıdaki Kodu yapıştırın.
Private Declare Function IsWindowVisible Lib "user32" (ByVal hwnd As Long) As Long
Dim dwReturn As Long
Const SW_HIDE = 0
Const SW_SHOWNORMAL = 1
Const SW_SHOWMINIMIZED = 2
Const SW_SHOWMAXIMIZED = 3
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, _
ByVal nCmdShow As Long) As Long
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 Const WS_EX_APPWINDOW = &H40000
Private Const GWL_STYLE = -20
Public Function ShowInTaskbar(Lhwnd As Long, Show As Boolean)
Dim lStyle As Long
lStyle = GetWindowLong(Lhwnd, GWL_STYLE)
If Show Then
lStyle = lStyle Or WS_EX_APPWINDOW
Else
lStyle = lStyle And Not WS_EX_APPWINDOW
End If
Call SetWindowLong(Lhwnd, GWL_STYLE, lStyle)
End Function
Public Function fAccessWindow(Optional Procedure As String, Optional SwitchStatus As Boolean, Optional StatusCheck As Boolean) As Boolean
If Procedure = "Hide" Then
dwReturn = ShowWindow(Application.hWndAccessApp, SW_HIDE)
End If
If Procedure = "Show" Then
dwReturn = ShowWindow(Application.hWndAccessApp, SW_SHOWMAXIMIZED)
End If
If Procedure = "Minimize" Then
dwReturn = ShowWindow(Application.hWndAccessApp, SW_SHOWMINIMIZED)
End If
If SwitchStatus = True Then
If IsWindowVisible(hWndAccessApp) = 1 Then
dwReturn = ShowWindow(Application.hWndAccessApp, SW_HIDE)
Else
dwReturn = ShowWindow(Application.hWndAccessApp, SW_SHOWMAXIMIZED)
End If
End If
If StatusCheck = True Then
If IsWindowVisible(hWndAccessApp) = 0 Then
fAccessWindow = False
End If
If IsWindowVisible(hWndAccessApp) = 1 Then
fAccessWindow = True
End If
End If
End Function
Açılış formuna veya tüm formların açıldığında olayına aşağıdaki kodu ekleyin.
Call fAccessWindow("Hide", False, True)
ShowInTaskbar Me.hwnd, True
Not: 64 bit ofis programı kullanan arkadaşlar
Public Function,
Private Declare Function alanlarının
Function önüne PtrSafe yazsınlar.
64 Bit = Private Declare PtrSafe Function
32 Bit = Private Declare Function