>I am having troubles getting my VB dll to register in VFP. it is called readflag.dll and contains the class Class1. i try to use the COM object in the following way:
>
>declare Class1 in ReadFlag
>obj = createobject("ReadFlag.Class1")
>
DECLARE...DLL is only applicable to DLLs that are called using C-style access to their entrypoints; VB creates COM-style DLLs, which must be registered before they can be instantiated and accessed. The DECLARE is inappropriate and unnecessary.
>and then try to access the functions using with the following syntax:
>
If CREATEOBJ() did not fai, then obj will be an instance of the COM server, and the methods and properties that you've published through the COM interface will be visible.
>obj.resetflags(xxx,xx,xxx)
>
>now this only seems to work if i manually go to run in the Start button and register the .dll file first and then run the program. for some reason the following code does not register the .dll from in the program:
>
>! /N regsvr32 /s "readflag.dll"
>
The encapsulating quotes are unnecessary; the file name does not contain a delimiter, so the quotes are treated as part of the file name, and there's no file name
"readflag.dll". There should have been an error returned from regsrv32; you should not run regsrv32 silently (with /s) when you don't know that it'll work. In order for this command to work, it should be issued:
! /N regsvr32 /s readflag.dll
and will only work if both regsrv32.exe and readflag.dll are in the current Windows search path, and if there are no other components required by readflag.dll
If you do want to run silently, and need to be able to check the termination code for regsrv32, you can use the API_APPRUN class downloadable from the files section; it allows you to check the termination code of a process, and also will allow you to run a WinApp and wait on its completion; the VFP RUN does not wait on termination with the /N option, and does not return an error code if any. There's also an entry in the FAQ by Paul Tatavu showing how to register a COM DLL without REGSVR32.