|
I am working with COM using MFC.I try to get a pointer to the IClassFactory Interface.But, I am getting the error that the memory could not be read.The pointer to IClassFcatory interface always points to address 0x00000000 in the memory !
The same problem I am facing whenever I work with COM.But if I run the program sometimes say 5 or more times I am getting no run time error & my program works with the same code !What is the problem ,how can I debug my program !
Y.Yamini Devi
|
|
|
|
|
I am working with COM using MFC.I try to get a pointer to the IClassFactory Interface.But, I am getting the error that the memory could not be read.The pointer to IClassFcatory interface always points to address 0x00000000 in the memory !
The same problem I am facing whenever I work with COM.But if I run the program sometimes say 5 or more times I am getting no run time error & my program works with the same code !What is the problem ,how can I debug my program !
Y.Yamini Devi
|
|
|
|
|
I am working with COM using MFC.I try to get a pointer to the IClassFactory Interface.But, I am getting the error that the memory could not be read.The pointer to IClassFcatory interface always points to address 0x00000000 in the memory !
The same problem I am facing whenever I work with COM.But if I run the program sometimes say 5 or more times I am getting no run time error & my program works with the same code !What is the problem ,how can I debug my program !
Y.Yamini Devi
|
|
|
|
|
I am working with COM using MFC.I try to get a pointer to the IClassFactory Interface.But, I am getting the error that the memory could not be read.The pointer to IClassFcatory interface always points to address 0x00000000 in the memory !
The same problem I am facing whenever I work with COM.But if I run the program sometimes say 5 or more times I am getting no run time error & my program works with the same code !What is the problem ,how can I debug my program !
Y.Yamini Devi
|
|
|
|
|
I am working with COM using MFC.I try to get a pointer to the IClassFactory Interface.But, I am getting the error that the memory could not be read.The pointer to IClassFcatory interface always points to address 0x00000000 in the memory !
The same problem I am facing whenever I work with COM.But if I run the program sometimes say 5 or more times I am getting no run time error & my program works with the same code !What is the problem ,how can I debug my program !
Y.Yamini Devi
|
|
|
|
|
I am working with COM using MFC.I try to get a pointer to the IClassFactory Interface.But, I am getting the error that the memory could not be read.The pointer to IClassFcatory interface always points to address 0x00000000 in the memory !
The same problem I am facing whenever I work with COM.But if I run the program sometimes say 5 or more times I am getting no run time error & my program works with the same code !What is the problem ,how can I debug my program !
Y.Yamini Devi
|
|
|
|
|
I have an simple ATL object that contains an IPictureDisp * property. (Free-threaded marshalling, free-threaded object, with events, etc.)
these are my get/putref functions:
CComPtr<IPictureDisp> m_pPicture;
...
STDMETHODIMP CMyObj::get_Picture(IPictureDisp **pVal)
{
*(pVal) = m_pPicture;
return S_OK;
}
STDMETHODIMP CMyObj::putref_Picture(IPictureDisp *newVal)
{
m_pPicture = (IPictureDisp *)newVal;z
return S_OK;
}
in my MFC test app, i create a picture object with
OleLoadPicturePath, set the picture property and call the control's output function. my output function does a QueryInterface on m_pPicture to get an IPicture interface, does some work on it, then releases the IPicture interface.
this works fine in my MFC test app. the problem occurs in the VB IDE.
here's my VB test code:
Private Sub Command1_Click()
Dim W As MyObj
Set W = New MyObj
Set W.Picture = Picture1.Picture
End Sub
and here's how i kill VB:
1. put a breakpoint immediately after my "Set W.Picture = Picture1.Picture" line
2. run the app
3. when the breakpoint hits, hover over the "W" text, this shows some big negative number (i assume this is VBs way of printing an address)
4. hover over the "Picture1" text. the VB IDE crashes immediately.
any ideas???
-c
|
|
|
|
|
Hi Everyone!
I'd like to learn the development of n-Tier applications, but only with the RIGHT tools and technologies: Visual C++, COM+, OLEDB (SQL Server 7, 2000).
Microsoft provide a lot of Windows DNA samples, but all of them have the COM components written in VB and using ADO for database connection. I'd like to see a really good complete but not too complicated example on this topic. I have a few books on OLEDB and COM+, but I didn't find any complex sample, only pieces.
It anyone can help..that can be c00l
Thanks in advance!
Attila Hajdrik
|
|
|
|
|
Hi,
Is it possible to alter the amount of time an instance of com exe server
takes to be unloaded / removed from memory when a client that created it
crashes or is terminated via the task list i.e. no counitialise occurs in
the client app.
Thanks
Robert Fernando
|
|
|
|
|
I'm running win2k pro, busy toying with com+ and all that.
My problem is that all of a sudden, in the status view for all the com+ applications on my system, none show up as running, when in fact they are.
Just wondering if anyone else has experienced this, and if they found a solution.
|
|
|
|
|
I have a free-threaded ATL object. Hooray.
I used the ATL wizards to set up a IDispatch* property, using putref. Then I manually changed the IDispatch to IPictureDisp.
I'm testing this with a simple MFC dialog test app. When I go to set the picture property by calling the com_ptr's interface wrapper function:
void IMyObject::PutRefPicture ( IPictureDisp * pVal )
HRESULT _hr = putref_Picture(pVal);
if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
}
i get an exception on the putref_Picture call. it is a "Catostrophic failure", according to the Error Lookup.
and, i can't even step into that putref_Picture call, it blows up on that call.
any ideas??
-c
|
|
|
|
|
Has anyone out there developed anything with the WMSDK and gotten it to link in a MFC app. I get the link error
defaultlib "msvcrt.lib" conflicts with use of other libs; use /NODEFAULTLIB:library
I did what the error message says.. and it still didnt compile.. How do i get MFC to link with the WMSDK(windows media sdk)? Thanks for any help...
-VIk
|
|
|
|
|
I'm going mad with the access violation error at OLE32.dll. I'm working on a project of namespace extension. Sometime when I close the explorer window, There will be an error report that says access violation at OLE32.dll at 0x7FF668FD. Can anyone give me some help on that problem?
Thank you in advance.
|
|
|
|
|
Try looking on Microsoft's site for .DBG files. They usually are updated with every service pack.
|
|
|
|
|
Eric,
Check out:
http://codeproject.com/dll/libdump.asp
GEorge
|
|
|
|
|
Hi - New to COM / ATL, just getting to grips with this stuff. Could anyone tell me if its possible to have a collection which is populated from c++ client code and viewed in say a VB client app. The client code would receive messages from a remote system and add them to a collection - I can get this bit working - however what I now need is to be able to view the same collection via a VB client. This client would be periodically kicked via connection point to inform it that a message had arrived. How I envisage this to work is as follows:
(NT Service)
* One NT service receiving messages via DCOM.
* Creates a collection item.
* Adds it to the collection.
* Kicks the VB app via connection point.
(DLL)
One DLL which holds the collection class.
(VB Client)
* VB app wakes up
* VB app requests collection items via DLL.
* Messages are displayed in the VB app.
(NT Service)
Mean while the NT service continues to manipulate the collection and informs the VB app.
I thought that if I make the collection container a singleton then only one instance would be created and the NT service and vb app would see the same collection. This does not seem to be the case.
Could anyone explain how I create a shared collection between my NT service and the vb app via a DLL.
Many thanks for any advice offered!
|
|
|
|
|
From my recent experiance, you can't properly impliment a singleton in a DLL; you have to use an .EXE. It's not all that hard - make a new ATL project with EXE (not server). Create a new ATL Simple Com object (MyCollection). Make it a singleton with the DECLARE_CLASSFACTORY_SINGLETON(CMyCollection) macro. Modify your STDAFX.H generated file and change _ATL_APARTMENT_THREADED to _ATL_FREE_THREADED. You're good to go. Register it.
Import your generated .TLB to make the smart pointers and whatever. I suggest using something like this:
MyServerApp::IMySingletonPtr iSingle("MyServerApp.MySingleton") for each use, since it's very possible for the user to kill the process.
Word of warning: once the last usage of your singleton (addref/release) is released, if there is no activity for 5 seconds, then it will be destroyed. If this is a problem, then either use connection points or some other refernce mechanisim.
|
|
|
|
|
Hi there, I'm making a typelibrary with ATL for visual basic users. Does anyone know how you can create a static function so that it appears in the section when i look at my library with the objectbrowser in VB ?
|
|
|
|
|
According to MSDN (October 2000), ITypelib2::GetDocumentation2 "will call _DLLGetDocumentation in the specified DLL to retrieve the desired Help string, if there is a Help string context for this item."
Unfortunately, I cannot find a function prototype for DLLGetDocumentation() and my searching has devolved into curses!
Does anyone know the prototype or where I can find it?
Cheers!
|
|
|
|
|
HRESULT WINAPI DLLGetDocumentation(ITypeLib* ptlib, ITypeInfo* ptinfo, LCID lcid, DWORD dwCtx, BSTR* pbstrHelpString);
|
|
|
|
|
I have build a dcom that update data on a db.
the dcom sits on the server and so is the db.
i'm registering the server as :
"\\computer_name\dcom.exe" /regserver
some how, the dcom who suppose to work on the server is working on the client, so he search for the db on the client and not over the server.
what should i do? any code will be great, i can send the code to you.
please .. i'm so .
thanks,
///
(.)_(.)
oOO(.)OOo
|
|
|
|
|
> i'm registering the server as :
> "\\computer_name\dcom.exe" /regserver
This does not tell COM to instantiate the COM server on computer_name, but rather to retrieve the disk file that houses the server from computer_name. COM does so and then instantiates the COM server on the local machine using the bits from the disk file located on computer_name.
The quickest way to achieve what you want is to register the COM server locally, then use dcomcnfg to modify the registration for instantiating on computer_name.
The soundest way to achieve what you want is to use CoCreateInstanceEx() to create the COM server and directly tell COM to instantiate the COM service on computer_name. This way, your configuration can't be botched after installation by misuse of dcomcnfg.
It would be a good idea to study any indroductory DCOM text book for details. Also search MSDN for dcomcnfg and CoCreateInstanceEx.
|
|
|
|
|
Hi Hush,
You may be registering the exe on your machine rather than the remote machine. You need to run "dcom.exe /regserver" from the client and FROM the server. This can not be done remotely (as far as I know?).
I have come across this problem often enough to include the following code in the remote classes to tell me where it is running.
// ***************************************************************************
//DESCRIPTION:
// Return the machine name of the machine running this code.
//PARAMS:
// *pbsrtMachine Name returned here
//RETURN:
// Standard HRESULT
//CREATED:
// 1-2-2001, 16:51:31 by john@mctainsh.com
// ***************************************************************************
STDMETHODIMP CWhereAmI::GetMachine(BSTR *pbstrMachine)
{
ATLTRACE( _T("CWhereAmI::GetMachine(%p)\n"), pbstrMachine );
ATLASSERT( pbstrMachine );
USES_CONVERSION;
//Get my name
DWORD dwComputerNameLength = MAX_COMPUTERNAME_LENGTH + 1;
TCHAR szComputerName[MAX_COMPUTERNAME_LENGTH + 2];
if( GetComputerName( szComputerName, &dwComputerNameLength ) )
szComputerName[dwComputerNameLength] = NULL;
else
_tcscpy( szComputerName, _T("Unknown") );
*pbstrMachine = SysAllocString( T2W( szComputerName ) );
return S_OK;
}
---------------------------------------------------
I have a note on DCOM remoting at
http://www.mctainsh.com/COM/SmartPtr3.aspx
The hardest thing I find is getting security correct. Let me know how you get on...
Have a great day!
http://www.mctainsh.com
|
|
|
|
|
Hi,
In MFC, people can derive a class (say CA) from CCmdTarget, and then use macros such as
BEGIN_DUAL_INTERFACE_PART, BEGIN_INTERFACE_MAP etc. to expose an interface.
Another dll can access this interface by instantiating CA and then call CA's GetInterface().
My question is how to achieve the same thing using ATL?
I tried to create a ATL project with a COM class exposing a dual interface. If I instantiate the COM class,
I would get a compile error saying virtual functions AddRef, Release,QueryInterface are not implemented.
I don't need proxy/stub code involved becuase this interface is accessed not through COM actually. The reason
I have to do this because another DLL requires my DLL's exported class to expose a dual interface for it.
Thanks in advance for your big help and precious time.
Tony
|
|
|
|
|
In ATL, your CA class is an abstract base class - it doesn't have implementations of the IUnknown methods, as you've found out from the compiler errors. See KB article Q181265 for the steps you take to make a new object. Basically, you instantiate a CComObject<CA> instead - CComObject provides the IUnknown implementation.
--Mike--
http://home.inreach.com/mdunn/
"That probably would've sounded more commanding if I wasn't wearing my yummy sushi pajamas."
--Buffy
|
|
|
|