Hi, Subrat -
You have several related issues that should be addressed in order to utilize WinAPI calls in 64-bit:
1. Structure definition changes. Any structure that contains a Windows handle should use the Longptr datatype.
2. Any structure that includes its size as an element (like cbSize) has to have the correct value. How to know the correct value to use? See below.
3. Your code should be refactored. For example, use Longptr for values that contain Windows handles (such as the return value from the PowerScript Handle() function) and memory addresses (like what is used in the lstrcpy API function call).
4. Although you may continue to pass ANSI strings between your PB app and Windows, both use Unicode, so why continue perform a lot of unnecessary, behind-the-scenes data conversions? Use the Unicode version of the API functions (hint: Their names end in "W", for "Wide characters").
The rules for how structure elements are laid out in memory differ slightly between 32-bit and 64-bit. This can have an impact on the overall size of a structure in addition to the increase in the size of some elements. A few years ago I published a four-part series of PB tech articles concerning the interfacing of PB applications to the Windows API. Part 2 covers 32-bit to 64-bit migration issues:
https://community.appeon.com/index.php/articles-blogs/tutorials-articles/2-powerbuilder/303-interfacing-pb-applications-with-the-windows-api-part-2
This series of tech articles was researched and written for PB developers just like you. I encourage you to invest a little time and learn both why and how things are different between 32-bit and 64-bit WinAPI calls.
Best regards, John