Click to See Complete Forum and Search --> : 'Form' object unknown as BuildIn Type in ActiveX


Peter Gerber
July 23rd, 1999, 01:47 AM
I just wrote my first dll's an ocx's and I needed to pass the Form object as a parameter to a public routine inside the dll. It all works fine as Function but trying to compile it to an activeX dll rises the error message that a user defined type is not allowed in a public member module.
Usually the word 'Form' turns blue after typing it as a hint that it is recognized as a BuildIn Type. Here it stays black, as well as other types like 'Control'.
The Procedure Call in the Dll is:
Public Sub LoadResStrings(ByVal frm As Form, ByVal sSEP As String, ByVal iLanguage As Integer)

Thanks fo any help
Pete




Pete

Ravi Kiran
July 23rd, 1999, 01:58 AM
You cant pass a form or any other control byval. It has to be byRef. Change it and try

If you want to be a specific form, you can change it to byref frm as MyForm also

Peter Gerber
July 23rd, 1999, 03:34 AM
Thank's Ravi
I tried it but the error Msg is still the same.
'Form' is treated like a user defined type.
Pete

Pete

Lothar Haensler
July 23rd, 1999, 03:47 AM
I just tested this.
You can pass your form object "As Object"
client code

Dim x as new Project2.Class1
x.testthis me



Activex DLL code

public Sub testthis(frm as Object)
MsgBox frm.hWnd
End Sub

Ravi Kiran
July 23rd, 1999, 03:49 AM
You can define it as a Object. It takes. i just ran a test.

It seems to accept both ByRef and Byval. But i will safely assume, that ByVal passinf of objects has no effect on data-integrity!. This aside..
Make sure but you pass only Forms, though it can accept any object, when defined like this