Hi, Jalil -
I'm actually a little surprised the external function declaration you supplied works in 32-bit, but not surprised at all that it fails in 64-bit.
The first argument parameter (hWnd) is a Windows O/S Handle (ID) to a window, and handles are always of the same bitness as the application. In other words, in a 32-bit app a handle is a 32-bit integer, or a PB Long or ULong... not a 16-bit PB Integer. In a 64-bit app a handle is a 64-bit integer, or PB LongLong.
However, the "Longptr" data type introduced in PB 12.6 is the ideal choice for this parameter, as its size matches the bitness of the application. Therefore, change the data type of the first argument parameter to Longptr. Having the Longptr data type available and using it allows this one external function declaration to work in both 32-bit and 64-bit, without any bitness-specific coding!
You should also change the data type of the API function's return value to Longptr, as this API function returns a HINSTANCE value (Handle to an instance), which is also a type of Windows handle.
Change the external function declaration, but also change any code that calls this function to use the Longptr data type and the code should work when compiled for either 32-bit or 64-bit.
Best regards, John
If you're going to code interfaces to and utilize functions in external DLL's, not just Windows API functions, I strongly believe it is best for everyone to understand the rules, why those rules exist, and how to correctly code to those rules.
I feel that to do otherwise is a disservice to our compatriots in the Community that are asking for assistance.