|
To prevent IIS crash, you could try to register your com object in COM+ as a "Server" application. Here is what you need to do:
1. Register your com object.
2. Create a blank COM+ app, make sure it is a "Server" not a "Library" app.
3. Import your com object (add it as a component to the COM+ app).
Then you can use it in your ASP pages (by calling CreateObject). The com object will not be running within the IIS process. You have to test whether this solves your problem or creates a new problem, etc.
The best approach is to fix the bug so that it won't crash, of course.
Good luck.
My articles and software tools
|
|
|
|
|
Hi,
I have a doubt. Can we make use of a component developed in 16 bit Operating system in 32 bit O.S. If yes, then how does a 16 bit component will be resolved in 32 bit O.S ? Is there any work around to call 16 bit component in 32 bit component ?
Please give me a brief solution with example,if possible.
Thank you
|
|
|
|
|
Hi dear
u can call a component devloped in 16 bit OS in 32 bit OS using Thunking mechanism.
there are 32-bit Generic Thunk Functions using which u can call ur component.
One can also access the component devloped in 32 bit os in 16 bit OS ,using the same thunking mechanism for which u have to use 16-bit Generic Thunk Functions.
u can refer to "THUNKING" topic of MSDN.
Abhishek Srivastava
Software Engg (VC++)
India ,Noida
Mobile no 9891492921
|
|
|
|
|
I have a COM object I'm using in an ATL project. One of the COM object's exposed interfaces is called IWTonload. According to the COM object's documentation, a class implements the IWTonload by having a method in the class called .onloadComplete.
In Java, I would go
<br />
public myClass implements IWTOnLoad<br />
{<br />
...<br />
void onLoadComplete()<br />
{<br />
}<br />
<br />
}
In C# I would go
<br />
public myClass: IWTOnLoad<br />
{<br />
void onLoadComplete()<br />
{<br />
}<br />
}
How would I implement this IWTOnLoad COM interface in a C++ ATL project? Any help is greatly appreciated.
The graveyards are filled with indispensible men.
|
|
|
|
|
Hi there ,
In ATL it can be done very easily , insert an ATL class in ur project .
Now insert ur component in the same project .
In Class view , right click on ur ATL class , a menu will pop up , click on inplement interface.
now browse for ur interface select it and click on implement.
Abhishek Srivastava
Software Engg (VC++)
India ,Noida
Mobile no 9891492921
|
|
|
|
|
I've heared about such a tool by Microsoft, but I can't find it.
I need to monitor all the COM/RPC calls a process makes...
thanks
|
|
|
|
|
Because it doesn't to me.
Exception:----------------------------------------------------------------------------------
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in Test Form exe Additional information: COM object with CLSID {3050F48A-98B5-11CF-BB82-00AA00BDCE0B} is either not valid or not registered.
From Registry:------------------------------------------------------------------------------
[HKEY_CLASSES_ROOT\CLSID\{3050F48A-98B5-11CF-BB82-00AA00BDCE0B}\InprocServer32]
"Class"="mshtml.CEventObjClass"
"Assembly"="Microsoft.mshtml, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
"RuntimeVersion"="v1.0.3705"
[HKEY_CLASSES_ROOT\CLSID\{3050F48A-98B5-11CF-BB82-00AA00BDCE0B}\InprocServer32\7.0.3300.0]
"Class"="mshtml.CEventObjClass"
"Assembly"="Microsoft.mshtml, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
"RuntimeVersion"="v1.0.3705"
From Gacutil /L: (GAC)----------------------------------------------------------------------
Microsoft.mshtml, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, Custom=null
And Finally my own investigation of 3050f48a-98b5-11cf-bb82-00aa00bdce0b using---------------------------
Dim csCEventObjCLASS As New Guid("3050F48A-98B5-11CF-BB82-00AA00BDCE0B")
Dim C_CEventObjCLASS As Type = Type.GetTypeFromCLSID(csCEventObjCLASS, True)
CLASSName mshtml.CEventObjClass
IsClass) TRUE
IsCOMObject) TRUE
IsInterface) FALSE
IsPointer) FALSE
Namespace) mshtml
Module) MSHTML.dll
Name) CEventObjClass
GUID) 3050f48a-98b5-11cf-bb82-00aa00bdce0b
Assembly) Microsoft.mshtml, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
Assembly.Location) c:\winnt.0\assembly\gac\microsoft.mshtml\7.0.3300.0__b03f5f7f11d50a3a\microsoft.mshtml.dll
Assembly.CodeBase) file:///c:/winnt.0/assembly/gac/microsoft.mshtml/7.0.3300.0__b03f5f7f11d50a3a/microsoft.mshtml.dll
Assembly.GlobalAssemblyCache) TRUE
Assembly.FullName) Microsoft.mshtml, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
Assembly.GetCallingAssembly) System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Assembly.GetEntryAssembly) Test Form Focus, Version=1.0.1434.13227, Culture=neutral, PublicKeyToken=null
Assembly.GetExecutingAssembly) Test Form Focus, Version=1.0.1434.13227, Culture=neutral, PublicKeyToken=null
Assembly.GetExportedTypes) System.Type[]
Assembly.GetFiles) System.IO.FileStream[]
Assembly.GetLoadedModules) System.Reflection.Module[]
Assembly.GetManifestResourceNames) System.String[]
Assembly.GetReferencedAssemblies) System.Reflection.AssemblyName[]
Assembly.GetModules) System.Reflection.Module[]
AssemblyQualifiedName) mshtml.CEventObjClass, Microsoft.mshtml, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
FullName) mshtml.CEventObjClass
Thanks, GregC
|
|
|
|
|
I don't think it's a matter of registration. After all Microsoft.mshtml is the interop assembly for InternetExplorer's mshtml.dll, and this wasn't registered Internet Explorer wouldn't work.
This exception can be thrown more about an interop issue (bad use of objects or interfaces, or even if the object inside is not yet initialized.
When I had this kind of issues last year, I tried adding code to my code sequence (even with stupid method calls) only to make sure the underlying objects were initialized and valid.
Good luck!
RSS feed
|
|
|
|
|
Hi Stephane,
Yes it is Interop but isn’t the underlying code in MSTHML.dll? Or am I missing something? The statement is also so simple.
Dim objevent As New CEventObj()
Of interest when I create a Console.WriteLine(objevent.returnValue),
property in the CeventObjClass, Studio based on the dim does not complain and shows me the correct object list to select .returnValue from the class.
Thanks, GregC
|
|
|
|
|
Hi Stephane,
One more thing even if I spell it all out like
Dim objevent As New mshtml.CEventObjClass()
I get the same result
Thanks, GregC
|
|
|
|
|
gregcost wrote:
Yes it is Interop but isn’t the underlying code in MSTHML.dll?
Exactly.
Interop issues can be one of these, in order of importance :
- underlying (unmanaged) object not initialized
- bad parameter or interface marshalling
- security, access denied
In your case, if could be an interop issue, but it could just be that the object you are using is lacking a context.
I have just taken a look at mshtml.dll, and CEventObj is an interface, not an object. So you will never successfully create an instance of CEventObj (it's a pity that they have given it such a name).
The implementation for the interface is CEventObjClass.
Creating an instance of CEventObjClass should work better.
That being said, I think it's best to stick with an existing sample. By default, I wouldn't pledge that you can create a useful and relevant instance of CEventObjClass by yourself. Most of the time with mshtml.dll, what you do is "get" objects down from the current document object.
Your code might be ok, I don't know though.
RSS feed
|
|
|
|
|
Hi Stephane,
Sorry, yes the dim I wrote as I was writing the message is the interface, I left off the Class suffix. I have tried it a bunch of different ways
Dim objevent As New CEventObjClass()
Dim objevent As New mshtml.CeventObjClass
In fact none of the classes will work in the dll. I get the same COMException for any I try.
What I’m actually trying is to get MS Knowledge Base Article 279535 to work. The short program uses a property in the class CEeventObjClass to disable script error checking for forms hosting a WebBrowser control. For whatever reasons Microsoft did not implement this disabling script feature for WebBrowser controls by selecting it from IE (even through it is really the same object). It is available for IE. So they supply you with a code example in VB6 not VB.net to address this problem. Actually I can understand why they did it this way because you might want to disable script error checking for IE but not completely across any applications that host Web controls on the same system. So since I’m trying to rework MS code I’m not flying to blind… Or am I!!!!
Well, if you think of anything please let me know and thanks for your help!
Thanks, GregC
|
|
|
|
|
Don't get it wrong, but I think you don't understand what you are doing.
The support KB article you refer to NEVER creates an instance of the CEventObjClass.
Quite the contrary, the only thing it does is change a property value on the event interface being passed by the IE event dispatch mechanism.
In the support KB article, objEvent is that interface. It's created by IE and passed along to subscribers.
Now that I know what's going on, I wonder what's your problem here. You just need to reproduce the code that is given in the support KB article. There is no "New event something " involved in here.
Good luck!
RSS feed
|
|
|
|
|
I’m a Network engineer I’m not programmer heavy and I think I understand what you are saying.
I did try the code exactly as stated in the article but I ran into other problems (below) with the dim statements. What I was attempting to do was to go a different way. I was hoping I could set the field True in the CEventObjclass (which I thought this code is trying to do) and if I could do that I was hoping I could set return value true always regardless of an onError event so that I could continually disable script error checking.
Ok that being said are you saying that the field being made available through the interfaces (really address pointers), passed in a sense to its subscribers (a webbrowser control) is really a property of IE? Am I correct in understanding what you are saying?
I’m getting Com errors with the standard dims described in the article.
The first Interface dim works fine:
dim withevents for HTMLDocument
The second interface dim does not work:
Dim WithEvents objwind As New mshtml.HTMLWindow2()
Additional information: COM object with CLSID {D48A6EC6-6A4A-11CF-94A7-444553540000} is either not valid or not registered.
And of course the third does not work either:
Dim objevent As New CEventObj() did not work as stated in the article
Additional information: COM object with CLSID {3050F48A-98B5-11CF-BB82-00AA00BDCE0B} is either not valid or not registered.
In trying to resolve the COMException for the dim of Interface CEventObj I have tried un-registering and re-registering the interop dll Microsoft.mshtml.dll in \Program Files\Microsoft.net\Primary Interop Assembles\
Any ideas?
I get the same kind of error when trying the code it exactly in the KBase Article. Please let me know if my understanding now about passing the field is correct.
After all I never get upset about this stuff everything we do is a learning experience.
Thanks, GregC
|
|
|
|
|
gregcost wrote:
CEventObjclass (which I thought this code is trying to do)
Change your glasses.
gregcost wrote:
I could set return value true always regardless of an onError event so that I could continually disable script error checking.
Yes, there is another way to disable script error when you are hosting the web control. The way it is explained in the support KB article is a transient way of disable script errors. In fact, they are not disabled. You subscribe the onerror event, and wheenever an error occurs you block it rather than let IE popup a message box.
This is transient. This code must be executed for each new web page being loaded.
There is a way to do it for the entire life cycle of your application, and without changing the users options in the registry (Internet options / Advanced / ...). I guess you can find a support KB article but from what I remember, you have to use the ExecCmd method and pass it a special OLECMDID_DISABLEERRORXXXXXXX cmd id (I don't remember the name). You won't find the cmd id in the MSDN doc though, for some reason.
RSS feed
|
|
|
|
|
I like the way to use COM wrapper class which the ClassWizard produce for me, but I cannot figure out how to implement the connection point through it. The COM events are all been commented out saying
// method 'ExecutionOver' not emitted because of invalid return type or parameter type ,...
kind of boring, anyone has some idea?
thanks in advance
|
|
|
|
|
I'm trying to set a property in the following class:
Public Class CEventObj
Member of mshtml
The property is:
Public Property returnValue As Object
Member of mshtml.CEventObj
When I try:
Dim objevent As New mshtml.CEventObjClass() OR
Dim objevent As New mshtml.CEventObj() OR
Dim objevent As New CEventObjClass() OR
Dim objevent As New CEventObj()
I get the following error, also the CSLID from the Object Browser of 3050F558-98B5-11CF-BB82-00AA00BDCE0B is different from the COMException error message
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in Test Form .exe Additional information: COM object with CLSID {3050F48A-98B5-11CF-BB82-00AA00BDCE0B} is either not valid or not registered.
The Registry states the CSLID 3050F48A-98B5-11CF-BB82-00AA00BDCE0B from COMError message is the following:
HKEY_CLASSES_ROOT\CLSID\{3050F48A-98B5-11CF-BB82-00AA00BDCE0B}...
default(not set)
HKEY_CLASSES_ROOT\CLSID\{3050F48A-98B5-11CF-BB82-00AA00BDCE0B}\InprocServer32...
Assembly(Microsoft.mshtml, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a)
Class(mshtml.CEventObjClass)
Runtime version(v1.0.3705)
The Registry states the CSLID 3050F558-98B5-11CF-BB82-00AA00BDCE0B from the Object Browser view is the following:
HKEY_CLASSES_ROOT\Interface\{3050F558-98B5-11CF-BB82-00AA00BDCE0B}
default(DispCEventObj)
HKEY_CLASSES_ROOT\Interface\{3050F558-98B5-11CF-BB82-00AA00BDCE0B}\ProxyStubClsid...
default(00020420-0000-0000-C000-000000000046)
HKEY_CLASSES_ROOT\Interface\{3050F558-98B5-11CF-BB82-00AA00BDCE0B}\ProxyStubClsid32...
default(00020420-0000-0000-C000-000000000046)
HKEY_CLASSES_ROOT\Interface\{3050F558-98B5-11CF-BB82-00AA00BDCE0B}
TypeLib(3050F1C5-98B5-11CF-BB82-00AA00BDCE0B)
Just to be sure I ran regsvr32 mshtml.dll sucessfully
What is going on? the CSLId from the COMException InprocServer32 points to Class(mshtml.CEventObjClass). H E L P!
Thanks, GregC
|
|
|
|
|
Hi all,
I have a Windows 2000 Service that can be accessed via a COM interface. In fact I used the "DrawServ" example from the MSDN as a pattern for this. Talking to the service with this COM object works fine, like this (VB in an Excel sheet):
Dim myService As CMyServ
Set myService = New CMyServ
test = myService.getLong() 'simply returns a long
Now I tried to create a more complex method call that should return another COM object.
Dim doc As CMyDocument
doc = myService.getDocument()
For this I had to create a new type in the IDL but using the ATL wizard delivered many errors (missing header files, etc.). So I decided to make all type declarations / definitions for CMyDocument manually (IDL is appended below).
Now my first question is: Where shall I create the document object?
In VB like this?:
Dim doc As CMyDocument
Set doc = New CMyDocument
doc = myService.getDocument()
Or in the implementation of getDocument() using CoCreateInstance()?
Anyway (and I tried both ways!) whenever I'm asking for memory for a CMyDocument the appropriate call needs about 15 seconds only to tell me that "something went wrong". In Basic I get a runtime error without an error code, in VC++ I get CO_E_SERVER_EXEC_FAILURE (=0x80080005L) as a result index.
This leads me to my second question: What's wrong?
Of course all necessary registration and initialization has been done, has it? I'm checking this the whole day...
Any help is appreciated,
thanks in advance,
Tobias
Here is an excerpt (only the important lines) of my IDL:
[
object,
uuid(3CB0E4BF-675A-4d5a-BC23-440F2B92BF5A),
dual,
helpstring("IMyDocument Interface"),
pointer_default(unique)
]
interface IMyDocument : IDispatch
{
import "oaidl.idl";
[propget, id(1), helpstring("property ID")] HRESULT ID([string, out, retval] char ** pVal);
[propput, id(1), helpstring("property ID")] HRESULT ID([string, in] char * newVal);
}
[
object,
uuid(330E9E75-DF48-11CF-8E2C-00A0C90DC94B),
dual,
helpstring("IMyServ Interface"),
pointer_default(unique)
]
interface IMyServ : IDispatch
{
import "oaidl.idl";
[
id(3),
helpstring("method getLong")
]
HRESULT getLong([out,retval] long* result);
[
id(4),
helpstring("method getLastUsedDocuments")
]
HRESULT getDocument([out,retval] IMyDocument** document);
};
[
uuid(330E9E73-DF48-11CF-8E2C-00A0C90DC94B),
version(1.0),
helpstring("MyServ 1.0 Type Library")
]
library MySERVLib
{
importlib("stdole32.tlb");
[
uuid(330E9E79-DF48-11CF-8E2C-00A0C90DC94B),
helpstring("MyServ1 Class")
]
coclass CMyServ
{
[default] interface IMyServ;
};
[
uuid(554B6D8F-C8CC-487f-892D-EBF500107242),
helpstring("MyDocument Class")
]
coclass CMyDocument
{
[default] interface IMyDocument;
}
};
|
|
|
|
|
Well, I fixed it finally. Or let's say: I found out.
First of all I decided to try it with the ATL wizard again, removing all errors it created - and that was a long walk...
Anyway the main problem remained.
By chance (!) I found that all works fine, if all char's are declared as unsigned char's. Mmhh...
But that just opened another problem: VB could not deal with it! The property ID of a CMyDocument could be set but not read. Finally I figured that out, too: You need to declare strings as BSTR in the IDL.
Conclusion: OK, I'm really not too experienced with COM and VBA and with transferring data from VB to C++. But for those out there who knows Eclipse: I hope for your sake that you never ever have to work with the .NET IDE. The wizards there are full of black magic...
Bye,
Tobias
|
|
|
|
|
Hi,
I've got a problem, calling via remoting, a COM+ which activation is type library. I configure the client application and the web.config file, then I make the call, and that's ok. The problem appears because my COM+ application has to read information from a configuration file. My first attempt to solve this, was to introduce this information in the web.config file, but it doesn't work. The fact is that the configuration file which it's been read is aspnet_wp.exe.config, instead web.config.
I am creating the COM+ through a wrapper. When I call the wrapper, it is executed in one AppDomain, but when the wrapper creates the instance of the component, the AppDomain is changed to the Default AppDomain, changing also the configuration file used.
I hope to give enough information (and understable!!!;P) If you need further information, please, don't hesitate asking me.
Thanks,
Ivan.
Iván Fernández
|
|
|
|
|
i want to get some information about remote machine.
so wmi(Windows Managment Instruments) can provide what i want.but i don't if it can access wmi on remote machine outside of lan network by ip.
who can tell me?thanks?
Habbit--Beginner In MFC
|
|
|
|
|
Hi,
is there anyone who knows how to catch
outlook events by using the dipinterface and
the typlibraries from outlook (msoutl9.olb - OLE-Viewer)
Thanks a lot !
|
|
|
|
|
class CFriendSession is derived from class CCmdTarget
In CFriendSession constructor call:
BOOL bRet = AfxConnectionAdvise(m_ISession, IID_ISessionEvents, m_session_sink, FALSE,&m_session_cookie);
In CFriendSession destructor call:
BOOL bRet = AfxConnectionUnadvise(m_ISession, IID_ISessionEvents, m_session_sink, FALSE,m_session_cookie);
terminate the connection.
when class CFriendSession is directly generated and freed by some process,process could quit normally.
When class CFriendSession embeded in some Dll, generated and freed by the process which load the Dll,process could not quit completely.
Why?
I need help.
|
|
|
|
|
Sounds like your not calling Release on some interface. The DLL would not be unloaded until the ref count for each COM object is 0, which means the process probably won't exit.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Maybe you are right.
But the problem is that I have called Release on all interfaces used.
And you know, the process runs ok when it use connection point directly
but not in Dll.
But when use connection point in Dll, problem occurs.
I can tell you the details.
class CFriendSession is in Dll.
In constructor of CFriendSession I use:
---------------------------------------------------------------------------
OleInitialize( NULL );
COleException *e = new COleException;
try
{
HRESULT hr = m_ISession.CreateDispatch(CLSID_JabberSession, e);
ASSERT(SUCCEEDED(hr));
}
catch( COleDispatchException * e )
{
e->Delete();
}
//Get a pointer to sinks IUnknown, no AddRef.
m_session_sink = GetIDispatch(FALSE);
BOOL bRet = AfxConnectionAdvise(m_ISession,IID_ISessionEvents, m_session_sink, FALSE,&m_session_cookie);
e->Delete();
-------------------------------------------------------------------
in the destructor of CFriendSession, I use:
------------------------------------------------------------------
BOOL bRet = AfxConnectionUnadvise(m_ISession, IID_ISessionEvents, m_session_sink, FALSE, m_session_cookie);
m_ISession.ReleaseDispatch();
------------------------------------------------------------------
I found when I call m_ISession.CreateDispatch, the problem will occure.
But I do call m_ISession.ReleaseDispatch() in destructor of CFriendSession.
So, I couldn't find which interface I did not release.
I want to know your opinion.
Also, thanks for your kind help.
|
|
|
|
|