So I don't do a lot of Win32 calls, but recently I have had to use the GetFileTime()
and SetFileTime()
functions. Now although Win98 and below are not officially supported in my program people do use it there anyway, and I try to keep it as usable as possible. I was just wondering what will happen as those functions do not exist in pre-NT systems, will they receive an error message of some sort for example because in that case I will add in an OS check? Thanks
If you call the functions directly, then your program will not load on Win98.
What you can do is use LoadLibrary()
/ GetProcAddress()
to get a pointer to GetFileTime()
/ SetFileTime()
. On Win98 this will fail, giving you a null pointer which you can test for and ignore. On 2000 and later you will get a pointer which you can then use.
It's a pain, but it's the only solution I know of.
Here is an example of getting the UpdateLayeredWindow function if it exists:
typedef BOOL (WINAPI* UpdateLayeredWinFunc) (HWND, HDC, POINT*, SIZE*, HDC, POINT*, COLORREF, BLENDFUNCTION*, DWORD);
UpdateLayeredWinFunc updateLayeredWindow = 0;
HMODULE user32Mod = GetModuleHandle (_T("user32.dll"));
updateLayeredWindow = (UpdateLayeredWinFunc) GetProcAddress (user32Mod, "UpdateLayeredWindow");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With