32 bit 64 bit sorunu

polis-53

Altın Üye
Katılım
26 Aralık 2008
Mesajlar
1,118
Excel Vers. ve Dili
EXCEL 2016 TÜRKÇE
Altın Üyelik Bitiş Tarihi
23-02-2025
aşağıdaki kod 32 bit le çaılşıyor 64 bit le çalışmıyor
Kod:
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 Declare Function SetWindowPos Lib "user32" _
                                      (ByVal hWnd As Long, _
                                       ByVal hWndInsertAfter As Long, _
                                       ByVal X As Long, _
                                       ByVal Y As Long, _
                                       ByVal cx As Long, _
                                       ByVal cy As Long, _
                                       ByVal wFlags As Long) As Long
Private Declare Function FindWindow Lib "user32" _
                                    Alias "FindWindowA" _
                                    (ByVal lpClassName As String, _
                                     ByVal lpWindowName As String) As Long
Private Declare Function GetActiveWindow Lib "user32.dll" _
                                         () As Long
Private Declare Function SendMessage Lib "user32" _
                                     Alias "SendMessageA" _
                                     (ByVal hWnd As Long, _
                                      ByVal wMsg As Long, _
                                      ByVal wParam As Long, _
                                      lParam As Any) As Long
Private Declare Function DrawMenuBar Lib "user32" _
                                     (ByVal hWnd As Long) As Long
'Constants
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOSIZE = &H1
Private Const GWL_EXSTYLE = (-20)
Private Const HWND_TOP = 0
Private Const SWP_NOACTIVATE = &H10
Private Const SWP_HIDEWINDOW = &H80
Private Const SWP_SHOWWINDOW = &H40
Private Const WS_EX_APPWINDOW = &H40000
Private Const GWL_STYLE = (-16)
Private Const WS_MINIMIZEBOX = &H20000
Private Const SWP_FRAMECHANGED = &H20
Private Const WM_SETICON = &H80
Private Const ICON_SMALL = 0&
Private Const ICON_BIG = 1&
 

klop01

Altın Üye
Katılım
19 Aralık 2016
Mesajlar
638
Excel Vers. ve Dili
2021 Türkçe 64 Bit
Altın Üyelik Bitiş Tarihi
07-02-2028
İyi akşamlar,

Ben de geçen gün bir yerde rastladım böyle bir soruna.

Kodunuzdaki Declare deyimi ile ilgili bir sıkıntı. Koda küçük bir ekle çözümlenebiliyor sanırsam.

Aşağıdaki linkte yeterli bilgi var(Link google çeviridir.).
https://translate.google.com.tr/translate?sl=en&tl=tr&js=y&prev=_t&hl=tr&ie=UTF-8&u=https://msdn.microsoft.com/en-us/VBA/Language-Reference-VBA/articles/64-bit-visual-basic-for-applications-overview&edit-text=&act=url

İngilizcesi:
https://msdn.microsoft.com/en-us/VBA/Language-Reference-VBA/articles/64-bit-visual-basic-for-applications-overview

ŞU ŞEKİLDE OLUYOR GALİBA(KIRMIZI YERLER EKLENDİ.).

Kod:
Private Declare [COLOR="Red"]PtrSafe[/COLOR] Function GetWindowLong Lib "user32" _
                                       Alias "GetWindowLongA" _
                                       (ByVal hWnd As Long, _
                                        ByVal nIndex As Long) As Long
Private Declare [COLOR="Red"]PtrSafe[/COLOR] Function SetWindowLong Lib "user32" _
                                       Alias "SetWindowLongA" _
                                       (ByVal hWnd As Long, _
                                        ByVal nIndex As Long, _
                                        ByVal dwNewLong As Long) As Long
Private Declare [COLOR="Red"]PtrSafe[/COLOR] Function SetWindowPos Lib "user32" _
                                      (ByVal hWnd As Long, _
                                       ByVal hWndInsertAfter As Long, _
                                       ByVal X As Long, _
                                       ByVal Y As Long, _
                                       ByVal cx As Long, _
                                       ByVal cy As Long, _
                                       ByVal wFlags As Long) As Long
Private Declare [COLOR="Red"]PtrSafe[/COLOR] Function FindWindow Lib "user32" _
                                    Alias "FindWindowA" _
                                    (ByVal lpClassName As String, _
                                     ByVal lpWindowName As String) As Long
Private Declare [COLOR="Red"]PtrSafe[/COLOR] Function GetActiveWindow Lib "user32.dll" _
                                         () As Long
Private Declare [COLOR="Red"]PtrSafe[/COLOR] Function SendMessage Lib "user32" _
                                     Alias "SendMessageA" _
                                     (ByVal hWnd As Long, _
                                      ByVal wMsg As Long, _
                                      ByVal wParam As Long, _
                                      lParam As Any) As Long
Private Declare [COLOR="Red"]PtrSafe[/COLOR] Function DrawMenuBar Lib "user32" _
                                     (ByVal hWnd As Long) As Long
'Constants
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOSIZE = &H1
Private Const GWL_EXSTYLE = (-20)
Private Const HWND_TOP = 0
Private Const SWP_NOACTIVATE = &H10
Private Const SWP_HIDEWINDOW = &H80
Private Const SWP_SHOWWINDOW = &H40
Private Const WS_EX_APPWINDOW = &H40000
Private Const GWL_STYLE = (-16)
Private Const WS_MINIMIZEBOX = &H20000
Private Const SWP_FRAMECHANGED = &H20
Private Const WM_SETICON = &H80
Private Const ICON_SMALL = 0&
Private Const ICON_BIG = 1&
 
Son düzenleme:

polis-53

Altın Üye
Katılım
26 Aralık 2008
Mesajlar
1,118
Excel Vers. ve Dili
EXCEL 2016 TÜRKÇE
Altın Üyelik Bitiş Tarihi
23-02-2025
teşekkür ederim işimi gördü
 
Katılım
24 Nisan 2005
Mesajlar
3,671
Excel Vers. ve Dili
Office 2016 EN 64 Bit
Altın Üyelik Bitiş Tarihi
25/05/2022
Tanımları aşağıdaki yapıda yaparsanız hem 32 bit de hemde 64 Bit de çalışır.
Bu kodları Module deki sayfanın başına ekleyin.
Örnek;

Kod:
 #If VBA7 Then
      Private Declare [B][COLOR=Red]PtrSafe[/COLOR][/B] Function ScreenResolution Lib "User32.DLL" Alias "GetSystemMetrics" (ByVal nIndex As Long) As Long
 #Else
      Private Declare Function ScreenResolution Lib "User32.DLL" Alias "GetSystemMetrics" (ByVal nIndex As Long) As Long
 #End If
 
Katılım
28 Mart 2005
Mesajlar
6
İyi akşamlar,

Ben de geçen gün bir yerde rastladım böyle bir soruna.

Kodunuzdaki Declare deyimi ile ilgili bir sıkıntı. Koda küçük bir ekle çözümlenebiliyor sanırsam.

Aşağıdaki linkte yeterli bilgi var(Link google çeviridir.).
https://translate.google.com.tr/translate?sl=en&tl=tr&js=y&prev=_t&hl=tr&ie=UTF-8&u=https://msdn.microsoft.com/en-us/VBA/Language-Reference-VBA/articles/64-bit-visual-basic-for-applications-overview&edit-text=&act=url

İngilizcesi:
https://msdn.microsoft.com/en-us/VBA/Language-Reference-VBA/articles/64-bit-visual-basic-for-applications-overview

ŞU ŞEKİLDE OLUYOR GALİBA(KIRMIZI YERLER EKLENDİ.).

Kod:
Private Declare [COLOR="Red"]PtrSafe[/COLOR] Function GetWindowLong Lib "user32" _
                                       Alias "GetWindowLongA" _
                                       (ByVal hWnd As Long, _
                                        ByVal nIndex As Long) As Long
Private Declare [COLOR="Red"]PtrSafe[/COLOR] Function SetWindowLong Lib "user32" _
                                       Alias "SetWindowLongA" _
                                       (ByVal hWnd As Long, _
                                        ByVal nIndex As Long, _
                                        ByVal dwNewLong As Long) As Long
Private Declare [COLOR="Red"]PtrSafe[/COLOR] Function SetWindowPos Lib "user32" _
                                      (ByVal hWnd As Long, _
                                       ByVal hWndInsertAfter As Long, _
                                       ByVal X As Long, _
                                       ByVal Y As Long, _
                                       ByVal cx As Long, _
                                       ByVal cy As Long, _
                                       ByVal wFlags As Long) As Long
Private Declare [COLOR="Red"]PtrSafe[/COLOR] Function FindWindow Lib "user32" _
                                    Alias "FindWindowA" _
                                    (ByVal lpClassName As String, _
                                     ByVal lpWindowName As String) As Long
Private Declare [COLOR="Red"]PtrSafe[/COLOR] Function GetActiveWindow Lib "user32.dll" _
                                         () As Long
Private Declare [COLOR="Red"]PtrSafe[/COLOR] Function SendMessage Lib "user32" _
                                     Alias "SendMessageA" _
                                     (ByVal hWnd As Long, _
                                      ByVal wMsg As Long, _
                                      ByVal wParam As Long, _
                                      lParam As Any) As Long
Private Declare [COLOR="Red"]PtrSafe[/COLOR] Function DrawMenuBar Lib "user32" _
                                     (ByVal hWnd As Long) As Long
'Constants
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOSIZE = &H1
Private Const GWL_EXSTYLE = (-20)
Private Const HWND_TOP = 0
Private Const SWP_NOACTIVATE = &H10
Private Const SWP_HIDEWINDOW = &H80
Private Const SWP_SHOWWINDOW = &H40
Private Const WS_EX_APPWINDOW = &H40000
Private Const GWL_STYLE = (-16)
Private Const WS_MINIMIZEBOX = &H20000
Private Const SWP_FRAMECHANGED = &H20
Private Const WM_SETICON = &H80
Private Const ICON_SMALL = 0&
Private Const ICON_BIG = 1&
Benim de benzer bir sorunım var. Yardımcı olursanız sevinirim.
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetActiveWindow Lib "user32" () 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 Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" _
(ByVal hWnd As Long, _
ByVal nIndex As Long) As Long
Private Declare Function DrawMenuBar Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function SetLayeredWindowAttributes Lib "user32" _
(ByVal hWnd As Long, _
ByVal crKey As Integer, _
ByVal bAlpha As Integer, _
ByVal dwFlags As Long) As Long
 
Üst