Auch in der Final-Version 4.10 funktioniert OSVersion() nicht richtig, wenn es in einer Dll benutzt wird.
In einer Exe zeigt mir OSVersion() unter XP und Vista das richtige OS an.
Benutze ich dies in einer Dll, wird nur unter XP das OS richtig ausgegeben, aber unter Vista ist das Ergebnis "Windows 98".
Ist das ein BUG ?
OSVersion() fehlerhaft ?
Code: Alles auswählen
; ----------------------------------------------------------------------------
; This procedure is called once, when the program loads the library
; for the first time. All init stuffs can be done here (but not DirectX init)
ProcedureDLL AttachProcess(Instance)
EndProcedure
; Called when the program release (free) the DLL
ProcedureDLL DetachProcess(Instance)
EndProcedure
; Both are called when a thread in a program call or release (free) the DLL
ProcedureDLL AttachThread(Instance)
EndProcedure
ProcedureDLL DetachThread(Instance)
EndProcedure
; ----------------------------------------------------------------------------
ProcedureDLL.s InfoOSVersion() ; liefere die Windows-Version
Protected A.s
Select OSVersion()
Case #PB_OS_Windows_NT3_51
A="Windows NT3 51"
Case #PB_OS_Windows_95
A= "Windows 95"
Case #PB_OS_Windows_NT_4
A= "Windows NT4"
Case #PB_OS_Windows_98
A= "Windows 98"
Case #PB_OS_Windows_ME
A= "Windows ME"
Case #PB_OS_Windows_2000
A= "Windows 2000"
Case #PB_OS_Windows_XP
A= "Windows XP"
Case #PB_OS_Windows_Server_2003
A= "Windows Server 2003"
Case #PB_OS_Windows_Vista
A= "Windows Vista"
Case #PB_OS_Windows_Server_2008
A= "Windows Server 2008"
Case #PB_OS_Windows_Future
A= "Windows Future"
Default ; keine Version erkannt
A= "Windows Error"
EndSelect
ProcedureReturn A
EndProcedure
I don't know if it's the problem (didn't test your code), but to return a string from a DLL it needs to be global.
From the manual :
From the manual :
Code: Alles auswählen
Note about returning strings from DLL's:
If you want to return a string out of a DLL, the string has to be declared as Global before using it.
Example:
Global ReturnString$
ProcedureDLL.s MyFunction(var.s)
ReturnString$ = var + " test"
ProcedureReturn ReturnString$
EndProcedure
Without declaring it as Global first, the string is local to the ProcedureDLL and cant be accessed from outside.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
@gnozal
Habe ich mal nach deinem Vorschlag getestet.
Immer noch das gleiche Verhalten wie eingangs beschrieben.
Zudem gibt die Funktion bei XP und vermutlich den anderen OS das richtige OS zurück.
Lediglich bei Vista bekomme ich ein falsches Ergebnis.
Eventuell testet dies mal ein anderer User, der auch mehrere OS incl. Vista zu Verfügung hat.
Danke.
Habe ich mal nach deinem Vorschlag getestet.
Immer noch das gleiche Verhalten wie eingangs beschrieben.
Zudem gibt die Funktion bei XP und vermutlich den anderen OS das richtige OS zurück.
Lediglich bei Vista bekomme ich ein falsches Ergebnis.
Eventuell testet dies mal ein anderer User, der auch mehrere OS incl. Vista zu Verfügung hat.
Danke.