Excel Forum

Excel Forum (http://www.excel.web.tr/index.php)
-   Excel'e Yeni Başlayanlar (http://www.excel.web.tr/forumdisplay.php?f=14)
-   -   32 bit 64 bit sorunu (http://www.excel.web.tr/showthread.php?t=169439)

polis-53 02-01-2018 13:46

32 bit 64 bit sorunu
 
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 02-01-2018 17:07

İ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/tran...-text=&act=url

İngilizcesi:
https://msdn.microsoft.com/en-us/VBA...tions-overview

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

Kod:

Private Declare PtrSafe Function GetWindowLong Lib "user32" _
                                      Alias "GetWindowLongA" _
                                      (ByVal hWnd As Long, _
                                        ByVal nIndex As Long) 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 Declare PtrSafe 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 PtrSafe Function FindWindow Lib "user32" _
                                    Alias "FindWindowA" _
                                    (ByVal lpClassName As String, _
                                    ByVal lpWindowName As String) As Long
Private Declare PtrSafe Function GetActiveWindow Lib "user32.dll" _
                                        () As Long
Private Declare PtrSafe 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 PtrSafe 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&


polis-53 03-01-2018 07:36

teşekkür ederim işimi gördü

asri 03-01-2018 15:25

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 PtrSafe 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



Saat 01:49

Powered by vBulletin Version 3.7.2
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.