|
Hello
I have two COM local servers developed using ATL. The local servers have interface pointers to each other and the pointers will be released when
Stop()is called from a client to each server. The client will also release its pointers to the servers and both components will die (lock count == 0).
Now to my problem. If one of the components crash I have a problem to shut down the other server. The still running server will have a lock count from the allready dead server.
I would be very happy if someone could give me a sugestion how to solve this.
Johan
|
|
|
|
|
Can I ask why you're not concentrating on preventing the 'crash' instead of putting effort into trying to deal with the after effects of such a crash?
|
|
|
|
|
The local servers are running on an embedded device with Windows CE. Before release everything should be tested as good as possible but there is still a risk for crashes. The most obvious would be to implement a watchdog which would reset the device but this is not an option because of the long boot time of the operating system.
Each server implements a watchdog configured to terminate the server process. This termination will be notised by the client and the client restarts the terminated server.
One way to shut down servers who refuse to die is to send WM_QUIT to it. This whould probably work because this is what happen when the lock count reach zero. This solution is very ugly and I am looking for the right way to do it. There must be a standard solution for problems like this.
|
|
|
|
|
I've never done abything on CE but how about...
Johan.Wade wrote: This termination will be notised by the client and the client restarts the terminated server.
If your client can notice that one of the local servers has been termnated, the client must then be able to instruct the other non-terminated server to ignore the pointer it holds to the terminated server. To recover the client can then set up a new server and by some mechanism have them 'discover' each other to set up new pointers.
During the 'instruction to ignore the other server', that is prior to the 'discover' phase, the server must be instructed by the client to internally call Release to restore the existing servers count to 1.
|
|
|
|
|
Johan.Wade wrote: Now to my problem. If one of the components crash I have a problem to shut down the other server. The still running server will have a lock count from the allready dead server.
I would be very happy if someone could give me a sugestion how to solve this.
There is an IExternalConnection interface which can help in your troubles.
With best wishes,
Vita
|
|
|
|
|
Hello Friends,
I am develping a simple Addon(Extension)
var observerService = Components.classes["@mozilla.org/observer-service;1"]
.getService (Components.interfaces.nsIObserverService);
var enu = observerService.enumerateObservers("domwindowclosed")
while(enu.hasMoreElements())
{
var x1 = enu.getNext()
}
It works fine, from here i want to identify which addon(Extension) uses the current X1
pls help some sone
thanks in advance
|
|
|
|
|
You better read the MDC because FF-Addons arent here a big issue.
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
I had used the DirectShowLib 2005 and DirectX libraries for saving videos in WMV format.The Format is wmv and the video standard is PAL_B.
In my application I was able to see the preview of the Video but when saving an error comes "HResult E_FAIL returned from COM DEVICE" on mediaController.Run().Why is this error coming any idea will be very beneficial.
Thanks
|
|
|
|
|
I don't know why you get E_FAIL but have you tried getting more information, if it's available, using the COM mechanism IErrorInfo?
HRESULT hr;<br />
CComPtr<IErrorInfo> spErrorInfo;<br />
hr = GetErrorInfo(0, &spErrorInfo);
|
|
|
|
|
Hi All,
I don't know whether my question will appear in COM category or not, sorry for that. I am working on windows platform with no administrative privileges. I want to send messages/files from my pc to another in LAN. I am using one software 'IP Messanger' which doesn't required any privileges to install it or to send messages/files from one pc to another in LAN. I know DOS commands like 'send','msg' etc. but they need 'Messenger' to be on. My pc's 'Messenger' is off but still 'IP Messenger' works fine. How? Can i send messages without turning 'Messenger' on? and how? Can anyone please explain this or just give me some idea so that i can search more on it.
Thanks
Nilesh
|
|
|
|
|
Nilesh Hamane wrote: My pc's 'Messenger' is off but still 'IP Messenger' works fine.
So what exactly is the problem? If IP Messenger works fine and can send messages/files your problem appears to be solved.
|
|
|
|
|
There is no problem with IP Messenger, its working fine; but i want know how can the software work well without turning 'Messenger' service on? Also i want know that, is there any method/command available in DOS to send messages/files without 'Messenger' service?
|
|
|
|
|
IP Messenger does not use the Messenger service, I expect it uses direct TCP/IP protocol to transfer data between computers. I am not aware of any direct DOS command to transfer between different machines unless you have FTP service running on the destination.
|
|
|
|
|
|
This is a though one (no, really).
I'm making a shell extension that implements infotip and thumbnail for cbz(zip) and cbr(rar) archives. For some COM-gods-only-known reason, it works flawlessly in XP but in Vista, behaviour is strange - infotip seems to work, but Vista loads dll only for showing infotip, and then immediately unloads it (observed in Process Explorer) and thumbnail extraction fails.
When I make separate dlls (old code adapted from some examples) for infotip and thumbnail, they work fine in Vista (but it would be nice to kill 2 flies with 1 strike). If I use this Explorer lookalike for debugging, thumbnails are sometimes extracted but it often silently crashes.
What am I doing wrong? (got ideas but not that much experience with COM /learning by copy-paste).
Thanks for your help in advance!
The project skeleton was created with vc6 and further with vc9express+WDK ATL/WTL.
Here is the complete project:
http://www.autohotkey.net/~T800/TEMP/CBXshell.zip
and quick peek of implementation:
class ATL_NO_VTABLE CCBXShell :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CCBXShell,&CLSID_CBXShell>,
public IDispatchImpl<ICBXShell, &IID_ICBXShell, &LIBID_CBXSHELLLib>,
public ISupportErrorInfo,
public IPersistFile,
public IExtractImage2,
public IQueryInfo
{
public:
CCBXShell() {}
BEGIN_COM_MAP(CCBXShell)
COM_INTERFACE_ENTRY(ICBXShell)
COM_INTERFACE_ENTRY(IPersistFile)
COM_INTERFACE_ENTRY(IQueryInfo)
COM_INTERFACE_ENTRY(IExtractImage)
COM_INTERFACE_ENTRY(IExtractImage2)
COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY(ISupportErrorInfo)
END_COM_MAP()
DECLARE_REGISTRY_RESOURCEID(IDR_CBXShell)
DECLARE_PROTECT_FINAL_CONSTRUCT()
STDMETHOD(Load)(LPCOLESTR wszFile, DWORD dwMode) { return m_cbx.OnLoad(wszFile); }
STDMETHOD(GetClassID)(LPCLSID clsid){return E_NOTIMPL;}
STDMETHOD(IsDirty)(VOID){return E_NOTIMPL;}
STDMETHOD(Save)(LPCOLESTR, BOOL){return E_NOTIMPL;}
STDMETHOD(SaveCompleted)(LPCOLESTR){return E_NOTIMPL;}
STDMETHOD(GetCurFile)(LPOLESTR FAR*){return E_NOTIMPL;}
STDMETHOD(GetLocation)(LPWSTR pszPathBuffer, DWORD cchMax,
DWORD *pdwPriority, const SIZE *prgSize,
DWORD dwRecClrDepth, DWORD *pdwFlags)
{ return m_cbx.OnGetLocation(prgSize, pdwFlags); }
STDMETHOD(Extract)(HBITMAP* phBmpThumbnail) { return m_cbx.OnExtract(phBmpThumbnail); }
STDMETHOD(GetDateStamp)(FILETIME *pDateStamp) { return m_cbx.OnGetDateStamp(pDateStamp);}
STDMETHOD(GetInfoTip)(DWORD dwFlags, LPWSTR* ppwszTip) { return m_cbx.OnGetInfoTip(ppwszTip);}
STDMETHOD(GetInfoFlags)(LPDWORD pdwFlags) { *pdwFlags = 0; return E_NOTIMPL;}
STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
private:
__cbx::CCBXArchive m_cbx;
}; CCBXArchive::GetLocation
HRESULT OnGetLocation(const SIZE *prgSize, DWORD *pdwFlags)
{
ATLTRACE("IExtractImage2::GetLocation\n");
m_thumbSize = *prgSize;
*pdwFlags |= (IEIFLAG_CACHE | IEIFLAG_REFRESH);
if (*pdwFlags & IEIFLAG_ASYNC) return E_PENDING;
return NOERROR;
}
|
|
|
|
|
Check in all your implementation for valid value. As her
in OnGetLocation(const SIZE *prgSize, DWORD *pdwFlags)
if( *prgSize &&*pdwFlags)
{
//your code
}
return E_FAIL;
COM is a real pain.
Good luck
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
Still nothing.
I traced class members, but it seems that only infotip works ok.
In XP it goes (while shown in Explorer sidepane, debug output):
IPersistFile::Load
IExtractImage2::GetLocation
IPersistFile::Load
IQueryInfo::GetInfoTip
IExtractImage2::GetDateStamp
IExtractImage::Extract
but in Vista CCBXShell class destructs immediately (commented code, left only IExtractImage stuff):
CCBXArchive::CCBXArchive
CCBXShell::CCBXShell
CCBXShell::~CCBXShell
CCBXArchive::~CCBXArchive
I tried to (un)comment various stuff, like class inheritance, interface parts, unrar dependency, everything I could come up with but to no avail. I know that IExtractimage::GetDateStamp is broken in Vista, I tried also with Win7 RC1 (got it in virtual machine) - no good.
I still haven't tried to make IThumbnailProvider version (would be nice if I could make it more cross-windows).
Anyway, I'm running out of nerves, will and (my free) time (I'll skip harder words about M$).
I don't know if that misterious "com object aggregation" stuff might be relevant.
|
|
|
|
|
|
In the end I gave up and adapted IThumbnailProvider sample from WinSDK.
http://www.autohotkey.net/~T800/TEMP/CBXShell%204.0.0.2.rar
I would say that M$ is internally using something else beside ATL for com and selling us their high-price pro-bloatware, because that sample uses previously undocumented, but yet availabe even in win2000, by-ordinal exported functions from Shlwapi.dll.
Hmmm... this sample will come in handy , you can adapt it to your needs in 10 mins, instead losing time with ATL wizards.
Now it all works OK, on XP and Vista (still gotta test x64), beside the fact that Explorer stubbornly caches/doesn't unload dll when it's not needed (but it's OK since (un)installer will do a reboot).
I traced interface calls and it is incredible to see such M$-incompetence (parts of output from a few runs, just for an illustration), look at that inconsistent mess:
CCBXShell::CCBXShell
IInitializeWithFile::Initialize
CCBXArchive::OnLoad
IExtractImage::GetLocation
CCBXArchive::OnGetLocation
IThumbnailProvider::GetThumbnail
CCBXArchive::OnGetLocation
CCBXArchive::OnExtract
CCBXShell::~CCBXShell
CCBXShell::CCBXShell
IInitializeWithFile::Initialize
CCBXArchive::OnLoad
IExtractImage::GetLocation
CCBXArchive::OnGetLocation
IThumbnailProvider::GetThumbnail
CCBXArchive::OnGetLocation
CCBXArchive::OnExtract
CCBXShell::~CCBXShell
CCBXShell::CCBXShell
IInitializeWithFile::Initialize CCBXArchive::OnLoad
IExtractImage::GetLocation CCBXArchive::OnGetLocation
IThumbnailProvider::GetThumbnail CCBXArchive::OnGetLocation CCBXArchive::OnExtract
CCBXShell::CCBXShell
IInitializeWithFile::Initialize CCBXArchive::OnLoad CCBXArchive::OnGetInfoTip
CCBXShell::~CCBXShell
CCBXShell::~CCBXShell
|
|
|
|
|
It looks that Vista is very stubborn about thumbnails. It seems that my first version (the one with IExtractimage) works after all (go figure).
I forcefully deleted Vista thumbnail cache files (inside C:\Users\T800\AppData\Local\Microsoft\Windows\Explorer\) and now it seems to work OK. (I needed a bigger hammer )
Btw, I think that IThumbnailProvider example from SDK still has bugs, but I'm not wasting my time with it now.
Merry Xmas and happy New year!
|
|
|
|
|
Hi,
How can i pass a collection object as a parameter ....???
Consider below example..
Interface IMyInterface
{
void DisplayData(??????);
}
Class MyClass : IMyInterface
{
void IMyInterface.DisplayData(??????)
{
Logic to display data
Display First Name ,
Display last name...
}
}
///From client.
Class Client
{
//I have a data structure (some data container) , which saves data like <key , value> say a map...
MyClass myclass = new MyClass()
myclass.DisplayData( ???)
}
Now what should be the parameter typr ???
|
|
|
|
|
Hi Everyone,
I need help. My deadline is tomorrow and I have been at this for almost 2 weeks now. I need to call a com object from a C# or VB.NET dll that is called by a third party app (TIPCO).
The com object takes in a string and returns a string.
I have the following:
1. A .net dll that calls the com (my wrapper)
2. A .net dll that calls my wrapper dll and this is the entry point for calling applications (basically .net is my intermediary)
(Please not when referring to a dll I am referring to a class library object)
My Code looks as follows
My C# dll that calls the com object (wrapper)
I have a C# wrapper that calls the com object
Public Class Class1
Public Sub callMagicDLL(ByRef input As Integer, ByRef output As Integer)
Dim myownClass As New CallWithMain()
myownClass.Main()
End Sub
End Class
Imports System.Runtime.CompilerServices
Imports System.Runtime.InteropServices
Public Class CallWithMain
Dim a As Integer
Dim b As Integer
<STAThread()> _
Sub Main()
Dim mymagicdll As New magic.magic 'Com object
Dim a As Integer = 1
Dim b As Integer = 1
mymagicdll.magicdll(a, b)
End Sub
End Class
Then another C# dll project to call the dll above, that consists of an interface and a class that implement it
Option Strict Off
Option Explicit On
Imports com.tibco.matrix.clr
Imports System
Imports System.ComponentModel
Imports System.Diagnostics
Imports System.Web.Services
Imports System.Xml.Serialization
Namespace www.example.com.com.tibco.amx.sample.helloworld.simple.java.soa
'''<remarks/>
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.1433"), _
WebServiceInterface(MethodParameters:="InputMsg", PortTypeName:="HelloWorldPT", PortTypeNamespace:="http://www.example.com/com.tibco.amx.sample.helloworld.simple.java.soa/", WSDLLocation:="HelloWorld_HelloWorldPT.wsdl")> _
Public Interface IHelloWorldPT
'''<remarks/>
<System.Web.Services.WebMethodAttribute()> _
Function sayHello(<System.Xml.Serialization.XmlElementAttribute([Namespace]:="http://ns.tibco.com/Hello/")> ByVal HelloRequest As String) As String
End Interface
End Namespace
And then the class that implements the interface
Imports com.tibco.matrix.clr
Namespace ActiveMatrixComponent1
<ServiceImplementation()> Public Class HelloWorld_HelloWorldPTImpl
Implements www.example.com.com.tibco.amx.sample.helloworld.simple.java.soa.IHelloWorldPT
Dim log As System.Diagnostics.TraceSource
Public Sub New()
log = Funcs.ts
End Sub
Public Function sayHello(ByVal HelloRequest As String) As String Implements www.example.com.com.tibco.amx.sample.helloworld.simple.java.soa.IHelloWorldPT.sayHello
Dim a1 As Integer = 1
Dim b1 As Integer = 2
Dim dllWrapper As New CallingMagicDLLWrapper.Class1
dllWrapper.callMagicDLL(a1, b1)
Return "dot net : " & Trim(Convert.ToString(b1))
End Function
End Class
End Namespace
I did implement
<STAThread()> _
On my main method in my class that calls the dll.
If I run the code as it is I get the following error. And I don’t seem to get pass that.
CallServiceImpl: Unable to cast COM object of type 'magic.magicClass' to interface type 'magic.Dmagic'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{F1556D77-4488-489D-8B1F-53FC0F7AC312}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).; on machine = DHN00807
Stack trace: at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
at magic.magicClass.magicdll(Int32 pMagicRequestXML, Int32& prMagicResponseXML)
at CallingMagicDLLWrapper.CallWithMain.Main()
at CallingMagicDLLWrapper.Class1.callMagicDLL(Int32& input, Int32& output)
at ActiveMatrixComponent1.ActiveMatrixComponent1.HelloWorld_HelloWorldPTImpl.sayHello(String HelloRequest)
I read on the internet and it seems like I need to set the thread to STA.
If I try to set the current thread (in my wrapper class before I call the COM object)
Thread.CurrentThread.SetApartmentState(ApartmentState.STA)
I do get an error that it cannot be set. If I create my own thread and set the new thread state to STA it works but I don’t know how to get the data back once the thread is done. And if I do it this way and call it over and over (17 odd times) it falls over.
(I can call my .NET dll from the TIPCO app and send and retrieve data. But as soon as I call the .NET dll that calls the .NET wrapper dll that calls the COM object it falls over with the above error. I can call the above from a new windows application and then everything works but as soon as I call it from an outside .NET application I get the error).
Any suggestions please? It will help a lot.
Thanks
Chris
|
|
|
|
|
Chris Tiaan wrote: My C# dll that calls the com object (wrapper)
I have a C# wrapper that calls the com object
I don't see any C# code here, it looks to me like Visual Basic. You might get better help posting this in the VB forum.
|
|
|
|
|
You are shure that 'magic.Dmagic' interface is implemented in the 'magic.magicClass'?
Be shure that all components are created and running in the same Thread model or you never wont get rid of bad trouble.
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
Hi,
I don't know exactly is this the right forum to post this question, can anyone tell me how to hide one of the output pin in a direct show source filter?
Thank you in Advance.
Raja Bose
|
|
|
|