Trouble when using extern on winapi
BlitzMax Forums/BlitzMax Programming/Trouble when using extern on winapi
| ||
When using SystemParametersInfo, I am having trouble defining multiple uses of the same function. i.e. the pvParam value is a pointer for most uses of the function, but an Int when using something like SPI_SETMOUSESPEED. I have worked around it just now with: Extern "win32" Function SystemParametersInfoA(uAction, uParam, lpvParam:Byte Ptr, fWinIni)' '= "SystemParametersInfoA" Function SystemParametersInfoW(uAction, uParam, lpvParam:Int, fWinIni)' '= "SystemParametersInfoW" End Extern But this isn't likely to be possible for other functions that don't have an ANSI and a UNICODE declaration. |
| ||
i.e. the pvParam value is a pointer for most uses of the function, but an Int when using something like SPI_SETMOUSESPEED. This is not a bug - Max doesn't do function overloading. You'll have to either cast the parameter to the appropriate type (as you'd have to do in C/C++) or, as you've done, introduce a new function. My advice would be to declare it the same way it's declared in windows.h, and cast parameters when necessary. |
| ||
yeah, sorry, should've thought a little more about it beforehand :) my only excuse is that it was about 5:40am. |