|
what do you mean "interface cannot be instantiate"?
P.S. You must use types recognized by VB. What is the error? Show the IDL of that interface.
soptest
|
|
|
|
|
The problem is now half-solved. It was about registering the interface in the registry. To do this, i've added _Module.RegisterServer(TRUE) in the InitInstance method. It works now, but when creating the object, a new instance of the MFC application is started to act as server, even if another one is already running.
Do you know how to make the running one be the server also?
rechi
|
|
|
|
|
On ATL ActiveX EXE-server, such strategy (when creating the object, a new instance of the application is started) is realized by
<br />
hRes = _Module.RegisterClassObjects(CLSCTX_LOCAL_SERVER, REGCLS_SINGLEUSE);<br />
instead of
<br />
hRes = _Module.RegisterClassObjects(CLSCTX_LOCAL_SERVER, REGCLS_MULTIPLEUSE);<br />
I do not know a MFC-server, but something like this take a place.
With best wishes,
Vita
|
|
|
|
|
Look at COleObjectFactory::m_bMultiInstance and its initialization for your class.
With best wishes,
Vita
|
|
|
|
|
I'm trying to test some programs on win2k whith IE 6.0 who use an activex dll, but on my machine, these programs didn't work. Well, when i tested them on a machine with win98 they worked.
Could you help me?
|
|
|
|
|
Why didn't they work, what ssort of errors or behavior did you see?
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Thank you for help me, kilowatt.
The error is that all call to functions, objects of dll's aren't done. Seems that IE can't see references to dlls.(Any error are shown)
|
|
|
|
|
Have you tried to create an object or ActiveX control that resides in this DLL in one of your applications without IE 6.0. Try using the ACtiveX control container test tool in visual studio. This is just to make sure that the DLL is registered properly and you can use it outside of IE, because it may not be a problem if IE.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Hi!
Does Anyone know how can I sign a Dll? Is there a free program to do that for me?
Thanks!
|
|
|
|
|
use signcab.exe to sign controls. Read up more on Internet Component Download at msdn.
|
|
|
|
|
Thank you Amit Dey!
It would be interesting if there was a free program to do that to me. All the information I read was for testing only.
Could anyone help me?
|
|
|
|
|
I guess I have basic knowledge of COM/ATL.. Any suggestions on a good book to learn more COM/ATL (intermediate/Expert level).
Thanks
|
|
|
|
|
Hello, see my answer to Nish
COM ATL BOOK
Cheers,
Joao Vaz
A person who is nice to you, but rude to the waiter, is not a nice person - Natalie Portman (Padme/Amidala of Star Wars)
|
|
|
|
|
ATL Internals by Brent Rector and Chris Sells if you want to learn ATL.
Essential COM by Don Box if you truely want to understand COM.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
My server application retrun variant and can have any one of data type int, bstr, date, ulong,
I am able to fetch all the value that is returned by VC server except ULONG value from my VB client application.
Please tell me that is there is any way to get ULONG value from variant in Visual basic.
Regards
|
|
|
|
|
ULONG is not a compatible type with VB. Try using CInt function to see whether it works or return the ULONG as long from the server
|
|
|
|
|
I've developed a DCOM component that accesses database by ODBC.
The problem is that if I use Interbase database I can't open the database.
I've made a component on Delphi and when I've tried to access it remotly an error is returned which says the table doesn't open.
When I've made the component on VC++ an error returns saying a denied access message.
When I've used MS Access database just changing the ODBC alias, everything works well.
The error has occured only when I've accessed the component through DCOM and hasn't occured when I've accessed it locally, through COM.
One of the customer's requirements is that the database MUST be on Interbase, and not on MS Access. Because of that I've needed an ODBC driver for Interbase that could be accessed remotely through DCOM.
Thank you in advance.
Katiúcia Freitas da Silva
e-mail: katiucia@inatel.br
ICQ#: 127458845
|
|
|
|
|
How is the DCOM component running as a service or a a local server?
If it is running as a service try making it run as a distinguished user.
For a local server try running it as the interactive user.
|
|
|
|
|
Thank you very much for helping us!
Your answer has helped us to solve our problem.
You've got all what we needed.
Katiúcia Freitas da Silva
|
|
|
|
|
I need to pass some structure information from a method of an interface. I think i should use a VARIANT to make it run in VB, because it doesn't support ** pointers.
Do you know how?
rechi
|
|
|
|
|
It depends what it is you are trying to pass. You could use a VARIANT * (VT_BYREF | VT_VARIANT)
|
|
|
|
|
It doesn't work. The code that fails in VB is:
STDMETHODIMP CInterface::Method(VARIANT *ppp)
{
TestStructure *p=new TestStructure;
p->Value=10;
ppp->vt=VT_VARIANT | VT_BYREF;
ppp->pvarVal=(VARIANT *)p;
return S_OK;
}
What is wrong?
rechi
|
|
|
|
|
First define structure in IDL file (Example):
typedef struct MY_STRUCT
{
long lVal;
BSTR wsVal;
} _s1;
[
object,
uuid(BC922B3D-682B-11D6-A110-00B0D0C3D9BD),
dual,
helpstring("ITest Interface"),
pointer_default(unique)
]
interface ITest : IDispatch
{
[id(1), helpstring("method Foo")] HRESULT Foo([in,out] _s1 *sOut);
};
[
uuid(BC922B31-682B-11D6-A110-00B0D0C3D9BD),
version(1.0),
helpstring("ForVB 1.0 Type Library")
]
library FORVBLib
{
importlib("stdole32.tlb");
importlib("stdole2.tlb");
[
uuid(BC922B3E-682B-11D6-A110-00B0D0C3D9BD),
helpstring("Test Class")
]
coclass Test
{
[default] interface ITest;
};
};
C++ implementation of the function returning that structure to VB app.
STDMETHODIMP CTest::Foo(_s1 *sOut)
{
if(!sOut)
return E_POINTER;
sOut->lVal = 12345;
sOut->wsVal = ::SysAllocString(L"Some string.");
return S_OK;
}
This is VB code to get the structured data:
Private Sub Command1_Click()
Dim s As FORVBLib.MY_STRUCT
Dim obj As FORVBLib.Test
Set obj = New FORVBLib.Test
obj.Foo s
End Sub
soptest
|
|
|
|
|
The following code works fine..
CoInitialize(NULL);
m_cRichEditCtrl.Create(ES_READONLY, rect, GetDlgItem(IDC_G), 1);
However the following fails..
CoInitializeEx(NULL, COINIT_MULTITHREADED);
m_cRichEditCtrl.Create(ES_READONLY, rect, GetDlgItem(IDC_G), 1);
I remember having read somewhere that RichEdit control uses OLE (ie CoInitialize(NULL)). Is that the problem ?
Any solution ? Thanks
|
|
|
|
|