shlwapi ... any way to calling IsOS Function ?

Everything else that doesn't fall into one of the other PB categories.
User avatar
bingo
Enthusiast
Enthusiast
Posts: 210
Joined: Fri Apr 02, 2004 12:21 pm
Location: germany/thueringen
Contact:

shlwapi ... any way to calling IsOS Function ?

Post by bingo »

http://msdn.microsoft.com/library/defau ... s/isos.asp

OpenLibrary(1,"shlwapi.dll")
*F1 = IsFunction(1, "IsOS") ???:cry:
...
CloseLibrary(1)
["1:0>1"]
Doobrey
Enthusiast
Enthusiast
Posts: 218
Joined: Sat Apr 26, 2003 4:47 am
Location: Dullsville..population: me
Contact:

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

Post 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 ?
User avatar
NoahPhense
Addict
Addict
Posts: 1999
Joined: Thu Oct 16, 2003 8:30 pm
Location: North Florida

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

Post 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
User avatar
bingo
Enthusiast
Enthusiast
Posts: 210
Joined: Fri Apr 02, 2004 12:21 pm
Location: germany/thueringen
Contact:

Post 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" ?
["1:0>1"]
User avatar
NoahPhense
Addict
Addict
Posts: 1999
Joined: Thu Oct 16, 2003 8:30 pm
Location: North Florida

..

Post 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
Doobrey
Enthusiast
Enthusiast
Posts: 218
Joined: Sat Apr 26, 2003 4:47 am
Location: Dullsville..population: me
Contact:

Post 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
Post Reply