brandelh hat geschrieben:
Stimmen diese Aussagen:
@NumVar -> gibt Pointer auf nummerische Variabel zurück
(allerdings fehlen hier die Typen LONG bzw. DWORD ...)
cVar -> enthält direkt einen Pointer auf den Textinhalt, müßte also direkt verwendbar sein ? Oder braucht man auch hier
@StringVar ???
Kann man dann einen LONG folgendermaßen übergeben ?
cLong := L2BIN(nZahl)
...@cLong bzw. direkt ...cLong ?
Die Fragen beziehen sich auf normale DLL Aufrufe.
leider bin ich kein DLL Experte.
wenn ich das richtig sehe bezieht sich deine Frage auf
wann/wie @ (per reference).
sieht man sich VB Aufrufe an so gib es da "ByVal" und "ByRef"
die "alle möglichen" Datei Typen haben können.
Beispiele VB -> Xbase++ DLLCall
Code: Alles auswählen
>can someone please help me to "translate" these from VB to Xbase++
I will give it a try. It looks like those are all pretty standard DLL calls
without anything special:
>> Private Declare Function PdhOpenQuery Lib "PDH.DLL" ( _
>> ByVal Reserved As Long, _
>> ByVal dwUserData As Long, _
>> ByRef hQuery As Long) As Long
nRet := DllCall("PDH.DLL", DLL_STDCALL, "PdhOpenQuery", nReserved, ;
nDwUserData, @nHQuery)
>> Private Declare Function PdhCloseQuery Lib "PDH.DLL" ( _
>> ByVal hQuery As Long) As Long
nRet := DllCall("PDH.DLL", DLL_STDCALL, "PdhCloseQuery", nHQuery)
>> Private Declare Function PdhVbAddCounter Lib "PDH.DLL" ( _
>> ByVal QueryHandle As Long, _
>> ByVal CounterPath As String, _
>> ByRef CounterHandle As Long) As Long
nRet := DllCall("PDH.DLL", DLL_STDCALL, "PdhVbAddCounter", nQueryHandle, ;
cCounterPath, @nCounterHandle)
>> Private Declare Function PdhCollectQueryData Lib "PDH.DLL" ( _
>> ByVal QueryHandle As Long) As Long
nRet := DllCall("PDH.DLL", DLL_STDCALL, "PdhCollectQueryData", nQueryHandle)
>> Private Declare Function PdhVbGetDoubleCounterValue Lib "PDH.DLL" ( _
>> ByVal CounterHandle As Long, _
>> ByRef CounterStatus As Long) As Double
nRet := DllCall("PDH.DLL", DLL_STDCALL, "PdhVbGetDoubleCounterValue", ;
nCounterHandle, @nCounterStatus)
-- Andreas Gehrs-Pahl
folgt man aber Hannes Ziegler´s Lösung :
Code: Alles auswählen
May I recommend one thing: forget VB Syntax, learn to read SDK help
files.
I recommend you download the Windows SDK and search in the SDK help
files for "PdhOpenQuery"
What you find is something like this:
PDH_STATUS PdhOpenQuery(
LPCTSTR szDataSource,
DWORD_PTR dwUserData,
PDH_HQUERY* phQuery
);
When we talk on ths level, I can help you to translate it to DllCall(),
see below.
erhält man mit Hilfe seines Tools XbStruct.dll folgenden Xbase++ code
Code: Alles auswählen
FUNCTION PdhOpenQuery( szDataSource, dwUserData, phQuery )
LOCAL xReturn
IF Valtype( szDataSource ) <> "C"
szDataSource := ""
ENDIF
IF Valtype( dwUserData ) <> "N"
dwUserData := 0
ENDIF
IF Valtype( phQuery ) <> "N"
phQuery := 0
ENDIF
xReturn := ;
DllCall( "Pdh.dll" , ; // DLL to call
DLL_STDCALL , ; // calling convention
"PdhOpenQuery" , ; // PDH_STATUS PdhOpenQuery(
@szDataSource , ; // LPCTSTR szDataSource ,
dwUserData , ; // DWORD_PTR dwUserData ,
@phQuery ; // PDH_HQUERY* phQuery )
)
RETURN xReturn
der Xbase++ code wurde mit XbStruct.dll "generiert" !!!
mehr Informationen :
http://www.knowlexbase.com/en/publicati ... Intro.html
gruss by OHR
Jimmy