locked
Device contexts and COM RRS feed

  • Question

  • I am currently passing a handle to a device context through an interface as a LONG type. I am sure this is not the correct way to do this, but it does work.

    The components are simple ATL objects that are windowless controls which can draw on any device context.

    In 64 bit windows, pointers are 64 bits long and a LONG is 32 bits, so when I port this code to x64, the handle to a device context will not work since a handle is a pointer.

    Is there a platform independent way to do this so that the same IDL will work for both 32 and 64 bit builds?

    Saturday, September 5, 2015 11:04 AM

Answers

  • You need to build two version of the COM dll for 32 bit and 64 bit windows.

    Please also check this : Microsoft Interface Definition Language (MIDL): 64-Bit Porting Guide


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Proposed as answer by Jamles Hez Tuesday, September 15, 2015 11:47 PM
    • Marked as answer by Jamles Hez Wednesday, September 23, 2015 1:32 AM
    Wednesday, September 9, 2015 1:34 PM