[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.interop

Use of DLL in VB6 works fine, but I want to learn something and try to get the intellisense of the DLL

Screaming Eagles 101

2/28/2007 11:00:00 AM

Hi,

In an earlier post I received a perfect solution to use a visible VbNet
USERCONTROL
in VB6 and get the intellisense. I'm rewriting the answer I got beneath my
new question which is =>

I use a DLL, probably written in VB6, which is a NON VISUAL 'control' (?).
We pass some arguments to the dll and the dll sends a mail using our SMTP
server.
Using it like our code here unfortunately we lose the intellisense,
but is it possible, like the 'trick' with the vbnet usercontrol, to obtain
it anyway ?

That's how we use it, which works, but with no intellisense (after we added
the reference in VB6 to the project):

Private Sub SendMail()
Dim Dllzend As Object
Set Dllzend = CreateObject("SidSmtpV01.SendMail")
With Dllzend
'adding receivers, sender, message, subject, etc... and perform the
communication...
.startCommunication
Set Dllzend = Nothing
End With
End Sub



How could I get the intellisense like here beneath ?
*********VBnet Usercontrol solution*********** (visual control)
This works 200% !!

Dim ctlDynamic As VBControlExtender
That will give you access to the "standard" intellisense.

set ctlDynamic = controls.add("stlOperators.stlOperator", "myOps")
ctlDynamic.Visible = True

You are supposed to be able to us the .object property of the
VBControlExtender object to bypass the wrapper. The question at this
point is...what is the actual type of your object?

If "stlOperators.stlOperator" is your programatic id I'd try adding
this after assigning ctlDynamic:

Dim ctlOperator As stlOperators.stlOperator
Set ctlOperator = ctlDynamic.object

Tom



--
Filip
http://www.ww2air...
Official Site of the 101st Airborne - 463rd PFA
skype: airborne463pfa-fiwi
-------------------------------------------------


4 Answers

TDC

3/1/2007 1:47:00 PM

0

Just so I'm clear, you are trying to reference a COM (possibly VB6)
dll in your .NET application?

Or is it the inverse...you are trying to reference a .NET dll from a
COM/VB6 application?

Tom

On Feb 28, 6:00 am, " Screaming Eagles 101"
<see_my_s...@online.please> wrote:
> Hi,
>
> In an earlier post I received a perfect solution to use a visible VbNet
> USERCONTROL
> in VB6 and get the intellisense. I'm rewriting the answer I got beneath my
> new question which is =>
>
> I use a DLL, probably written in VB6, which is a NON VISUAL 'control' (?).
> We pass some arguments to the dll and the dll sends a mail using our SMTP
> server.
> Using it like our code here unfortunately we lose the intellisense,
> but is it possible, like the 'trick' with the vbnet usercontrol, to obtain
> it anyway ?
>
> That's how we use it, which works, but with no intellisense (after we added
> the reference in VB6 to the project):
>
> Private Sub SendMail()
> Dim Dllzend As Object
> Set Dllzend = CreateObject("SidSmtpV01.SendMail")
> With Dllzend
> 'adding receivers, sender, message, subject, etc... and perform the
> communication...
> .startCommunication
> Set Dllzend = Nothing
> End With
> End Sub
>
> How could I get the intellisense like here beneath ?
> *********VBnet Usercontrol solution*********** (visual control)
> This works 200% !!
>
> Dim ctlDynamic As VBControlExtender
> That will give you access to the "standard" intellisense.
>
> set ctlDynamic = controls.add("stlOperators.stlOperator", "myOps")
> ctlDynamic.Visible = True
>
> You are supposed to be able to us the .object property of the
> VBControlExtender object to bypass the wrapper. The question at this
> point is...what is the actual type of your object?
>
> If "stlOperators.stlOperator" is your programatic id I'd try adding
> this after assigning ctlDynamic:
>
> Dim ctlOperator As stlOperators.stlOperator
> Set ctlOperator = ctlDynamic.object
>
> Tom
>
> --
> Filiphttp://www.ww2air...
> Official Site of the 101st Airborne - 463rd PFA
> skype: airborne463pfa-fiwi
> -------------------------------------------------


Screaming Eagles 101

3/1/2007 6:29:00 PM

0

Hi I'm trying to reference what I believe to be a VB6, but perhaps a VS6 C++
dll, non visible,
and doi it again in a VB6 program.

It works perfectly now, but without the intellisense.

--
Filip
http://www.ww2air...
Official Site of the 101st Airborne - 463rd PFA
skype: airborne463pfa-fiwi
-------------------------------------------------
"TDC" <NOtcarvinSPAM@lycos.com> schreef in bericht
news:1172756824.304383.79370@31g2000cwt.googlegroups.com...
> Just so I'm clear, you are trying to reference a COM (possibly VB6)
> dll in your .NET application?
>
> Or is it the inverse...you are trying to reference a .NET dll from a
> COM/VB6 application?
>
> Tom
>
> On Feb 28, 6:00 am, " Screaming Eagles 101"
> <see_my_s...@online.please> wrote:
>> Hi,
>>
>> In an earlier post I received a perfect solution to use a visible VbNet
>> USERCONTROL
>> in VB6 and get the intellisense. I'm rewriting the answer I got beneath
>> my
>> new question which is =>
>>
>> I use a DLL, probably written in VB6, which is a NON VISUAL 'control'
>> (?).
>> We pass some arguments to the dll and the dll sends a mail using our SMTP
>> server.
>> Using it like our code here unfortunately we lose the intellisense,
>> but is it possible, like the 'trick' with the vbnet usercontrol, to
>> obtain
>> it anyway ?
>>
>> That's how we use it, which works, but with no intellisense (after we
>> added
>> the reference in VB6 to the project):
>>
>> Private Sub SendMail()
>> Dim Dllzend As Object
>> Set Dllzend = CreateObject("SidSmtpV01.SendMail")
>> With Dllzend
>> 'adding receivers, sender, message, subject, etc... and perform
>> the
>> communication...
>> .startCommunication
>> Set Dllzend = Nothing
>> End With
>> End Sub
>>
>> How could I get the intellisense like here beneath ?
>> *********VBnet Usercontrol solution*********** (visual control)
>> This works 200% !!
>>
>> Dim ctlDynamic As VBControlExtender
>> That will give you access to the "standard" intellisense.
>>
>> set ctlDynamic = controls.add("stlOperators.stlOperator", "myOps")
>> ctlDynamic.Visible = True
>>
>> You are supposed to be able to us the .object property of the
>> VBControlExtender object to bypass the wrapper. The question at this
>> point is...what is the actual type of your object?
>>
>> If "stlOperators.stlOperator" is your programatic id I'd try adding
>> this after assigning ctlDynamic:
>>
>> Dim ctlOperator As stlOperators.stlOperator
>> Set ctlOperator = ctlDynamic.object
>>
>> Tom
>>
>> --
>> Filiphttp://www.ww2air...
>> Official Site of the 101st Airborne - 463rd PFA
>> skype: airborne463pfa-fiwi
>> -------------------------------------------------
>
>


TDC

3/2/2007 2:18:00 PM

0

So there is no .NET involved at all then?

If that's true then in VB6 you just go to References and add the
library and then change your code to:

Dim Dllzend As SidSmtpV01.SendMail
Set Dllzend = New SidSmtpV01.SendMail

Tom

(PS There are other VB groups that can better answer pure VB
questions...for example I frequent comp.lang.basic.visual.misc)




On Mar 1, 1:28 pm, " Screaming Eagles 101" <see_my_s...@online.please>
wrote:
> Hi I'm trying to reference what I believe to be a VB6, but perhaps a VS6 C++
> dll, non visible,
> and doi it again in a VB6 program.
>
> It works perfectly now, but without the intellisense.
>
> --
> Filiphttp://www.ww2air...
> Official Site of the 101st Airborne - 463rd PFA
> skype: airborne463pfa-fiwi
> -------------------------------------------------
> "TDC" <NOtcarvinS...@lycos.com> schreef in berichtnews:1172756824.304383.79370@31g2000cwt.googlegroups.com...
>
>
>
> > Just so I'm clear, you are trying to reference a COM (possibly VB6)
> > dll in your .NET application?
>
> > Or is it the inverse...you are trying to reference a .NET dll from a
> > COM/VB6 application?
>
> > Tom
>
> > On Feb 28, 6:00 am, " Screaming Eagles 101"
> > <see_my_s...@online.please> wrote:
> >> Hi,
>
> >> In an earlier post I received a perfect solution to use a visible VbNet
> >> USERCONTROL
> >> in VB6 and get the intellisense. I'm rewriting the answer I got beneath
> >> my
> >> new question which is =>
>
> >> I use a DLL, probably written in VB6, which is a NON VISUAL 'control'
> >> (?).
> >> We pass some arguments to the dll and the dll sends a mail using our SMTP
> >> server.
> >> Using it like our code here unfortunately we lose the intellisense,
> >> but is it possible, like the 'trick' with the vbnet usercontrol, to
> >> obtain
> >> it anyway ?
>
> >> That's how we use it, which works, but with no intellisense (after we
> >> added
> >> the reference in VB6 to the project):
>
> >> Private Sub SendMail()
> >> Dim Dllzend As Object
> >> Set Dllzend = CreateObject("SidSmtpV01.SendMail")
> >> With Dllzend
> >> 'adding receivers, sender, message, subject, etc... and perform
> >> the
> >> communication...
> >> .startCommunication
> >> Set Dllzend = Nothing
> >> End With
> >> End Sub
>
> >> How could I get the intellisense like here beneath ?
> >> *********VBnet Usercontrol solution*********** (visual control)
> >> This works 200% !!
>
> >> Dim ctlDynamic As VBControlExtender
> >> That will give you access to the "standard" intellisense.
>
> >> set ctlDynamic = controls.add("stlOperators.stlOperator", "myOps")
> >> ctlDynamic.Visible = True
>
> >> You are supposed to be able to us the .object property of the
> >> VBControlExtender object to bypass the wrapper. The question at this
> >> point is...what is the actual type of your object?
>
> >> If "stlOperators.stlOperator" is your programatic id I'd try adding
> >> this after assigning ctlDynamic:
>
> >> Dim ctlOperator As stlOperators.stlOperator
> >> Set ctlOperator = ctlDynamic.object
>
> >> Tom
>
> >> --
> >> Filiphttp://www.ww2air...
> >> Official Site of the 101st Airborne - 463rd PFA
> >> skype: airborne463pfa-fiwi
> >> -------------------------------------------------- Hide quoted text -
>
> - Show quoted text -


Screaming Eagles 101

3/5/2007 7:26:00 AM

0

Hi,
thanks again for the answer.
Also thanks for pointing me to the other newsgroup, in which I post this
answer too,
tranferring it to it's right place.

I have tried your solution before, but because I was not such an expert in
debugging at that time,
I couldn't find what was wrong. Doing it your way (the exact way) somehow I
got an error "13 Type mismatch",
and I thought it was because I couldn't use/assign the dll the way it should
be.

Today I found that is has something to do with a property inside of the Dll,
instead of how to assign it.
Testing if the message was indeed sent, we check the "smtp" state in a
return value which obviously
could also return a null value.

Using it the "old way" I never got that error, using it the right way it
shows up.
Adding a CStr function while testing the problem is solved.

Dim smtpabended as String
If CStr(DllZend.SmtpState) = smtpabended Then
MsgBox Dllzend.SmtpStateDescription
Else
StatusBar.Panels("Message").Text = "OK, mail is sent"
End If

I don't understand 100% why there is a difference but this is not that
important,
it works and I have full intellisense and that was all what it was about.

--
Filip
http://www.ww2air...
Official Site of the 101st Airborne - 463rd PFA
skype: airborne463pfa-fiwi
-------------------------------------------------
"TDC" <NOtcarvinSPAM@lycos.com> schreef in bericht
news:1172845089.220327.60930@30g2000cwc.googlegroups.com...
> So there is no .NET involved at all then?
>
> If that's true then in VB6 you just go to References and add the
> library and then change your code to:
>
> Dim Dllzend As SidSmtpV01.SendMail
> Set Dllzend = New SidSmtpV01.SendMail
>
> Tom
>
> (PS There are other VB groups that can better answer pure VB
> questions...for example I frequent comp.lang.basic.visual.misc)
>
>
>
>
> On Mar 1, 1:28 pm, " Screaming Eagles 101" <see_my_s...@online.please>
> wrote:
>> Hi I'm trying to reference what I believe to be a VB6, but perhaps a VS6
>> C++
>> dll, non visible,
>> and doi it again in a VB6 program.
>>
>> It works perfectly now, but without the intellisense.
>>
>> --
>> Filiphttp://www.ww2air...
>> Official Site of the 101st Airborne - 463rd PFA
>> skype: airborne463pfa-fiwi
>> -------------------------------------------------
>> "TDC" <NOtcarvinS...@lycos.com> schreef in
>> berichtnews:1172756824.304383.79370@31g2000cwt.googlegroups.com...
>>
>>
>>
>> > Just so I'm clear, you are trying to reference a COM (possibly VB6)
>> > dll in your .NET application?
>>
>> > Or is it the inverse...you are trying to reference a .NET dll from a
>> > COM/VB6 application?
>>
>> > Tom
>>
>> > On Feb 28, 6:00 am, " Screaming Eagles 101"
>> > <see_my_s...@online.please> wrote:
>> >> Hi,
>>
>> >> In an earlier post I received a perfect solution to use a visible
>> >> VbNet
>> >> USERCONTROL
>> >> in VB6 and get the intellisense. I'm rewriting the answer I got
>> >> beneath
>> >> my
>> >> new question which is =>
>>
>> >> I use a DLL, probably written in VB6, which is a NON VISUAL 'control'
>> >> (?).
>> >> We pass some arguments to the dll and the dll sends a mail using our
>> >> SMTP
>> >> server.
>> >> Using it like our code here unfortunately we lose the intellisense,
>> >> but is it possible, like the 'trick' with the vbnet usercontrol, to
>> >> obtain
>> >> it anyway ?
>>
>> >> That's how we use it, which works, but with no intellisense (after we
>> >> added
>> >> the reference in VB6 to the project):
>>
>> >> Private Sub SendMail()
>> >> Dim Dllzend As Object
>> >> Set Dllzend = CreateObject("SidSmtpV01.SendMail")
>> >> With Dllzend
>> >> 'adding receivers, sender, message, subject, etc... and
>> >> perform
>> >> the
>> >> communication...
>> >> .startCommunication
>> >> Set Dllzend = Nothing
>> >> End With
>> >> End Sub
>>
>> >> How could I get the intellisense like here beneath ?
>> >> *********VBnet Usercontrol solution*********** (visual control)
>> >> This works 200% !!
>>
>> >> Dim ctlDynamic As VBControlExtender
>> >> That will give you access to the "standard" intellisense.
>>
>> >> set ctlDynamic = controls.add("stlOperators.stlOperator", "myOps")
>> >> ctlDynamic.Visible = True
>>
>> >> You are supposed to be able to us the .object property of the
>> >> VBControlExtender object to bypass the wrapper. The question at this
>> >> point is...what is the actual type of your object?
>>
>> >> If "stlOperators.stlOperator" is your programatic id I'd try adding
>> >> this after assigning ctlDynamic:
>>
>> >> Dim ctlOperator As stlOperators.stlOperator
>> >> Set ctlOperator = ctlDynamic.object
>>
>> >> Tom
>>
>> >> --
>> >> Filiphttp://www.ww2air...
>> >> Official Site of the 101st Airborne - 463rd PFA
>> >> skype: airborne463pfa-fiwi
>> >> -------------------------------------------------- Hide quoted text -
>>
>> - Show quoted text -
>
>