|
In the case od STA application, the event fired using connection point will not be recieved if we use WaitForSingleObject(). I have fixed this issue by using CoWaitForMultipleHandles(). In this case, pending events are processed after obtaining the reply from connection points.
Thank You for your updates.
|
|
|
|
|
Hi,
I have a server which is used for windows 2000 advanced server. This server i have created a asp.net application to read excel sheet and update the data into the database.
I want to add permission for ASPNET for MS Excel Application. But it does not listed on DCOM Config properties.
How can i add/migrate MS Excel Application to DCOM Config properties?
It is urgent to update for my project.
Thanks in advance
|
|
|
|
|
It's under there. Add ASPNET to local launch and activate permissions. With Excel 2007, I found it necessary to login as ASPNET user using a program called anup(gets ASP.NET encypted password), logging in as ASPNET user, and then clicking OK on dialogs which popped up in order for interop automation to work from ASPNET user account.
|
|
|
|
|
|
Hey,
i've written a ActiveX-control using MFC. The control creates a CWnd which hosts a CListCtrl. All works fine, in Ms Testcontainer but not e.g. in Ms Access/Excel. When I use a form in Access and place my control on the form, no key events reach my control (even if the control has focus). All mouse-events works well. How can I send the keystrockes to my control (eg. move cursor on my listctrl)?
Thank you for helping me...
|
|
|
|
|
Does anyone know how to get a reference to the IFolderViewOC interface from within an Explorer extension (sidebar)?
I am trying to get a reference from with IObjectWithSite::SetSite(), I have tried using the IServiceProvider which fails and I now think I need to query a service to get the reference but do not know which service to query.
Does anyone have any ideas?
|
|
|
|
|
Hi,
I am working with COM dll resources. I have created a menu in a com dll and provided an interface with a method to return the handle to the menu.
When I am trying to pass this handle(converting to int) to CSingleDocTemplate of InitInstance() and trying to run the application, I am getting "Failed to create empty document".
My intention is to use the menu(resource) which is present in the com dll in my application.
In order to achieve this, is this the correct way of proceeding or not? If yes, where am I doing wrong?
If not, please suggest an alternative mechanism.
Thanks in advance.
Taruni
|
|
|
|
|
Hi,
I have one ASP application which is using a DCOM component, I have to configure that DCOM component on a Server with Win 2003 operating system.
Can anybody please give me some hints or links to do this task.
Ultimately now I have registered it but it is giving the error and a warning as below in the Event Log, please help me in resolving this issue.
The description for Event ID ( 36512 ) in Source ( SEIPMAFILEDOWNLOAD ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this description; see Help and Support for details. The following information is part of the event: <ERRORCALLSTACK><ERROR><NUMBER>-2147184992</NUMBER><DESCRIPTION>0-</DESCRIPTION><COMPONENT>seipma_comFileDownload</COMPONENT><MODULE>pzFileDownload</MODULE><ROUTINE>FileDownload</ROUTINE><EIID>11/17/08-21:37-705</EIID><ADDINFO><EXECUTION_STEP>Getting download data: file name = Download11172008.exe</EXECUTION_STEP><PROCEDURE_PARAMETERS><APPSECDB><![CDATA[<ADO_APP_SEC_DB><DSN>SW_APPSECDB_0370a</DSN><USERID>SW0370</USERID><PASSWORD>zaq12wsx</PASSWORD><GUID>{6C067960-45E4-11D3-9F43-00A0D1063EC9}</GUID></ADO_APP_SEC_DB>]]></APPSECDB><USER_SID><![CDATA[{96FBC159-D12A-11D4-8E69-0008C72B623C}]]></USER_SID><FILENAME><![CDATA[Download11172008.exe]]></FILENAME></PROCEDURE_PARAMETERS></ADDINFO><ERRORLOGGED>
And a warning as below
The average call duration has exceeded 10 minutes. If this is not the expected behavior, please see article 910904 in the Microsoft Knowledge Base at http:
Server Application ID: {4C8DA47F-4AC2-4250-AFB3-0115E933175F}
Server Application Instance ID:
{65909717-9B34-44DA-8A88-127AB60FFE09}
Server Application Name: PMABLayer
For more information, see Help and Support Center at http:
Thanks a Lot,
Aleem Mohammad.
Thanks & Regards,
Md. Abdul Aleem
NIIT technologies
modified on Tuesday, November 18, 2008 11:15 AM
|
|
|
|
|
Did you take the time to read the Microsoft Knowledge Base article listed in your error message? It tells you exactly why it happens and how to get around it.
http://support.microsoft.com/kb/910904[^]
Best Wishes,
-David Delaune
|
|
|
|
|
Dear All,
Iam new to c# window application and also for COM.I have a COM component
which is developed in Visual Basic.Now i want to use this component into
my c# window application.How can i register and use.The COM is in the form
of EXE not in the form of DLL.Please help me out on this.
Thanks & Regards
Veeresh
i want to join this group
|
|
|
|
|
Hello,
I have a C# com object (.net framework 2.0) that I want to call from C++.
I tried to import the tlb and create the object using MyNamespace::IMyInterfacePtr pObj ; but i got errors about not impelemting queryInterface, AddRef etc.
I found out that I should use CComObject (ref: http://support.microsoft.com/kb/181265[^].
So declaring the variable was a success using:
<codeccomobject><mynamespace::mycomclass xmlns:mynamespace="#unknown">* pObj;Now I am trying to create an instance by using:
<code>HRESULT hRes = (CComObject<mynamespace::mycomclass>::CreateInstance(&pObj);</mynamespace::mycomclass>But I get the following error:
c:\program files\microsoft visual studio\vc98\atl\include\atlcom.h(2395) : error C2504: 'MyConClass' : base class undefined<br />
see reference to class template instantiation 'ATL::CComObject<struct>;' being compiled</struct>
Any ideas what I am doing wrong?
thanks!
|
|
|
|
|
Your question is confusing as hell.
When you say that:
"I have a C# com object (.net framework 2.0) that I want to call from C++.
I tried to import the tlb and create the object using MyNamespace::IMyInterfacePtr pObj; but i got errors about not impelemting queryInterface, AddRef etc."
I have to wonder, obviously, not only how did you define this object, but, why would you refer to this object as a COM object (since, by definition, a COM object must implement the IUnknown interface methods, QueryInterface, AddRef, Release).
(...just curious,...)
Everything I know about COM. I learned from Behind The Scenes of a COM Server[^]
|
|
|
|
|
Hi,
I have COM module which run as local server on invocation by the client.
I have Cisco Security Agent installed on my machine. When I run my client which onvokes COM module.I can run the requests and COM module will give the result. Once I get the result this COM module will be removed which is not suppose to. I cannot run some other requests again because COM module will not be there. This happens only with Cisco Security agent installed on the machine not even you need to run this service.If it just installed on your machine it gives you problem.COM module should go only when Client closes. IF CSA(Cisco Security Agent) is not installed on the machine this perfectly works fine.Any idea why this hehaves like this?
Please help.
|
|
|
|
|
Does anybody know how to hook IWiaDevMgr?
I wanna to do something before user EnumDeviceInfo().
|
|
|
|
|
How to add a neew interface to an existing COM application?
Regards,
KDevloper
|
|
|
|
|
i crate a class CAudio, which implementes from IStream, and it's code like below:
#include "objidl.h"
#ifndef INCLUDE_AUDIOSTREAM
#define INCLUDE_AUDIOSTREAM
class CAudioStream :
public IStream
{
private:
LONG m_cRef;
HANDLE m_hFile;
public:
CAudioStream(TCHAR* pszFileName);
~CAudioStream(void);
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
ULONG STDMETHODCALLTYPE AddRef(void);
ULONG STDMETHODCALLTYPE Release(void);
HRESULT STDMETHODCALLTYPE Read(void *pv, ULONG cb, ULONG *pcbRead);
HRESULT STDMETHODCALLTYPE Write(const void *pv, ULONG cb, ULONG *pcbWritten);
HRESULT STDMETHODCALLTYPE Seek(LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition);
HRESULT STDMETHODCALLTYPE SetSize(ULARGE_INTEGER libNewSize);
HRESULT STDMETHODCALLTYPE CopyTo(IStream *pstm, ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten);
HRESULT STDMETHODCALLTYPE Commit(DWORD grfCommitFlags);
HRESULT STDMETHODCALLTYPE Revert(void);
HRESULT STDMETHODCALLTYPE LockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType);
HRESULT STDMETHODCALLTYPE UnlockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType);
HRESULT STDMETHODCALLTYPE Stat(STATSTG *pstatstg, DWORD grfStatFlag);
HRESULT STDMETHODCALLTYPE Clone(IStream **ppstm);
};
#endif
#include "StdAfx.h"
#include "AudioStream.h"
CAudioStream::CAudioStream(TCHAR* pszFileName)
{
m_cRef = 0;
m_hFile = CreateFile(pszFileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_NORMAL, NULL);
if(m_hFile == INVALID_HANDLE_VALUE)
MessageBox(GetActiveWindow(), "can not open file.", "error", MB_OK);
}
CAudioStream::~CAudioStream(void)
{
if(m_hFile != INVALID_HANDLE_VALUE)
CloseHandle(m_hFile);
m_hFile = INVALID_HANDLE_VALUE;
}
HRESULT STDMETHODCALLTYPE CAudioStream::QueryInterface(const IID &riid, void **ppvObject)
{
if(IID_IStream == riid || IID_IUnknown == riid)
{
*ppvObject = static_cast<IStream*>(this);
AddRef();
return S_OK;
}
*ppvObject = NULL;
return E_NOINTERFACE;
}
ULONG STDMETHODCALLTYPE CAudioStream::AddRef()
{
return InterlockedIncrement(&m_cRef);
}
ULONG STDMETHODCALLTYPE CAudioStream::Release()
{
if(InterlockedDecrement(&m_cRef) == 0)
{
delete this;
return S_OK;
}
return m_cRef;
}
HRESULT STDMETHODCALLTYPE CAudioStream::Read(void *pv, ULONG cb, ULONG *pcbRead)
{
if(!ReadFile(m_hFile, pv, cb, pcbRead, NULL))
return E_FAIL;
if(*pcbRead <= 0)
return E_FAIL;
return S_OK;
}
HRESULT STDMETHODCALLTYPE CAudioStream::Write(const void *pv, ULONG cb, ULONG *pcbWritten)
{
if(!WriteFile(m_hFile, pv, cb, pcbWritten, NULL))
return E_FAIL;
if(*pcbWritten <= 0)
return E_FAIL;
return S_OK;
}
HRESULT STDMETHODCALLTYPE CAudioStream::Seek(LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
{
plibNewPosition->QuadPart = SetFilePointer(m_hFile, dlibMove.LowPart, NULL, dwOrigin);
return S_OK;
}
HRESULT STDMETHODCALLTYPE CAudioStream::SetSize(ULARGE_INTEGER libNewSize)
{
SetFilePointer(m_hFile, libNewSize.LowPart, NULL, 0);
return S_OK;
}
HRESULT STDMETHODCALLTYPE CAudioStream::CopyTo(IStream *pstm, ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten)
{
return -1;
}
HRESULT STDMETHODCALLTYPE CAudioStream::Commit(DWORD grfCommitFlags)
{
return -1;
}
HRESULT STDMETHODCALLTYPE CAudioStream::Revert(void)
{
return -1;
}
HRESULT STDMETHODCALLTYPE CAudioStream::LockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
{
return -1;
}
HRESULT STDMETHODCALLTYPE CAudioStream::UnlockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
{
return -1;
}
HRESULT STDMETHODCALLTYPE CAudioStream::Stat(STATSTG *pstatstg, DWORD grfStatFlag)
{
pstatstg->cbSize.QuadPart = GetFileSize(m_hFile, NULL);
pstatstg->grfLocksSupported = 0;
return -1;
}
HRESULT STDMETHODCALLTYPE CAudioStream::Clone(IStream **ppstm)
{
return -1;
}
test code like below:
#include "stdafx.h"
#include "AudioStream.h"
int main(int argc, char* argv[])
{
CoInitialize(NULL);
CAudioStream* pAudioStream = NULL;
IWMSyncReader* reader;
HRESULT hr;
hr = WMCreateSyncReader(NULL, 0, &reader);
if(hr != S_OK)
{
CoUninitialize();
return 0;
}
pAudioStream = new CAudioStream("d:\\Music\\You&Me.mp3");
IStream* pStream = static_cast<IStream*>(pAudioStream);
pStream->AddRef();
hr = reader->OpenStream(pStream);
if(hr != S_OK)
{
LARGE_INTEGER dlibMove;
ULARGE_INTEGER plibNewPosition;
dlibMove.QuadPart = 30;
plibNewPosition.QuadPart = 0;
pAudioStream->Seek(dlibMove, FILE_BEGIN, &plibNewPosition);
hr = reader->OpenStream(pStream);
if(hr != S_OK)
{
reader->Release();
reader = NULL;
pStream->Release();
pStream = NULL;
CoUninitialize();
return 0;
}
DWORD dwOutputCount;
hr = reader->GetOutputCount(&dwOutputCount);
if(hr != S_OK)
{
reader->Release();
reader = NULL;
pStream->Release();
pStream = NULL;
CoUninitialize();
return 0;
}
printf("OutputCount=%d\n", dwOutputCount);
}
system("pause");
reader->Release();
reader = NULL;
pStream->Release();
pStream = NULL;
CoUninitialize();
return 0;
}
the code exit at IStream::OpenStream after IStream::Seek, what error occurred?
|
|
|
|
|
to run code, need include:
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <wmsdk.h>
and import wmvcore.lib.
|
|
|
|
|
Hi,
This code is returning error "class not registred", how could I correct it
IStorage *Storage;
CLSID clsidWord;
CoInitialize(NULL);
HRESULT hr=CoCreateInstance(clsidWord,NULL,CLSCTX_SERVER,IID_IStorage,(void**) &Storage);
|
|
|
|
|
where is clsidWord defined?
|
|
|
|
|
I want to passe object parameter to c#.net, thanks!
|
|
|
|
|
You might read this excellent article: Intro to COM[^]
The COM class clsid is defined in a header somewhere, what kind of object is it?
Michael Dunn's second part to that Introduction to COM series explains it all quite clearly:
Behind The Scenes of the COM Server[^]
"A key with the server's GUID as its name must be created under the HKEY_CLASSES_ROOT\CLSID key, and that key must contain a couple of values listing the server's location and its threading model. The DllGetClassObject() function is called by the COM library as part of the work done by the CoCreateInstance() API."
|
|
|
|
|
Thanks for your reply, actually I want to read the content of .doc file. I do not know how to do that, if you have some idea about it please tell me how to do that?
I also searched on google but could not get much help, I just came to know that COleStreamFile class might be usefull but how to do that with this class I don't know?
|
|
|
|
|
Hi I am new to COM. I am working on a java application that will make use of COM to get the required interface Information from I2 Analyst Note Book V6. And the application is working fine. Recently we upgraded the I2 V6 to V7 and Modified the Interface as mentioned in I2 V7 support docs. After the upgradtion we are getting problems from COM.
The problem is in IDispatch::GetTypeInfo.Here the function returns S_OK but still the pointer to ITypeInfo is null. In which scenario this will happen. Following is the code snippet which does this.
=================Code Snippet==============
ITypeInfo* pTypeInfo;
UINT pctInfo;
m_hRet = m_pDisp->GetTypeInfoCount(&pctInfo);
if(m_hRet!=S_OK || pctInfo != 1)
{
return false;
}
m_hRet = m_pDisp->GetTypeInfo(0,LOCALE_SYSTEM_DEFAULT,&pTypeInfo);
if(m_hRet!=S_OK || pTypeInfo==NULL)
{
if(pTypeInfo==NULL && m_hRet==S_OK )
MessageBox(NULL, "Error : GetTypeInfo, pTypeInfo is null", "1", MB_OK);
return false;
}
===========================================
After upgrading to I2 V6 to I2 V7. I am getting the error 'Error : GetTypeInfo, pTypeInfo is null' in the MessageBox.
Please help me ,since i am totally stuck at this point.thanks in advance
|
|
|
|
|
Try to modify second parameter of m_pDisp->GetTypeInfo(...) from LOCALE_SYSTEM_DEFAULT to LOCALE_USER_DEFAULT or to 0 at all.
With best wishes,
Vita
|
|
|
|
|
I tried both(LOCAL_USER_DEFAULT ad 0 ).But still i am getting the same error...
|
|
|
|
|