|
Hey guys,
I'm having a very strange problem with my windows service and a COM component. I have a wrapper class (which is a user control) that instantiates the OCX and adds some functionality (reverse geocoding) to it. If I instantiate the wrapper class during the OnStart event of the windows service, everything works fine. But, if I create a new instance of the wrapper class outside of this event (after the service has started), the services freezes at the line
((System.ComponentModel.ISupportInitialize)(this.axMapPro1)).EndInit();. The wrapper class works perfectly in my windows forms application.
I have no idea what could be causing this, as I'm not an expert on COM interoperability. Any of you geniouses out there have any bright ideas?
Mike
|
|
|
|
|
If its VB.NET code, try adding DoEvent before ((System.ComponentModel.ISupportInitialize)(this.axMapPro1)).EndInit()
Sohail
modified 21-Apr-21 21:01pm.
|
|
|
|
|
It is C# code - what is DoEvent?
Sohail Kadiwala wrote: If its VB.NET code, try adding DoEvent before ((System.ComponentModel.ISupportInitialize)(this.axMapPro1)).EndInit()
|
|
|
|
|
I tried calling System.Windows.Forms.Application.DoEvents() before I call EndInit(), but am still experiencing the same problem. Any other ideas?
|
|
|
|
|
Try a loop.
Do<br />
Application.DoEvents()<br />
Loop Until < timedelay >
Try experimenting with TimeDelay and see if this fixes your problem.
Also attach a debugger and see where it hangs.
What OS are you using?
Sohail
modified 21-Apr-21 21:01pm.
|
|
|
|
|
I am facing a problem in calling CreateDisptach for any Class ID
Here's a brief summary of wat m trying to do
I create classes from a type library.... by using ClassWizard in VC++6.0 ,say of Excel, using the Excel.odl/Excel.exe file(2002 onwards)...
Now I get a class _Application....then I hve the following very simple code:
_Application app; // app is the Excel _Application object
if(!app.CreateDispatch("Excel.Application"))
{
AfxMessageBox("Error creating Dispatch");
}
Now...the program fails on this CreateDispatch always for any prog ID ..even if its not "Excel.Application".... Inside the 'CreateDispatch' function....the 'CoCreateInstance' function returns 'REGDB_E_CLASSNOTREG' as an error....
If I create the same automation object using VB then it works fine...also the same VC++ code works on any other mahcine...
I've called AfxOleInit() in InitInstance() ...its a dialog based mfc app
So I need help here... Wat is causing the code to fail on my machine ??
Thanks in advance
-- modified at 3:52 Tuesday 20th November, 2007
...A Programmer may or may not be the master of the programming language grammar...
|
|
|
|
|
AbbyIndian wrote: ...also the same VC++ code works on any other mahcine...
Is the code working(when placed in other application) or the application itself is working on other machine?
AbbyIndian wrote: 'CoCreateInstance' function returns 'REGDB_E_CLASSNOTREG' as an error
Check your registry for Excel.Application prog id and the corresponding CLSID.
Sohail
modified 21-Apr-21 21:01pm.
|
|
|
|
|
Hi...
thnx for the response...
its there in the registry..
also im able to launch the app using VB using the same Prog ID...
I think if there were some prob with th registry entries..then Excel wudn't hve launched
Regards,
AbbyIndian
...A Programmer may or may not be the master of the programming language grammar...
|
|
|
|
|
The same App is working on other machine...
Am I missing something in setting up the environment for creating dispatch..??
Regards,
AbbyIndian
...A Programmer may or may not be the master of the programming language grammar...
|
|
|
|
|
AbbyIndian wrote: The same App is working on other machine...
Am I missing something in setting up the environment for creating dispatch..??
If the same application is running on other machines then I would look at the machine that has problem. your statement makes me believe that the source is correct and there is some problem in the machine config. Or it could be that the ProgId-CLSID problem
Compare the CLSIDs (corresponding to ProgId) that are being picked by your C++ app and from VB app.
Following link from Microsoft support will helpHow To Call CLSID And ProgID Related COM APIs in Visual Basic[^]
Sohail
modified 21-Apr-21 21:01pm.
|
|
|
|
|
thnx for the help sohail...
i'll definitely try that
Regards,
AbbyIndian
...A Programmer may or may not be the master of the programming language grammar...
|
|
|
|
|
I am quite new to COM and such, and I am hoping some folks would know the answers:
1) does VariantClear free the emmory associated to arrays if the arrays are not locked to be specific:
[code]
//code to allocate an fill mySafeArray...
VariantInit(&myVariant);
myVariant.vt = VT_VARIANT | VT_ARRAY;
V_ARRAY(&myVariant)=mySafeArray;
//some COM call that uses myVariant
//free the contents of myVariant.
VariantClear(&myVariant);
[/code]
would this leak? as I am not explicitly freeing the SAFEARRAY, but the description from MSDN (http://msdn2.microsoft.com/en-us/library/ms221165.aspx) says it will free the contents of the SafeArray, but the examples I have seen for this COM API I am using all free the array by hand and then clear the variant so what is supposed to be done?
-- modified at 3:24 Monday 19th November, 2007
|
|
|
|
|
hi please tell
How i can change custom level of security (for example ActiveX control and plugins) of trusted sites, programmatically.
Is it possible by using IInternetSecurityManager interface.
Thanks.
destined to win
|
|
|
|
|
We have our current Web applications designed in ASP.We are planning to migrate this to .NET. Our applications interact with a lot of COM components hosted on MTS.We are planning to migrate all these applications along with the COM component to .NET,i.e., all ASP pages to ASPX and all COM components will be re written into .NET dlls. Okay so far so good.
As a part of our investigations, we are trying to come out with the best possible "replacement" for COM/MTS in .NET. We have thought of 3 techniques:
a.Put all the .net dlls(i.e., COM converted to .NET dlls) into a common folder and and refer them from our Web applications
b.Using .NET remoting: Hosting every .NET dll as a remotable object using a windows service.Our Web applications can consume this remotable object.
c.Using Reflection techniques: By Runtime binding them from Web applications
(Please Note: We do not want to look at Web Services as an option currently)
Can anyone let us know which among the 3 is the best option for converting COM to .NET equivalent(OR is there any other better method )
|
|
|
|
|
We are also currently looking at different options for our midlle tier, ideally we wanted to host inside COM+ which meant making use of .net enterprise services. Unfortunately the imposing com and com+ rules on our .net application is just not practical. We will now use WCF which effectively is remoting but properly layered where you can choose hosting environment and communication protocol.
|
|
|
|
|
Hai,
I am using two COM server Exe's with MFC support.
In my working environment a MFC application will call the COM interface of my COM server 1.
And my COM server 1 calls the interface of my COM server 2( This application has a window ).
On entering the interface call of COM server 2, i had logged that information into a file.
I had also logged the information while exiting that interface call from COM server 2.
In COM server 1, I had put a log just after this interface call (Interface call to COM server 2 )
Issue :- While analysing the log i had found that the interface call of COM server 2 is returned ( By analysing the IN and OUT log that is logged in COM server 2 ). But the log i had put in COM server 1 just after this interface call is not logged. But if I clicked on the window of COM server 2 or MFC application. The log that is put after the interface log is logged.
Can anybody help me?
Regards,
appoos
Known is a drop, unknown is an ocean
|
|
|
|
|
appoos wrote:
Issue :- While analysing the log i had found that the interface call of COM server 2 is returned ( By analysing the IN and OUT log that is logged in COM server 2 ). But the log i had put in COM server 1 just after this interface call is not logged. But if I clicked on the window of COM server 2 or MFC application. The log that is put after the interface log is logged.
Can anybody help me?
Are you sure that the log function you use on COM server one produces instant results? It's a common practice to just store information untill the right occasion comes up to complete the write. I would also look at how the call between the COM servers works. Their might be some problem in that.
Nathan
|
|
|
|
|
Hi All,
we are developing a marquee control for MS Access using VC++ 6.0. The marque text must be centered in the control. The centering of text work's fine in forms whether it is in design mode or running mode. But for reports the text shows centered in the design mode but in preview mode it goes wrong. The problem is actully found only with MS Access 2000 and it works fine for Acess 2002.
Can anyone help me to solve this problem.
thanks & regards
Nitheesh
|
|
|
|
|
I'm totally new to ActiveX and don't know where to get started. Hoping you can help.
My plan is to develop an ActiveX component (MSVC++) for the purpose of being used by IE. I need the ActiveX component to store information in persistent storage.
I have a bunch of HTML + JS that currently uses a signed Java applet for reading/writing files to the hard disc.
I would like to remove my applet in favour of ActiveX.
Anyone got pointers to sample sources and good guide to storing persistent data from ActiveX.
Lastly, when searching around the net I can't find a great deal of useful ActiveX stuff. Is ActiveX more commonly referred to as something else?
Appreciate any help you can offer. TIA.
|
|
|
|
|
earlp wrote:
I have a bunch of HTML + JS that currently uses a signed Java applet for reading/writing files to the hard disc.
I would like to remove my applet in favour of ActiveX.
Why do you want to do that? The signed java applet looks like a more appropriate tool to me.
Nathan
|
|
|
|
|
Valid question
My users are not very technical and may not have JVM installed, consequently when installing my software they need to install the Sun JVM. I know it sounds easy but it's a step that worries/scares them. So the current solution works but I'd like to simplify. I basically need my IE based "application" to work off-line with ability to store data and then at a later date to submit the data via a built-in SMTP client that I wrote in Java. By removing Java I lose the "save to local HDD" feature, DES encryption of the data and SMTP (which is used for sending me the data when they're online). SMTP, I will replace with a standard "form submit" to a back-end PHP process. Encryption of the data I would want to do in the ActiveX code.
So bottom line; it's all about simplifying for my very non-techie end-users.
I've thought about GoogleGears but I'm concerned that that may create additional complications with installation.
So here I am looking at ActiveX which looks promising; I can write code to easily access the HDD and from experience relatively straight forward to add DES encryption.
I'd welcome your thoughts.
|
|
|
|
|
I'm afraid I don't know much about using ActiveX or Automation with Internet Explorer. I haven't even used encryption, though it's something I want to learn. Also, I've noticed that no one else seems to have responded to your question. I think people might know more in the Web Developement forum.
Nathan
|
|
|
|
|
Heh... it's a deep well, Earl. Where would you like to start? I'll help where I can. I would say I'm intermediate developer now with activeX, but there is a huge conceptual hill you have to climb. When all of a sudden you say, "Wow!", you're at the top of the hill.
How's your VC++?
Charlie Gilley
Will program for food...
|
|
|
|
|
Hi Charlie. Thanks for your response. At this stage I'm trying to understand if my approach makes sense. e.g. to use ActiveX. If it is, then the next step is for me to understand what I need to do in order to have an ActiveX "thing" that allows my JS/HTML to call into it for purpose of reading and writing files. My VC++? .... I've been around for a while so fairly confident ... that said, I don't know where to start. Any advice?
|
|
|
|
|
Hi,
I'm writing a ATL COM Service (with the wizard on VC2003).
it look like that :
// IDeviceManager
[
object,
uuid("D9D097B1-FBE8-43D8-AEC6-6C740D01E911"),
dual,
helpstring("IDeviceManager Interface"),
pointer_default(unique)
]
__interface IDeviceManager : IDispatch
{
// Device manager.
[id(1), helpstring("method EnumDeviceDriver")] HRESULT EnumDeviceDriver([out,retval] LONG * pDeviceDriverCount);
....
}
// _IDeviceManagerEvents
[
dispinterface,
uuid("55370094-D0DE-438C-8D0A-E907A884F50B"),
helpstring("_IDeviceManagerEvents Interface")
]
__interface _IDeviceManagerEvents
{
[id(1), helpstring("method OnFireDeviceEvent")] HRESULT OnFireDeviceEvent ( [in] ULONG iDevice, [in] BSTR Param1, [in] BSTR Param2, [in] BSTR Param3, [in] BSTR Param4, [in] BSTR Param5, [in] BSTR Param6, [in] BSTR Param7, [in] BSTR Param8, [in] BSTR Param9 ) ;
};
// CDeviceManager
[
coclass,
threading("apartment"),
event_source("com"),
vi_progid("Manager.DeviceManager"),
progid("Manager.DeviceManager.1"),
version(1.0),
uuid("5CCB5A39-BF78-40A4-89E4-D0DBE82D8B7D"),
default(IDeviceManager),
helpstring("DeviceManager Class")
]
class ATL_NO_VTABLE CDeviceManager :
public IObjectWithSiteImpl<cdevicemanager>,
public IDeviceManager
{
public:
CDeviceManager ();
__event __interface _IDeviceManagerEvents;
DECLARE_PROTECT_FINAL_CONSTRUCT()
...
}
When i fire an event in EnumDeviceDriver it work.
The CDeviceManager container a thread that try to fire event but it failed with RPC_E_WRONG_THREAD(0x8001010EL).
I see a lot of article that say i need to modify advice and unadvice but with the Wizard i don't found how do it...
A link to expert exchange that explain a solution but not with the vc2003 wizard generated code: http://209.85.129.104/search?q=cache:HcncZHwaAUoJ:www.experts-exchange.com/Programming/Languages/CPP/Q_20528104.html+queryinterface+IDispatch+0x8001010E&hl=fr&ct=clnk&cd=1&gl=fr
If someone can explain me how do it with my code ?
Thanks
-- modified at 5:52 Thursday 8th November, 2007
...
|
|
|
|