Re: DirectCom.dll: vb sample -> vfp



habe noch einen konspirativen Hinweis bekommen :-)

Die Dll sollte eigentlich tun.
Sie wurde mittels PowerBasic erstellt (StdCall-Convention).
GETINSTANCE erwartet als String-Parameter jeweils den Pointer
auf einen Pointer eines ANSI-Strings (in der Original-Deklaration
fehlt ja das sonst übliche ByVal vor den String-Parametern).
Wenn man in VB6 aber folgendermaßen deklariert:
Declare Function GETINSTANCE Lib "DirectCom" _
(ByRef pFName As Long, ByRef pClassName As Long) As Object
...dann muss man das, was VB implizit bei Stringübergaben unter der
Haube durchführt, selbst in die Hand nehmen:
'Beispiel anhand des "Scripting.Dictionary":
Dim D As Object, FName As String, ClassName As String
FName = "scrrun.dll"
ClassName = "Dictionary"
FName = StrConv(FName, vbFromUnicode) 'nach ANSI
ClassName = StrConv(ClassName, vbFromUnicode) 'nach ANSI
Set D = GETINSTANCE(StrPtr(FName), StrPtr(ClassName))
D.Add "123", "123"
Debug.Print D.Count
Hoffe, das hilft erstmal - schau mal, wie Du das in VFP hinbiegst -
vielleicht gibt es in VFP ja auch einen ANSI-String-Typ, dann darf
die Konvertierung von VBs UCS2 nach ANSI entfallen.

die Hoffnung stirbt zuletzt. Nun habe ich
Declare Object GETINSTANCE IN "DirectCom.dll" String@, String@

cDLL = "dh_CtlLoader.dll"

cCLS = "CLoader"

GETINSTANCE(@cDLL, @cCLS)

nix - immer noch Exception. Stelle ich mich nur so an oder ...

Gruß Martin


.



Relevant Pages

  • Re: Create Forms via Parameter
    ... need the classname to retrieve a class registered via RegisterClasses. ... Function ShowFormByName(const formname: String; ... variable, the form reference, and that can be had the way shown above. ... The VCL contains a suitable class registry, ...
    (borland.public.delphi.language.objectpascal)
  • Re: String problem VS 2005
    ... the console the Classname and the text in the notepad window. ... The first output to the console is "N" and not ... I dont understand how to work with all the C++ string format. ...
    (microsoft.public.dotnet.languages.vc)
  • Re: Get Path Where A Class Is Located
    ... Call it jwhich. ... And then use the class file compiled from the code below: ... @param className The full name of the class. ... public static String which ...
    (comp.lang.java.programmer)
  • Re: Notifying already running app
    ... foundwindow stays 0 after the loop, but I am not to sure and will appreciate ... FoundWndS: THandle; ... ClassName, WinModuleName: string; ...
    (alt.comp.lang.borland-delphi)
  • Re: DirectCom.dll: vb sample -> vfp
    ... String, ... Ich, treudoof wie ich bin, habe in VFP folgendes mir aus der Nase gezogen: ... Declare Object GETINSTANCE IN "DirectCom.dll" String, ... Ich vermute mal die Linker Version ist bei ...
    (microsoft.public.de.fox)