OLE help for newbie
- From: louloizides@xxxxxxxxx
- Date: 11 Aug 2006 06:17:30 -0700
I program a lot of stuff in ASP and VB. I needed an application that
could run on a server, handle data and be manipulated by VBScript or
something similiar. I decided to take a crack at writing a VC++ OLE
server. I can do all the C++ stuff I need to, but when it comes to the
OLE server I keep running into walls. I've gotten to the point where I
used the wizard to create the type library and method. Say I have these
two methods in the type library:
[id(4), helpstring("method TEST4")] HRESULT TEST4([out] DOUBLE* TestD);
[id(6), helpstring("method TEST6")] HRESULT TEST6([out] BSTR* TVAL);
And they're implimented like this:
STDMETHODIMP CLOUSDB::TEST4(DOUBLE* TestD)
{
AFX_MANAGE_STATE(AfxGetAppModuleState());
CString ShowS;
ShowS=System::Convert::ToString(TestD->ToString());
MessageBox(NULL,(LPCSTR) ShowS,"hi", MB_OK);
*TestD=(DOUBLE) 4;
return S_OK;
}
STDMETHODIMP CLOUSDB::TEST6(BSTR* TVAL)
{
AFX_MANAGE_STATE(AfxGetAppModuleState());
return S_OK;
}
Then in VB6, I have:
Dim TEST As LOUSDB
Set TEST = CreateObject("DB2.LOUSDB.1")
Dim TestDbl As Double
a.TEST4 TestDbl
a.TEST6 TestStr$
Now, for TEST4 this will show the value of TestDbl in a message box.
For TEST6, nothing happens. What I want to do, however, is change the
values of the variables in VB6. After passing TestDbl into the
function, I want it to equal something else. I would like TestStr to
equal something like "Hello" for now, just so I can understand how this
all works.
Any help would be greatly appreciated. At some point, I'll buy a book
or something but right now I'm just trying to see how far I can get by
tinkering. It usually works ok for me. Thanks.
P.S. If I have [out,retval] in the type library, VB6 won't allow me to
pass any arguments. Why? I need this to work in ASP, so I always
figured that VB6 was closer to VBScript.
.
- Follow-Ups:
- Re: OLE help for newbie
- From: louloizides
- Re: OLE help for newbie
- Prev by Date: Re: Tooltips not shown in dll's modeless dialog
- Next by Date: Re: OLE help for newbie
- Previous by thread: Re: Does Microsoft Still Support MSVC V6?
- Next by thread: Re: OLE help for newbie
- Index(es):
Relevant Pages
|