|
You can try to get pointer to your object and then pass it to your COM object as LONG. That way your COM object will know the memory location of the object you are passing.
Peter
|
|
|
|
|
I have tried passing the pointer to the object as long.
When I do this it does not appear (when debugging the COM)to have the same value it had in the app which created it.
Also I could not get the long value back into the second app, it had a different value.
Puzzled !
|
|
|
|
|
If your com is an exe the passing a pointer as long will not work since the com is in a diferent process and therefore the address in the long is not valid. Passing pointers as long will work only if your COM is a dll.
(Don't forget to cast the pointer in both sides back to the structure it points to, before using it).
|
|
|
|
|
On the other hand it would be better to create a COM wraper for the object that you are passing. And than just pass the interface pointer.
|
|
|
|
|
How do I create a COM wrapper ?
Remember I am very new to COM.
|
|
|
|
|
>I wish to take a pointer to a C++ object from one application and pass it via COM to another C++ application.
You cannot do this, COM or no COM. Each Win32 app has its own isolated memory space. A pointer in app A has no meaning if you pass it to app B.
You'll need to use IPC (inter-process communication) techniques to pass data between apps. There are articles here at CP on doing this - give them a read. (You are sort-of on the right track with CMemFile, but CMemFile is not a memory-mapped file, which is the IPC mechanism you're thinking of.)
|
|
|
|
|
What exactly are you trying to do? What does this C++ do that separate applications need access to it? You might want to put the C++ object in a separate COM object and have it shared between processes.
|
|
|
|
|
I am using one app to do an external equipment search (this takes a while) and store the objects it created (one per equipment present) in a COM server. I want many other applications on the same machine to be able to query the COM server to get pointers to the objects.
So
Equipment search app -> COM server
COM Server -> Testing App 1
COM Server -> Testing App 2
etc
I do not want to have to go through all my equipment classes and make them serializable.
Thanks
|
|
|
|
|
Then I would wrap your C++ class in a COM object. You can pass an interface pointer from your server to the clients so they may access the C++/COM object.
|
|
|
|
|
Then I would wrap your C++ class in a COM object. You can pass an interface pointer from your server to the clients so they may access the C++/COM object.
|
|
|
|
|
Which class, the container or each of the equipment classes (many different types) ?
|
|
|
|
|
Hi all
I have a project in VC++ and MMC.
I would like to know, how can i prevent from a user to exit MMC ???
Thanks.
===============
ICQ# 37571575
===============
|
|
|
|
|
You cannot prevent _any_ user to exit from mmc.
The only way to try something - is to make a "User mode, limit access".
|
|
|
|
|
You cannot prevent _any_ user to exit from mmc.
The only way to try something - is to make a "User mode, limit access".
|
|
|
|
|
Hi,
I tried running "DcomCnfg.exe" to configure DCOM on a Windows '98 machine and I got a message saying that you have to have user-level access selected in your network control panel before you can run this utility...
Is it possible to run a DCOM server on Windows '98 without having user-level access set up in the network control panel ? (most of our clients do not have user-level access set up) Can It be done with the default share-level
access ?
Also, on another Windows '98 machine, I could not locate the Dcomcnfg.exe application. I was under the impression that this was available in all Windows '98 installations - Am I correct, or do you have to specifically select this option when doing a custom Windows '98 installation ?
TIA
Venkatesh
|
|
|
|
|
|
Hii!
I have a little question for you that I'm looking for answer for a
long time...
Y when we are developing a COM component we're using interfaces and
hide the implementation in DLL/EXE?
Thanks
Adam
p.s
Sorry about the "not well" English - I'm from Israel
|
|
|
|
|
Hii!
I have a little question for you that I'm looking for answer for a
long time...
Y when we are developing a COM component we're using interfaces and
hide the implementation in DLL/EXE?
Thanks
Adam
p.s
Sorry about the "not well" English - I'm from Israel
|
|
|
|
|
We are getting an error while trying to install an app using the VB package deployment utility. There are three OCX files, two of which are registered correctlly, the third brings about an error dialog, "Error occurred while trying to register the file *.OCX: "Abort, Retry, Ignore".
When we try to run the app, after having dismissing the error message with "Ignore", we get an error:
"component *.OCX or one of it's dependencies is not correctly registered. The file is missing or invalid."
There is no .dep file provided with the OCX, which happens to be an SAP active x control.
Anybody know of a generic fix for this?
Thanks for any help or information!
|
|
|
|
|
Hi :
Hope you are familiar with DBMON utility I want to use it with
DCOM to monitor remote OutputDebugString messages.
If I simply use CoCreateInstanceEx with COAUTHINFO as NULL then
the mutex created in my server process access the OutputDebugString
messages in two scenarios only.
1. The client ( network )user is the local admin of the
server machine
2. The client and server machine users are same ( I mean same
users not same groups )...
I used COAUTHINFO and COAUTHIDENTITY from the
client ( where I could always pass the user name and password of the
local admin of the remote computer ). But when I do it It has got
strange results.
1. I only succeed if on the client machine I am any network user and
I have given the user name and passwd of the local admin of the remote
machine and the user logged on the server also belong to the local admin
groups of the server pc.
Now the second condition above, which was working previously does not
work any more now. why ,,,, I am totaly confused .
2. Does it haveanything to do with the creation of the filemapping
object remotely which is responsible for signaling the DBWIN_BUFFER_READY
event to indicate that a OutputDebugStrng message is captured.
I have supplied security identifiers as NULL in the DBMON code.
In case you are not familiar with DBMON or its code . It is available
in Platform SDK samples and the code is one cpp file with 2 or 3 pages
max and the very easy for a person of your calliber...
RE .. I am desperate ....
|
|
|
|
|
I'm learning about COM in C++.
I want to create a com dll which will have 2 interfaces. 1 public method in each.
I then want to create a client to call a method on interface1, then use QueryInterface to return an interface pointer to interface2, so I can call the method on the second interface.
Both interfaces will have the same method name & parameters.
Where can I get sample code or tutorial to do this?
Cheers.
|
|
|
|
|
You can find a great article on COM & interfaces at the Code Project. Go to the following link:
http://www.codeproject.com/com/comintro.asp
Bye..
|
|
|
|
|
My dear MSDN is full of such samples ..
Just spare some time and you will surely get a sample of it.
|
|
|
|
|
Is there any way of getting addresses from MAPI without showing the dialog (MAPIAddress), can I get a list of all the addresses?
And, is there any way of getting more then just the name and email address, I want the telephone number (Outlook stores this info in it's address book).
TIA
Fredrik Sigbjörn
VoxIT
|
|
|
|
|
Well I wanted to send 2 pictures, but I don't know how can I attach them. It won't be so easy to describe myself, but I'll try...
I implemented a NameSpace handling code in VC++6.0, without MFC. It works, but it has some problems.
1. I can show the folder's icons. These are OK, and looks like as "original" windows icons. But I use an ExtractIcon application. This app. changes many of system icons. (desktop,my computer, normal directories, shared directories, etc.) How can I ask/get/handle these icons (too)?
2. I can enumerate subfolders. But when I show them the order of subfolders are not the same as in Explorer. How can I sort them?
3. here's a part of my code: (instead of two pics)
How can I solve the #1 and #2 questions?
// lpsf: interface pointer
// lpi: absolute pid (merged myself)
// hIconSmall: the icon what I want to get
bool ANameSpace::GetDisplayIconOf(IShellFolder *lpsf, LPITEMIDLIST lpi, HICON* hIconSmall)
{
bool _back = true;
HRESULT hres;
IExtractIcon *pxi;
// get IID_IExtractIcon interface
hres = lpsf->GetUIObjectOf(NULL, 1, (LPCITEMIDLIST*)&lpi, IID_IExtractIcon, NULL, (LPVOID *)&pxi);
if (SUCCEEDED(hres))
{
char szIconFile[MAX_PATH];
int iIndex;
UINT wFlags = 0;
hres = pxi->GetIconLocation(GIL_FORSHELL, szIconFile, sizeof(szIconFile), &iIndex, &wFlags);
if (SUCCEEDED(hres))
{
// I need only the small icon
HICON hiconLarge = NULL;
int cxIcon = GetSystemMetrics(SM_CXICON);
int cxSmIcon = GetSystemMetrics(SM_CXSMICON);
// try getting it from the Extract member fuction
hres = pxi->Extract(szIconFile, iIndex, &hiconLarge, hIconSmall,
MAKELONG(cxIcon, cxSmIcon));
}else
_back = false;
pxi->Release();
pMalloc->Free(pxi);
} else
_back = false;
return _back;
}
Thanks in advance,
---
AkelA
|
|
|
|