Call NT function in pre-NT system

Thus, I do not make many Win32 calls, but lately I had to use GetFileTime() and SetFileTime() . Now, although Win98 and below are not officially supported in my program, people still use it there, and I try to keep it as convenient as possible. I'm just wondering what will happen, since these functions do not exist on systems prior to NT, will they receive an error message of some kind, for example, because in this case I will add the OS to the scan? Thanks

+6
c ++ windows dll winapi
source share
3 answers

If you call functions directly, your program does not load on Win98.

What you can do is use LoadLibrary() / GetProcAddress() to get a pointer to GetFileTime() / SetFileTime() . On Win98, this will not work, giving you a null pointer that you can check and ignore. In 2000 and later you will receive a pointer that you can use.

This is pain, but this is the only solution that I know of.

Here is an example of getting the UpdateLayeredWindow function, if one 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"); 
+8
source share

I believe that you will receive an error message in the line "The entry point (name) of the procedure cannot be located in (dll)", similar to the one shown:

example http://img266.imageshack.us/img266/3762/error2pm1.png

0
source share

You can call FindFirstFile() instead of GetFileTime() . I would not know an alternative for SetFileTime() .

0
source share

All Articles