Hello,
Thanks for the code snipet .. its very similar to mine.
The BIG question is the definitions for the CLSID and IID (that I specify in
my .NET) are not being generated in my tlb file - in fact they seem to being
ignored.
---- VB.NET code. --------
Imports System
Imports System.Runtime.InteropServices
Namespace MapiForm
<GuidAttribute("20000000-3371-0000-AF8A-AFFECC1B0967"),
InterfaceTypeAttribute(ComInterfaceType.InterfaceI sDual)> _
Public Interface _Form
<DispId(10)> _
Sub ShowForm(ByVal sCN As String, ByVal sGUID As String)
<DispId(20)> _
Event ShutDownForm()
End Interface
<GuidAttribute("10000000-3371-0000-AF8A-AFFECC1B0967"),
InterfaceTypeAttribute(ComInterfaceType.InterfaceI sIDispatch)> _
Public Interface MAPIFormEvents
Sub ShutdownForm()
End Interface
<GuidAttribute("30000000-3371-0000-AF8A-AFFECC1B0967"),
ClassInterface(ClassInterfaceType.None),
ComSourceInterfaces(GetType(MAPIFormEvents))> _
Public Class Form
Implements _Form
Public Event ShutDownForm() Implements _Form.ShutDownForm
Private WithEvents oForm As New Form1
Public Sub ShowForm(ByVal sCN As String, ByVal sGUID As String)
Implements _Form.ShowForm
oForm.txtCON.Text = sCN
oForm.txtGUID.Text = sGUID
oForm.Show()
End Sub
Private Sub oForm_ShutDownForm() Handles oForm.ShutDownForm
RaiseEvent ShutDownForm()
End Sub
End Class
End Namespace
-----------------------------
--
Michael Tissington
http://www.oaklodge.com http://www.tabtag.com
"stand__sure" <st*********@hotmail.com> wrote in message
news:11*********************@g49g2000cwa.googlegro ups.com...
Michael Tissington wrote: Yes, I'm creating a .NET component and trying to use if BOTH from VB 6
and
VC++.
The class functions correctly in VB6
In VC++ I #import the type library but when I look at the generated tli
and
tlh files the guids are NOT the guids that I specified when I used the
GuidAttribute. In addition there are no definitions for the interfaces
that
I created in .NET (there are definitions for the Methods and Events but
again they do not have the Despid that I assigned to them)
VB is doing the work behind the scenes that you must explicitly do in
c++
AGAIN, PLEASE POST CODE -- IT IS IMPOSSIBLE TO KNOW WHAT YOU ARE DOING
WITHOUT AN EXEMPLAR!
your code should (probably) look something like this (meta-code)
//
HRESULT hr;
IUnknown * punk;
hr = CoCreateInstanceEx(CLSID,punk,...);
//test hr
void ** ppobj;
hr = punk->QueryInterface(IID,ppobj);
//test hr
hr = punk->AddRef();
//