spaznuski
asked on
Declare a Function for NT only
OK I have two functions that use NetApi32.dll but the code i have will only work on NT, How can i write it so that if the exe is running on a 9x machine the functions wont get called.
The Functions are
function NetShareEnum(servername: PWideChar; level: DWORD; bufptr: PBYTE;
prefmaxlen: DWORD; entriesread: PDWORD; totalentries: PDWORD;
resume_handle: PDWORD): DWORD; stdcall; external 'netapi32.dll' Name 'NetShareEnum';
function NetApiBufferFree(Buffer: Pointer): DWORD;
stdcall; external 'netapi32.dll' Name 'NetApiBufferFree';
The Functions are
function NetShareEnum(servername: PWideChar; level: DWORD; bufptr: PBYTE;
prefmaxlen: DWORD; entriesread: PDWORD; totalentries: PDWORD;
resume_handle: PDWORD): DWORD; stdcall; external 'netapi32.dll' Name 'NetShareEnum';
function NetApiBufferFree(Buffer: Pointer): DWORD;
stdcall; external 'netapi32.dll' Name 'NetApiBufferFree';
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
MajorVersion 4 is also used for Win95/98/ME and NT4.
The line should be :
if (OsInfoEx.dwPlatformId = VER_PLATFORM_WIN32_NT) and (Osv.dwMajorVersion = 4) then
result:=true;
For Win2000 and XP you should use VerifyVersionInfo
.
Peter
The line should be :
if (OsInfoEx.dwPlatformId = VER_PLATFORM_WIN32_NT) and (Osv.dwMajorVersion = 4) then
result:=true;
For Win2000 and XP you should use VerifyVersionInfo
.
Peter
ASKER
OK, Thanx for the help; I actually have code like that already and am using it in such a manner for other problems, but after a long break from the code and looking at what is being said, i figured out what i needed to do.
Thanx
Thanx
spaznuski:
This old question needs to be finalized -- accept an answer, split points, or get a refund. For information on your options, please click here-> http:/help/closing.jsp#1
EXPERTS:
Post your closing recommendations! No comment means you don't care.
This old question needs to be finalized -- accept an answer, split points, or get a refund. For information on your options, please click here-> http:/help/closing.jsp#1
EXPERTS:
Post your closing recommendations! No comment means you don't care.
...
if osv.dwMajorVersion >= 4 then result := true;
...
Regards, Geo