Page 1 of 1

shlwapi ... any way to calling IsOS Function ?

Posted: Sun Jun 20, 2004 5:26 pm
by bingo
http://msdn.microsoft.com/library/defau ... s/isos.asp

OpenLibrary(1,"shlwapi.dll")
*F1 = IsFunction(1, "IsOS") ???:cry:
...
CloseLibrary(1)

Re: shlwapi ... any way to calling IsOS Function ?

Posted: Mon Jun 21, 2004 2:16 am
by Doobrey
I just looked at that MS page about IsOS, seems a bit wierd.
At the bottom it says..
Minimum operating systems Windows 2000, Windows 2000 Server, Windows Server 2003, Windows XP
So, MS has written a function that only works on Win2k and above, that can tell you if the program is running on Win95,98,Me etc ! :roll:
Next they`ll be writing a function that will tell you the computer is turned off :wink:

BTW, what`s wrong with using PBs library functions for checking and calling IsOS() like your example ?

Re: shlwapi ... any way to calling IsOS Function ?

Posted: Mon Jun 21, 2004 2:31 am
by NoahPhense
bingo wrote:http://msdn.microsoft.com/library/defau ... s/isos.asp

OpenLibrary(1,"shlwapi.dll")
*F1 = IsFunction(1, "IsOS") ???:cry:
...
CloseLibrary(1)
In the help file, OSVersion() ...

- np

Posted: Mon Jun 21, 2004 7:18 am
by bingo
is the same problem ...

http://msdn.microsoft.com/library/defau ... nicode.asp

LPWSTR WINAPI SHLWAPI_215 (
LPWSTR lpStrSrc,
LPVOID lpwStrDest,
int len)
...

how call this winapi "SHLWAPI_215" ?

..

Posted: Mon Jun 21, 2004 4:45 pm
by NoahPhense
bingo wrote:is the same problem ...

http://msdn.microsoft.com/library/defau ... nicode.asp

LPWSTR WINAPI SHLWAPI_215 (
LPWSTR lpStrSrc,
LPVOID lpwStrDest,
int len)
...

how call this winapi "SHLWAPI_215" ?
I don't know what version of PureBasic you are using but you don't need
anything from MS to determine the OS.

Code: Select all

Procedure.s IsOS()
  IsOS.s = ""
  Select OSVersion()
    Case #PB_OS_Windows_NT3_51
      IsOS = "Windows NT 3.51"
    Case #PB_OS_Windows_NT_4
      IsOS = "Windows NT 4"
    Case #PB_OS_Windows_2000 
      IsOS = "Windows 2000"
    Case #PB_OS_Windows_XP 
      IsOS = "Windows XP"
    Case #PB_OS_Windows_95 
      IsOS = "Windows 95"
    Case #PB_OS_Windows_98 
      IsOS = "Windows 98"
    Case #PB_OS_Windows_ME 
      IsOS = "Windows ME"
    Default
      IsOS = "0"
  EndSelect
  ProcedureReturn IsOS
EndProcedure

Debug IsOS()

End
As for what APIs are built into PureBasic, have a look at Pauls site.

http://www.reelmediaproductions.com/pb

Click the Supported API link on the left.

- np

Posted: Tue Jun 22, 2004 12:36 am
by Doobrey
Er, off the top of my head, try this..

Code: Select all

 If OpenLibrary(0,"shlwapi.dll")
  AnsiString.s="PB Kicks Ass"
  BufferLen.l=2*Len(AnsiString)
  UnicodeBuffer=AllocateMemory(0,BufferLen)
  If UnicodeBuffer
   result.l=CallFunction(0,"SHAnsiToUnicode",@AnsiString,@UnicodeBuffer,BufferLen)
  Endif
 Endif