|
> 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
|
|
|
|
|
Hi everyone,
I want to make a website and to show tumbnails of images. I can't find any free component or source code to solve this problem. Does anybody to help me?
Best regards,
Leslie
|
|
|
|
|
Hi,
I have the following problem.
From within the same thread I wish to call two components with different threading models.
Number one component will instantiate another component and receive events through connection points. This component will have to be Free-threaded or the call to ICOnnectionPoint::Advise() will fail.
The other component should instantiate the IShellLink interface to create a shortcut.
Take a look at this sample:
::CoInitializeEx(NULL, COINIT_MULTITHREADED);
HRESULT hr = S_OK;
IMulti* p1 = NULL;
IShellLink *psl=NULL;
hr = ::CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (LPVOID*) &psl);
ASSERT(SUCCEEDED(hr));
hr = CoCreateInstance(CLSID_Multi, NULL, CLSCTX_INPROC_SERVER, __uuidof(IMulti), (void**)&p1);
ASSERT(SUCCEEDED(hr));
p1->Release();
psl->Release();
::CoUninitialize();
The problem is that the call to
hr = ::CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (LPVOID*) &psl) fails when CoInitializeEx has been called with the COINIT_MULTITHREADED parameter
Any help will be greatly appreciated
Christian Skovdal Andersen
|
|
|
|
|
I Everybody,
I try to use WTL to create an list control with callback Items but it does not work !
My parent window does'nt receive the LVN_GETDIPINFO message.
Any Idea?
Thanks for help
Vincent Daron.
|
|
|
|
|
I'm going mad with this. I created an ATL object with a single Dual Interface. I use this from a C++ project using smartpointers... no problem. I have now added an events interface implementing IConnnetionPointeCOntainer etc following closely a numbe rof examples and my ATL Internals book. The component builds no problem however the client now gets the error C2787: 'IDispatch' : no GUID has been associated with this object. What is going on ?? Does anyone have a decent example of a simple ATL component that has one standard interface and another events interface and a C++ client that that implements both the standard dual interface and the event sink using the smart pointers.
Please help if you can..
|
|
|
|
|
Chris,
My 'DCOM D-Mystified' tutorial, here on The Code Project, might help. With it, you can get your feet wet at least doing up a simple client/server system using Connection Points and the works. I know its title says DCOM, but it can work for COM too -- just keep the server and client on the same computer!
Click here to start the tutorial!
Cheers,
Brian Hart
|
|
|
|
|
Thank you, Thank you Thank you. I've got it working at last. One of the problems I had with the error message was because I needed to include the atlbase.h header as well.
Chreers
|
|
|
|
|
I developed a system that is on the market more than one year and the last
version was updated on September/2000. The system is developed in Visual C++
(SP4) using client/server technology throw DCOM servers (with ATL). Everything
was correct until this week, when five costumers had the following
problem: "Class not registered" (HRESULT = 0x80040154). We have about ten servers
that are registered during the system's installation, but just one is having this
problem. In other machines everything is correct.
In these costumers, analyzing the registry, I just found two entries with the
name of the server (the server's name is MTEFGERADORS with just one interface
IMTEFGERADOR):
[HKEY_LOCAL_MACHINE\Software\CLASSES\CLSID\{B54FCA20-3470-11D3-84DE-0080AD19F504}
\InProcServer32]
@="C:\\WKRADAR\\PGMS\\FISCAL\\MTEFGERADORSPS.DLL"
"ThreadingModel"="Both"
[HKEY_LOCAL_MACHINE\Software\CLASSES\Interface\{B54FCA20-3470-11D3-84DE-
0080AD19F504}]
@="IMTEFGerador"
In fact, there are many other keys missing. The first effort was to registry
manually, using the commands "regsvr32 MTEFGERADORS.dll"
and "MTEFGERADORS.exe /RegServer", but the registry didn't changed.
The second effort was to reinstall DCOM with no success.
The third effort was to format the machine and just install Windows and the
system. But it didn't work either.
It happens on Windows 95, 98 e NT.
Would appreciate any help ..
|
|
|
|
|
1)check if you make every component version in the same project or diferents projects.
2) Unregister the component in the client a server ( write: regsvr32 "Mydll.dll" /u )
3) Make the ThreadingModel free (for concurrency).
4) register the project-dll
4) Check the project id in the server and client.
5) try again.
|
|
|
|
|
1)check if you make every component version in the same project or diferents projects.
2) Unregister the component in the client a server ( write: regsvr32 "Mydll.dll" /u )
3) Make the ThreadingModel free (for concurrency).
4) register the project-dll
4) Check the project id in the server and client.
5) try again.
|
|
|
|
|
I have seen a similar problem before.
In our case what had happened was that the .rgs file in the project was incorrect!
That is it had different ID's to the actual interface! So when we registered it the
registry entries were wrong.
So, I suggest you check that the .rgs iids all match what the client is actually requesting. If there is not a match then I suggest you create a NEW project an add all
your code to it, then re-compile the client(s). If this is not an option then you need
to manually make sure that your server code has the iids that the client is asking for.
(Find in files *.* all matchs for the previous iids, just to make sure).
BTW: Really really make sure that the registry is clean, this is very important. So
you should :
Make sure that it is not running (or for DLL's not loaded).
Deregister it.
Then search the registry for old stuff (CLSID and Appid)
Let us know how you go.
|
|
|
|
|
Does anyone knows a window DLL which can help to detect wm_message of an active window. I also want to know how to make use of this DLL in VB ?
|
|
|
|
|
After writing a long code of our program we may distribute it to others by a dll. Can we do the same with COM.
Thanking You.
|
|
|
|
|
how can i register & Configure an NT Service implemented as COM Object on a remote machine.
Right now what I am doing is:
Copy the Service(S.exe file) and Proxy-stub dll to the remote machine and place them in system32 directory.
Then I run the commands:
s /service
regsvr32 sps.dll
for registering service and proxy-stub dll.
I need all this functionality programatically.
so that i just specify the name of the remote machine in client and it does the rest of all. i.e
register the exe as service and also register the proxy stub dll.
can anyone help me
thank you very much in advance.
|
|
|
|
|
Hi all!
Can you explain me how should I implement my ActiveX control to get the ability to add my control to Excel documents through Excel's "Insert object" dialog box.
|
|
|
|
|
Has anyone created a "Dynamic Search Handler"? (Start|Find|<your menu="" items="">)
I'm trying to duplicate the functionality of the PowerToy "FindX.DLL" & I'm up against a brick wall tring to figure out how FindX.dll implements a dynamic menu WITH an icon.
According to the MS docs (http://msdn.microsoft.com/library/psdk/shellcc/shell/Shell_Int/SearchHandlers.htm): "Menu icons are not supported for dynamic search handlers".
But when I look at the registry enteries for the FindX tool, it shows that it is a dynamic search handler & when I use it - it has an icon!
Does anyone know how FindX.dll does it?
|
|
|
|
|
Hi! I am developing a container in VC++ (COleClientItem and COleDocument). I need to make Shockwave Flash control (provided by Macromedia) transparent, but i am not getting thru. The default WMode property of the control is "window" and in VB, if the WMode property is changed to "Transparent" then during runtime the control becomes transparent and can toggle between Window and Transparent at runtime thru script. Also, when the control is not transparent initially, VB makes a window for it. but at runtime when the control turns transparent, there is no window - and returning to design time also, there is no window. So VB container is initially providing a window, but later removing it when the control becomes transparent and continues to be windowless thereafter. I also inserted the control in VC++ thru component Gallery. But the Create function is there instead of CreateEx where WM_EX_TRANSPARENT can be given. Although i used SetClassLong, it also didnt work, maybe bcoz the window is there. Please reply me is u have a solution ar if u r interested in providing a solution but didnt understand the problem clearly. I will write in more detail for u. Thankyou very much.
hints - IQuickActivate is supported by the control and i am using it.
Also, regarding property pages - before the property pages for the control maybe initialized, maybe if the WMode is set to Transparent, then it may work. I tried this way - I created a temporart storage using StgCreateDocFile and then created a stream using COleStreamFile. Then created a temporary flash control thru CoCreateInstance, then changed the WMode property to "Transparent" using COleDispatchDriver and saved it to stream. Now I created the actual control and queried for IPersistStreamInit and called its Load method passing the stream. The transparent property is set, but the control is still not transparent.
Thankyou.
regards,
Jeetendra Dhall
|
|
|
|
|
Hi,
I've made small shellextension and it works fine. Next, I want to add propertysheet extension. So I read one Complete Idiot's guide. Because I love WTL, I've tried to use CPropertyPage from WTL in AddPages method of IShellPropSheetExt interface. But when the extension is called, it goes down with "the memory cannot be read" in altwin.h. I cant find a way through. Can anyone help?
HRESULT CDbfExtension::AddPages(LPFNADDPROPSHEETPAGE lpfnAddPage, LPARAM lParam)
{
HPROPSHEETPAGE hPage;
CPropertyProppage m_PropPage;
m_PropPage.m_psp.dwFlags|=PSP_PREMATURE;
m_PropPage.SetTitle(_T("DBF INFO"));
hPage=m_PropPage.Create();
if ( NULL != hPage )
{
// Call the shell's callback function, so it adds the page to
// the property sheet.
if ( !lpfnAddPage ( hPage, lParam ))
DestroyPropertySheetPage ( hPage );
}
return S_OK;
}
|
|
|
|
|
Hi,
I'm implementing a COM Local Server that has to call-back on clients. I tought of using connection points but as my server has to callback on clients in a seperate thread, I can't use this mechanism as it doesn't marshall interface pointers. So I wrote my own call-back mechanisme. I did this by defining the call-back interface as a source interface in my server's idl file.
So far no problem, but when I try to create a client component that implements this call-back interface I start running into problems when trying to import the .tlb files. I solved this by including the .h of my server component in my code and importing the .idl of my server in my clients .dl file. This works but is propably not the most ellegant sollution. And besides that I don't have the definitions of the server's smartpointers and have to define them myself.
Does anyone have a sollution for this problem?
|
|
|
|
|
Problem with using Microsoft G.723.1 codec : can't build working graph with this codec in Graph Builder. While building graph this codec reports 0 bits on output pin .
|
|
|
|
|
Hi everybody,
does anybody know how to get a tooltip on a disabled activex control?
I'm using the solution described in MSDN: "HOWTO: Add Tooltips to ActiveX Controls" (Article ID: Q141871), but the tooltips only work if the control is enabled.
Thanks in advance!
Michael
|
|
|
|
|
I am facing problem in automating MSProject from VC++ automation client aplication.I have created simple VC++ dialog based application In which I generated Wrapper class file for MSproject type library using ClassWizard.When I run the MSProject application in Single Threaded automation client application it runs fine.But when I run MSProject application in multithreaded automation client application I got the problem if first thread close the MSProject application then successive thread get the problem in accessing method of MSProject component while I am seperatly instantiating MSProject application instance in thread.While this problem doesnot occur for Excel and Word.
I found from MSDN that every time MSProject Application instance is not created if MSProject application is already running then the instance of that is shared .But my requirement is that I want to create VC++ multithreaded automation client application .Everytime How I can get the new instance of MSProject in thread.
Please help me.It is very urgent.
Thanks in advance
Sanjeev
|
|
|
|