OberonPlace.com Forums

OberonPlace.com Forums (http://forum.oberonplace.com/index.php)
-   CorelDRAW/Corel DESIGNER VBA (http://forum.oberonplace.com/forumdisplay.php?f=16)
-   -   using 32-bit macros in 64-bit X6 or X7 (http://forum.oberonplace.com/showthread.php?t=24670)

HeauxmBru 20-04-2014 16:30

using 32-bit macros in 64-bit X6 or X7
 
Ive searched to see if anyone was having trouble using their 32-bit macros in X6 or X7 64-bit. I didn't find much. I was however having trouble with my old macros and have been searching for a solution.

I found a solution in the Help file in the Macro Editor under the 64-Bit Visual Basic for Applications Overview which basically says that the Declare statements for win32 API calls must be modified as follows:

Code:


Public Declare PtrSafe Function GetCursorPos Lib "user32" (ByRef pos As lpPoint) As Boolean

Private Declare PtrSafe Function CreateEvent Lib "kernel32" Alias "CreateEventA" _
        (ByVal lpEventAttributes As LongPtr, ByVal bManualReset As LongPtr, _
        ByVal bInitialState As LongPtr, ByVal lpName As String) As LongPtr

I tried it in both X6 and X7 64-bit and my old macros now work in 64-bit. Notice the PtrSafe keyword which declares the statement can be used in 64-bit environments and the LongPtr data type alias which keeps the macro backward compatible while usable in 64-bit.

Just thought I would share just in case anyone was have trouble.

Alex 22-04-2014 21:22

Thanks, that's a good info to share. Also, to get 64-bit compatible declarations of Win32 functions, I use this: http://www.microsoft.com/en-us/downl...s.aspx?id=9970

When installed it, puts a text file with all the Win32 declarations into C:\Office 2010 Developer Resources\Documents\Office2010Win32API_PtrSafe\Win32API_PtrSafe.txt

Very handy

HeauxmBru 24-04-2014 04:29

Very cool file. Thanks for the link!:)


All times are GMT -5. The time now is 16:49.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com