2011-03-09 3 views
0

fAccessWindow 제공합니다 ("숨기기", 거짓, 거짓) 실제 액세스 창을 숨기는 기능은 내가 공백없이 시도 컴파일 오류 번호 7960fAccessWindow ("숨기기", 거짓, 거짓이) 컴파일 오류를

"fAccessWindow를 ("제공 Hide ", False, False)"하지만 차이는 없습니다. 나는 또한 here 찾을 수있는 모듈 아래 코드가 있습니다. 가장 낮은 수준의 매크로 보안으로 Access 2010을 사용하고 있습니다. 또한 내 운영 체제는 x64입니다.

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 

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 
+0

첫째, 당신은 컴파일 오류의 원인이 말하는 코드를 표시하지 않는 : 당신이해야 할 경우 나에게 분명하지 않다 :

#If Win64 And VBA7 Then ... #Else ... #End If 

를하거나 할 필요가있는 경우 호출되는 코드를 보여 주지만 오류를 생성하는 코드는 호출하지 않습니다.); 둘째, 실제 오류 메시지가 표시되지 않습니다. 사람들이 당신을 도울 수 있도록 그 세부 사항을 제공하십시오. –

+0

"이 함수를 컴파일하는 중 오류가 발생했습니다"매크로 이름, 작업 이름 "RunCode", 인수 "fAccessWindow ("숨김, 거짓, 거짓) "오류 번호"7960 " –

답변

2

는 또한 새로운 LONGLONG 데이터 형식을 this article from MS on 64-bit VBA를 참조 아니라 PtrSafe를 사용하지만, 필요, 당신은 조건부 컴파일 사용해야합니다 : 나는 64 프로그래밍하고 있지 않다

#if Win64 then 
     Private Declare PtrSafe Function IsWindowVisible Lib "user32" (ByVal hwnd As LongLong) As LongLong 
    #else 
     Private Declare Function IsWindowVisible Lib "user32" (ByVal hwnd As Long) As Long 
    #end if 

을 -bit Access는 이것으로 작업하지 않았습니다. Win64와 VBA7 컴파일 상수 사이의 상호 작용이 무엇인지는 분명하지 않으며 인용 된 기사에는 정확히 나와 있지 않습니다. 당신 '(

#If Win64 Then 
     #If VBA7 Then 
     ... 
     #Else 
     ... 
     #End If 
    #Else 
     #If VBA7 Then 
     ... 
     #Else 
     ... 
     #End If 
    #End If 
0

아래 기능에 PtrSafe 옵션이 추가되어 x64에서 작동하기 시작했지만 x86 컴퓨터에서 동일한 오류가 발생합니다.

Private Declare PtrSafe Function IsWindowVisible Lib "user32"_ 
    (ByVal hwnd As Long) As Long 

Private Declare PtrSafe Function ShowWindow Lib "user32" (ByVal hwnd As Long, _ 
    ByVal nCmdShow As Long) As Long 
관련 문제