|
For that the IDispatchEx was designed. Also the JScript and VBScript asks for that interface if you pass the object into the script engine.
For plain old VB there's a problem, that VB asks only for IDispatch AFAIK. Therefore you have to test, if VB supports the Ex version or go through the pain of manually defining your interface.
Anyway, I think, you have to cast your objects as Object only, because else the VB will store the values it receives during the compilation in the resulting binary - this means, if you changes the number/order of properties you're out of luck.
Don't worry to ask for more
|
|
|
|
|
hai all,
i created an arrow in MFC(exe) i want to export that arrow functioning into an ActiveX component. and i created that control. and i add my ctrl to toolbar, i getting the rectangular dotted lines and in that i arrow is placing but i don't want like that , i want to look like a "line which is provided by Windows".
In the program , i use, OnDraw ( , CRect rcBounds , ,) function , i take the rcBounds and i took two points (starting, ending) to draw the arrow. But , i want only a single point which is mousedown(which is at design time)..
not runtime.
plz Help.
Thanks in advance.
surya prakash
|
|
|
|
|
Hi,
I have an Activex DLL in VB6. I am creating threads within that using CreateThread API. When I try to access it from another application(std exe), it is giving run-time error. The same code works if it is made into a standard exe. Can anyone suggest the solution?
thx in adv.
--sandeep
|
|
|
|
|
I'm working on a plugin system, however I do not want end users to be able to discover what interfaces/coclasses I have implimented in the plugin DLLs.
If I remove the type library from the DLL's resources, will the plugged-into app still function correctly as long as it knows the definitions of the plugins' interfaces at compile-time?
If the plugin DLL does NOT contain a type library in itself, will the app and plugin still function properly?
|
|
|
|
|
The type library in the resources is just included for convenience so that other programmers can view the COM interfaces etc. but does not directly affect the actual interfaces implemented. If you remove this information from the DLLs resource (comment out the lines in the .rc file), the actual interfaces will still function normally.
|
|
|
|
|
Thanks
|
|
|
|
|
I know this very stupid Question ,just want to know which line to comment out in RC File .
Thanks
"I Think this Will Help"
Alok Gupta visit me at http://www.thisisalok.tk
|
|
|
|
|
Near the bottom of the .rc file, you will see a line like this:
1 TYPELIB "myproject.tlb"
If you comment out this line, then the type libary will not be included (assuming that APSTUDIO_INVOKED has not been defined).
If APSTUDIO_INVOKED has been defined, then you will need to comment out the TEXTINCLUDE section higher up in the .rc file which contain a similar TYPELIB line.
|
|
|
|
|
|
Hi..
I have an .ocx that is made with VB6 and which contains an interface to it's functions and properties.
I have used the aximp tool to create a dll file which I reference in my project.
When I try to access some of it's functions or properties I get the errormsg.:
"An unhandled exception of type 'InvalidActiveXStateException' occurred in axinterop.itdcinterfacelib.dll"
But when i set a breakpoint in my code and expands the variabletree for the interfaceobject in the Locals window and then steps forward in the code, it works fine...!!
I guess it has something to do with initzialisation, but I can't find a solution to this...
Please help me...
|
|
|
|
|
I am trying to write an Automation-Server with Borland C++ 6.0. The server has to run a model. The interface contains a method to actualize the state of the model. For this reason the method takes some values as parameters.
HRESULT actualize_model( [in] double value1, [in] double value2 );
There has no value to be to return. The only thing the client has to know is that the passed values has been sucessful processed. In other words the client must be sure that the method has been carried out.
The borland wizard that builds the com server encapsulates the method. The same if I write the client. I call Project->Import Type Library... and the wizard generates some code. All I can see is a Object which contains the following method without an HRESULT:
void actualize_model( double value1, double value2 );
Now my question: How is it possible for the client to recognise that the call has failed? I wonder why there is no exception thrown after a method call while the server is closed.
Andrew
|
|
|
|
|
I don't know how Borland's importing features work, but I do know that Visual C++ creates wrapper code which transforms:
HRESULT Method([in] long v, [out, retval] double* pResult) into
double Method(long v) throw(_com_error) . In other words, it creates code which looks kind of like this:
double WrappingMethod(long v) {
double result;
HRESULT hr = Method(v, &result);
if(FAILED(hr)) throw _com_error(hr);
return result;
} Perhaps the Borland code generates the same kind of code?
In Visual C++, you can tell the compiler not to generate this wrapper code, so that you'll get pure untampered interface definitions. Are there any such options for Borland?
--
I got nasty habits. I take tea at three.
-- Mick Jagger
I blog too now[^]
|
|
|
|
|
Hello,
Any body can pls help me how to pass multiple checkbox values to a ATL COM Dll.am new to ASP.
Thanks.
R.Srihari
|
|
|
|
|
Hello,
I have an unmananged COM object that at one time would send error messages to a text file that was created by using
ofstream outfile;
outfile.open("C:\\WhatHapped.txt");
but, I don't know why it stopped working.
The COM object is used in our asp.net program that is using c# code to grab the com functions.
Could there be something in web.config that isn't allowing the file being created in the COM object?
Thank you,
Bill
|
|
|
|
|
I need to invoke a script function programmatically through c++. I have the relevant html doc and there will be several script tags. I have the collection of tags and loop through them to find the script function. However, when I get to the script element that I know contains the function, the GetIDsOfNames method always returns "Unknown name."
CODE SAMPLE
CComBSTR bstrMember("SCRIPT");
pDoc3->getElementsByTagName(bstrMember, &pEltColl);
long len;
pEltColl->get_length(&len);
for(int i = 0; i < len; i++ )
{
CComPtr<idispatch> pEltDisp = NULL;
hr = pEltColl->item( CComVariant(i), CComVariant(i), &pEltDisp);
if(SUCCEEDED(hr))
{
IHTMLScriptElement* pElem = NULL;
hr = pEltDisp->QueryInterface( IID_IHTMLScriptElement, (void**)&pElem );
IDispatchPtr spDisp( pElem );
if(SUCCEEDED(hr))
{
OLECHAR FAR* bstrMember = L"MyFunction";
DISPID dispid = NULL;
**************Things go wrong here****************************
hr = spDisp->GetIDsOfNames(IID_NULL,&bstrMember,1,
LOCALE_SYSTEM_DEFAULT,&dispid);
if(SUCCEEDED(hr) && dispid )
{
DISPPARAMS dispparams;
memset(&dispparams, 0, sizeof dispparams);
EXCEPINFO excepInfo;
memset(&excepInfo, 0, sizeof excepInfo);
CComVariant vaResult;
UINT nArgErr = (UINT)-1;
//Call JavaScript function
hr = pEltDisp->Invoke(dispid,IID_NULL,0,
DISPATCH_METHOD,&dispparams, &vaResult,&excepInfo,&nArgErr);
}
}
}
}
Suggestions would be welcome
|
|
|
|
|
I tried using the type library for Microsoft Mappoint to generate classes I need to use the activex control on my dialog, but couldn't seem to see any way to make that work. Now I've tried generating classes from the .ocx file, and that seems to give me all the classes I need for what I'm trying to do. However, I have no idea how to actually display the control on my dialog. There's a CMappointCtrl class that was generated, and all I see in the member functions is CreateDispatch(), not a Create() since it's not derived from CWnd. Also, there's a bunch of other classes that came from the .ocx that I would like to use (like CRoute,CMap). How can I use these with the control? Any help is appreciated. thanks
My articles
www.stillwaterexpress.com
BlackDice
|
|
|
|
|
no.1 I've disabled all the virus software ,fireware&Internet Assistant
no.2 I've try to import the related item into register and copied dll files to system directory
but the Activex Control can not work still, hot can... how can I do?
<object id="factory" viewastext="" style="display:none"
="" classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814" codebase="/scriptx/ScriptX.cab#Version=6,1,431,1">
|
|
|
|
|
Hello All,
I have a question which I hope my esteemed peers here will be able to provide some comments :
1. After some time of researching, I found that a COM Object in a COM EXE Server cannot decide on its own Apartment Model (Apartment, Multithreaded, etc).
2. This is so despite indicating the model you want when creating an ATL COM object inside an EXE Server using the ATL Wizard.
3. The way to indicate the Apartment Model for your COM Object is to place your call to CoRegisterClassObject() on your COM Object Class Factory in a thread that has been initialized with CoInitializeEx(NULL, COINIT_MULTITHREADED) or CoInitializeEx(NULL, COINIT_APARTMENTTHREADED).
Any comments on this from anyone ?
Many Thanks, All,
Bio.
|
|
|
|
|
Hi Bio
Inspecting the CAtlExeModuleT class (from the ATL classes shipping with VC.net 2003), I notice the InitializeCom method, quoted below;
<snip>
static HRESULT InitializeCom() throw()
{
#if ((_WIN32_WINNT >= 0x0400 ) || defined(_WIN32_DCOM)) & defined(_ATL_FREE_THREADED)
return CoInitializeEx(NULL, COINIT_MULTITHREADED);
#else
return CoInitialize(NULL);
#endif
}
<snip>
which would lead me to believe that by setting _WIN32_WINNT, _WIN32_DCOM, and/or _ATL_FREE_THREADED to the desired values, you would be able to have the server enter the apartment of your choice.
HTH
Martin
|
|
|
|
|
Hello Martin,
Thanks very much for your advise, Martin. I was also observing the difference between a COM DLL Server and a COM EXE Server in terms of specifying the Apartment Model of objects.
DLL server objects indicate their individual Apartment Model in the registry. The ATL Wizard arranges for this. One advantage of using a DLL-based server is that you can specify two objects of different Apartment Models in the same server.
For Exe Server objects, I'm now wondering if it would be possible to specify two object classes with different Apartment Models. I think it may not be possible to do this using ATL. You would have to manually create threads to register the class factories. I'll do some experiments to confirm this.
Thanks again, Martin,
Bio.
|
|
|
|
|
i Don't know if this the right thread to post.. but...
our company is planning to buy a third party ActiveX/COM component.
But we need to use it in Java Code... I was wondering if I could call the COM component using J#?
|
|
|
|
|
I am wanting to use COM controls in my management scripts written in VBS. Which controls are available to me and how can I use them.
Thanks in advance.
God answers knee mail.
|
|
|
|
|
I am porting an app from VB to C++, it uses Crystal Reports and in the VB app an event is handled using the "Handles" operator, I now need to handle that event in C++.
I am #import'ing the CRAXDDRT20.dll and using the IApplicationPtr and IReportPtr objects to initialise and start a report export, the event fired is called "BeforeFormatPage" in VB, how would I go about handling it in C++? (This is the first time I have used COM in C++ BTW)
|
|
|
|
|
|
I have read that and played around with the example but I just don't get it.
I have found this code in the .tlh file for my object:
#pragma implementation_key(2)
inline HRESULT CRAXDDRT20::IReportEvent::BeforeFormatPage ( long PageNumber ) {
return _com_dispatch_method(this, 0x2, DISPATCH_METHOD, VT_EMPTY, NULL,
L"\x0003", PageNumber);
}
Does that give any clues as to what direction I should be heading in.
Sorry if this sounds really dumb, I feel really dumb, I can normally understand and make most things work but COM is really baffling me
Cheers,
Dan.
|
|
|
|
|