-1-
-2-
كيفية كتابة الكود اذا كان نظام اوفيس 64 او 32 بت Function if Office 64 bit or 32 bit
\\\\\\\\\\\\\\\\\\\\\\\\\\
كيفية كتابة الكود اذا كان نظام اوفيس 64 او 32 بت Function if Office 64 bit or 32 bit
ان الكود في بيئة العمل 64 بت تتطلب اضافة كلمة PtrSafe قبل البدء بالكود وكما يلي:
#If VBA7 Then ' ...........................................................if User Have Office 64 bit
Private Declare PtrSafe Function apiShowWindow Lib "user32" _
Alias "ShowWindow" (ByVal hwnd As Long, _
ByVal nCmdShow As Long) As Long
#Else ' .................................................................. if User Have Office 32 bit
Private Declare Function apiShowWindow Lib "user32" _
Alias "ShowWindow" (ByVal hwnd As Long, _
ByVal nCmdShow As Long) As Long
#End If
نكتب هذه الكلمة فى حالة نظام 64 بت
\PtrSafe
\\\\\\\\\\\\\\\\\\\\\\\\\\\
كود الاخفاء
\\\\\\\\\\\\\\\\\\\\\\\\\\
الاستدعاء
\\\\\\\\\\\\\\\\\\\
نكتب هذه الكلمة فى حالة نظام 64 بت
\PtrSafe
\\\\\\\\\\\\\\\\\\\\\\\\\\\
كود الاخفاء
\\\\\\\\\\\\\\\\\\\\\
Option Compare Database
Option Explicit
Global Const SW_HIDE = 0
Global Const SW_SHOWNORMAL = 1
Global Const SW_SHOWMINIMIZED = 2
Global Const SW_SHOWMAXIMIZED = 3
Private Declare PtrSafe Function apiShowWindow Lib "user32" _
Alias "ShowWindow" (ByVal hwnd As Long, _
ByVal nCmdShow As Long) As Long
Function fSetAccessWindow(nCmdShow As Long)
Dim loX As Long
Dim loForm As Form
On Error Resume Next
Set loForm = Screen.ActiveForm
If Err <> 0 Then
loX = apiShowWindow(hWndAccessApp, nCmdShow)
Err.Clear
End If
If nCmdShow = SW_SHOWMINIMIZED And loForm.Modal = True Then
MsgBox "Cannot minimize Access with " _
& (loForm.Caption + " ") _
& "form on screen"
ElseIf nCmdShow = SW_HIDE And loForm.PopUp <> True Then
MsgBox "Cannot hide Access with " _
& (loForm.Caption + " ") _
& "form on screen"
Else
loX = apiShowWindow(hWndAccessApp, nCmdShow)
End If
fSetAccessWindow = (loX <> 0)
End Function
\\\\\\\\\\\\\\\\\\\\\\\\\\
الاستدعاء
\\\\\\\\\\\\\\\\\\\
Option Compare Database
Private Sub Form_Current()
'DoCmd.SetWarnings False
fSetAccessWindow (SW_SHOWMINIMIZED)
End Sub
Private Sub Form_Load()
'DoCmd.SetWarnings False
'DoCmd.Maximize
End Sub
-3-
-4-