Re: How do MAKEINTRESOURCE in Euphoria?
- Posted by andi49 May 16, 2013
- 2081 views
I am trying to wrap an API which wants me to use MAKEINTRESOURCE.
I thought I knew enough C to know what the C code for this meant, but I seem to have forgotten it all.
Can somebody tell me the Euphoria equivalent of the MAKEINTRESOURCE macro? It seems to be defined as:
#define MAKEINTRESOURCEW (x) ((LPWSTR) (U_LONG_PTR) (WORD) (x))
Hallo
Matt's solution is pretty okay in my opinion.
MakeIntResource is a hack in the Windowsworld.
Windows just uses this to distinguish a handle or a pointer from an index to a resource.
If the parameter is bigger than #ffff it's an Pointer or a Handle else it is an index to a resource.
On old Windowsversions this may end in a bluescreen if someone passes accidently a parameter bigger than #ffff.
MakeIntResource is the airbag in this case.
But i think it is easier to check the value yourself before you pass it to the Api Function.
Maybe you can check out this for more information : http://stackoverflow.com/questions/9806100/makeintresource-returning-bad-pointers-for-resource-ids
Andreas