From what I can see, as long as you do not dimension the object in function where you are using it (IE DIM x as Object) then it will work. For me (with all the latest greatest updates for VB6, if I declare it as global, public or private above the code then I am good.
IE
Private x as mynewobject
sub main
msgbox x.foo
end sub
Otherwise it will always crash.
Sub main
dim x as new object
set x = new object
x.foo
End sub
Announcement
Collapse
No announcement yet.
Has anyone gotten a compiled Dll to work with VB, VBA or VBSCRIPT?
Collapse
X
-
Usually you can use the right mouse menu and use something like "Run As.."
A admin password is required during installation.
Leave a comment:
-
-
I am not really good with VISTA, there is only one user as far as I can tell.. How does one get admin rights?
Thanks
Leave a comment:
-
-
Also,
The dll's will not register on Vista, I tried all I could to get it to register when calling DllRegisterServer. On XP it works, no problem at all. Can someone shed some light on that one?
BTW - Using the simple steps provided I can get it to work in VB, VBA, and VBSCRIPT with out any problems on XP
ThanksLast edited by Thomas Tierney; 27 Aug 2008, 03:00 PM.
Leave a comment:
-
-
Bless you guys. I thought it was me and it was driving me bananas. I will give it a try and see if I can get it to work..
Thanks All!!!
Has anyone sent an email to support to fix this?
Leave a comment:
-
-
Hi Steven,
The interface is listed as noncreatable by OLE View - a tool that is provided with Visual Studio 6. Thomas actually mentioned this in the first post in the thread.
OLE View also lets you see the decompiled IDL (Interface Definition (or Description) Language) for the type library and save it out as a text file. From there, I just removed the "noncreatable" attribute and saved the file, recompiled it to a TLB with MIDL (also supplied with Visual Studio as part of VC++) and attached it to the DLL with PBTYP.
Regards,
Pete.
Leave a comment:
-
-
Originally posted by Edwin Knoppert View PostGuess we must set our hopes to PB making a modification for this.
(please)
Set x = New <class> is the most common way objects are instanced in VB. It would be nice if we could support that with PB.
Leave a comment:
-
-
Peter,
First, how did you find it's non-creatable and second, how do you manually change it in the TypeLib ? What tools do you use ?
Cheers
Steven
Leave a comment:
-
-
Cool.
Your last code is how it should be.
Not sure how to deal with the tlb data.
Guess we must set our hopes to PB making a modification for this.
(please)
Leave a comment:
-
-
Why noncreatable?
Hi James,
As far as I can see, the "problem" is that the type library built by PB is specifying the interface/class as noncreatable. That being the case, you will only be able to "Implement" the interface in an object module in VB - i.e.
Code:Implements IItem.MYCLASS
However, if you remove the noncreatable attribute from the type library manually and recompile it, then include it in the DLL (using PBTYP, for example), then VB will allow:
Code:Dim cTest As IItem.MYCLASS Set cTest = New IItem.MYCLASS
So I guess the question really is, why is PB setting the "noncreatable" attribute in the first place? From what I can gather, this is part of the instancing settings for COM, and there appears to be no way to set this from within the PB Class definition.
Perhaps those with greater knowledge and/or understanding can explain the reasoning behind this?
Regards,
Pete.
Leave a comment:
-
-
Fred
Command line with message boxes for result
Possible message boxes can be found here http://support.microsoft.com/kb/249873
John
Leave a comment:
-
-
regsvr32.exe appears to be a gui process and outputs to a msgbox that registration either succeeded or failed. Is its output stating that it succeeded but you are not finding the correct registry entries in spite of that?
Also, I have created COM Dll servers using C where I registered the component in the registry but did not create a typelib. These I can call using PowerBASIC by using Direct Access (working on that sort of thing right now). I may be wrong about this, but by registering the type lib info that allows for connecting through IDispatch/Automation.
As others have said, what regsvr32 does is call DllRegisterServer in the Dll, which is an exported function. I believe this is implemented within the compiler so we don't have to do it in PB ourselves. If one is using C/C++ one must write that code oneself, and its a rather dreary job.Last edited by Fred Harris; 26 Aug 2008, 11:58 AM.
Leave a comment:
-
-
Thomas
The registration process is what I am on about. The DLL needs a function called DLLSelfRegister and/or possibly two others called something like DLLserverregister and DLLserverunregister (forget the exact names) which it seems are put in by the compiler when you define it as a COM. If registration fails then normally VB can't find it. Until you get past that then your second problem is moot.
As I sais don't have 9 yet but if you give the class a name like ThomasProblem and attach the compiled DLL to a post then I am happy to test for you.
John
Leave a comment:
-
-
Disregard, this is the same James has posted above.Last edited by Knuth Konrad; 26 Aug 2008, 11:29 AM.
Leave a comment:
-
-
John,
My primary problem is registration. I can get the dll to load in Excel and Word to view the type lib. This is not the issue. My Secondary problem is that all dll's that are created list the interfaces as notcreateable.
Leave a comment:
-
-
Thomas
I agree that if properly registered the DLL can be anywhere but you said you couldn't find a succesful registration. Note the comments for error 48 above.
It can get complicated, I have a program (done it in both PB and VB) which requires two ActiveX DLL's created in VB ( by another party), the first is the only one that can be registered and its location doesn't matter, but it calls the second which is not registerable. For both PB and VB the second needs to be in a normal DLL location ie program folder.
To be more specific I think you have naming confusion. Don't have 9 yet but try using the same unique name for the DLL and the class so that regsvr32 can find the automatically inserted DllSelfRegister function. Remember it will be in the registry under the class name not the DLL name so something more descriptive than "MyClass" might help.
JohnLast edited by John Petty; 26 Aug 2008, 09:32 AM.
Leave a comment:
-
-
strange stuff
Still, I believe there is an issue with IDispatch as an parameter in a method.
I can't seem to get any ActiveX control to work that requires an IDispatch as a parameter.
Leave a comment:
-
Leave a comment: