ahmed_ummu
Altın Üye
- Katılım
- 28 Mart 2011
- Mesajlar
- 750
- Excel Vers. ve Dili
- Excel 2010 Professional Plus 64 Bit
- Altın Üyelik Bitiş Tarihi
- 15-10-2026
Merhaba arkadaşlar.
Üzerinde çalıştığım dosyadaki Ana Userform da aşağıdaki kodlar var. General kısmında. 32 ve 64 bit bilgisayarlarda çalışması için. Benim bilgisayarımda bir sorun çıkmıyor ama başka bilgisayarda çalıştırdığımda aşağıdaki bütün kodlar kırmızı renkli oluyor. Ve tabiki hata verip çalışmıyor. Declare ile Function arasındaki PtrSafe kodunu silince düzeliyor. (Tüm PtrSAfe) kodlarını. Düzeltmeyi yapınca bu kez benim bilgisayarada çalıştırınca yine kodlar kırmızı oluyor. Bu kez de PtrSafe kodunu ekleyince çalışıyuor. Bunu tamamen düzeltmenin bir yolu varmı. Yardımcı olursanız sevinirim.
'64 ve 32 bit çalıştırma
#If Win64 Then
Private Declare PtrSafe Function CreateMenu Lib "user32" () As LongLong
Private Declare PtrSafe Function AppendMenu Lib "user32" Alias "AppendMenuA" _
(ByVal hMenu As LongLong, ByVal wFlags As Long, ByVal wIDNewItem As LongLong, _
ByVal lpNewItem As String) As Long
Private Declare PtrSafe Function SetMenu Lib "user32" _
(ByVal hWnd As LongLong, ByVal hMenu As LongLong) As Long
Private Declare PtrSafe Function DestroyMenu Lib "user32" _
(ByVal hMenu As LongLong) As Long
Private Declare PtrSafe Function SetWindowPos Lib "user32" _
(ByVal hWnd As LongLong, ByVal hWndInsertAfter As LongLong, ByVal X As Long, ByVal Y As Long, _
ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Declare PtrSafe Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As LongLong
Private Declare PtrSafe Function SetWindowLongPtr Lib "user32" Alias "SetWindowLongPtrA" _
(ByVal hWnd As LongLong, ByVal nIndex As Long, _
ByVal dwNewLong As LongLong) As LongLong
Private hForm As LongLong, g_hMenu As LongLong
#ElseIf Win32 Then
Private Declare PtrSafe Function CreateMenu Lib "user32" () As Long
Private Declare PtrSafe Function AppendMenu Lib "user32" Alias "AppendMenuA" _
(ByVal hMenu As Long, ByVal wFlags As Long, ByVal wIDNewItem As Long, _
ByVal lpNewItem As String) As Long
Private Declare PtrSafe Function SetMenu Lib "user32" _
(ByVal hWnd As Long, ByVal hMenu As Long) As Long
Private Declare PtrSafe Function DestroyMenu Lib "user32" _
(ByVal hMenu As Long) As Long
Private Declare PtrSafe Function SetWindowPos Lib "user32" _
(ByVal hWnd As Long, hWndInsertAfter As Long, X As Long, Y As Long, _
cx As Long, cy As Long, uFlags As Long) As Boolean
Private Declare PtrSafe Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare PtrSafe Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _
(ByVal hWnd As Long, ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Private hForm As Long, g_hMenu As Long
#End If
Dim isFormLoaded As Boolean
Private Const MF_SEPARATOR = &H800&
Private Const MF_POPUP = &H10
Private Const MF_STRING = &H0
Private Const MF_BYPOSITION = &H400&
'Buraya kadar
Private Declare PtrSafe Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
Private Declare PtrSafe Function FindWindowA Lib "user32" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare PtrSafe Function EnableWindow Lib "user32" (ByVal hWnd As Long, ByVal bEnable As Long) As Long
Private Declare PtrSafe Function GetWindowLongA Lib "user32" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare PtrSafe Function SetWindowLongA Lib "user32" (ByVal hWnd As Long, ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Üzerinde çalıştığım dosyadaki Ana Userform da aşağıdaki kodlar var. General kısmında. 32 ve 64 bit bilgisayarlarda çalışması için. Benim bilgisayarımda bir sorun çıkmıyor ama başka bilgisayarda çalıştırdığımda aşağıdaki bütün kodlar kırmızı renkli oluyor. Ve tabiki hata verip çalışmıyor. Declare ile Function arasındaki PtrSafe kodunu silince düzeliyor. (Tüm PtrSAfe) kodlarını. Düzeltmeyi yapınca bu kez benim bilgisayarada çalıştırınca yine kodlar kırmızı oluyor. Bu kez de PtrSafe kodunu ekleyince çalışıyuor. Bunu tamamen düzeltmenin bir yolu varmı. Yardımcı olursanız sevinirim.
'64 ve 32 bit çalıştırma
#If Win64 Then
Private Declare PtrSafe Function CreateMenu Lib "user32" () As LongLong
Private Declare PtrSafe Function AppendMenu Lib "user32" Alias "AppendMenuA" _
(ByVal hMenu As LongLong, ByVal wFlags As Long, ByVal wIDNewItem As LongLong, _
ByVal lpNewItem As String) As Long
Private Declare PtrSafe Function SetMenu Lib "user32" _
(ByVal hWnd As LongLong, ByVal hMenu As LongLong) As Long
Private Declare PtrSafe Function DestroyMenu Lib "user32" _
(ByVal hMenu As LongLong) As Long
Private Declare PtrSafe Function SetWindowPos Lib "user32" _
(ByVal hWnd As LongLong, ByVal hWndInsertAfter As LongLong, ByVal X As Long, ByVal Y As Long, _
ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Declare PtrSafe Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As LongLong
Private Declare PtrSafe Function SetWindowLongPtr Lib "user32" Alias "SetWindowLongPtrA" _
(ByVal hWnd As LongLong, ByVal nIndex As Long, _
ByVal dwNewLong As LongLong) As LongLong
Private hForm As LongLong, g_hMenu As LongLong
#ElseIf Win32 Then
Private Declare PtrSafe Function CreateMenu Lib "user32" () As Long
Private Declare PtrSafe Function AppendMenu Lib "user32" Alias "AppendMenuA" _
(ByVal hMenu As Long, ByVal wFlags As Long, ByVal wIDNewItem As Long, _
ByVal lpNewItem As String) As Long
Private Declare PtrSafe Function SetMenu Lib "user32" _
(ByVal hWnd As Long, ByVal hMenu As Long) As Long
Private Declare PtrSafe Function DestroyMenu Lib "user32" _
(ByVal hMenu As Long) As Long
Private Declare PtrSafe Function SetWindowPos Lib "user32" _
(ByVal hWnd As Long, hWndInsertAfter As Long, X As Long, Y As Long, _
cx As Long, cy As Long, uFlags As Long) As Boolean
Private Declare PtrSafe Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare PtrSafe Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _
(ByVal hWnd As Long, ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Private hForm As Long, g_hMenu As Long
#End If
Dim isFormLoaded As Boolean
Private Const MF_SEPARATOR = &H800&
Private Const MF_POPUP = &H10
Private Const MF_STRING = &H0
Private Const MF_BYPOSITION = &H400&
'Buraya kadar
Private Declare PtrSafe Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
Private Declare PtrSafe Function FindWindowA Lib "user32" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare PtrSafe Function EnableWindow Lib "user32" (ByVal hWnd As Long, ByVal bEnable As Long) As Long
Private Declare PtrSafe Function GetWindowLongA Lib "user32" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare PtrSafe Function SetWindowLongA Lib "user32" (ByVal hWnd As Long, ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long