|
Perhaps more information on the nuts and bolts of how one actually *writes* this software may be helpful.. I have a step-by-step DCOM tutorial, where I build a simple server which says "Hello, world!" back to the client, may help put some of this in practical perspective...
The tutorials are written as a series of separate articles, called Steps, which cover the major breakpoints in the development of the system.
Step 1 of the tutorial for VC 6 is at
http://www.codeproject.com/com/HelloTutorial1.asp[^]
And Step 1 of the turtorial for Visual C++.NET 2003 is at
http://www.codeproject.com/useritems/HelloTutorial1NET.asp[^]
I tried to write the tutorials in Microsoft-ese, so you can follow along as if you were reading the Scribble tutorial. The VS.NET version is still a work in progress; that's why it's still in "Unedited User Constributions."
Not all the Steps have been written for the VS.NET version yet. But I am working on it!
Stay tuned!
Sincerely Yours,
Brian Hart
Department of Physics and Astronomy
University of California, Irvine
|
|
|
|
|
Hi everyoone,
I made a function that bring any window of any application to top.
But I have a issue with the Microsoft Word application.
When I have many Word application running and I want one of them (specific) on the top of the Z-order, it's allways the same instance of word that come on top. I looked their window handle and there all different.
Example : (doc1) (doc2) (doc3)
If I want doc3, it's doc1 that will prompted on top.
A Work around is that if a press the alt key after the issue operation, the right instance of word come on top of the Z-Order.
Some of functions that I tryed to do that operation:
::SetActiveWindow( oSelectedApp.GetWindow() );<br />
::SetForegroundWindow( oSelectedApp.GetWindow() );<br />
::ShowWindow( oSelectedApp.GetWindow(), SW_SHOW );<br />
::SetWindowPos( oSelectedApp.GetWindow(), HWND_TOP, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_SHOWWINDOW );
I seen this problem only for Microsoft Word application.
Sébastien Nadeau
Software Developper
|
|
|
|
|
Microsoft as the property that many application is launch by the same process.
Only one process "WINWORD.exe" but many instance of word in the Task Manager application list.
|
|
|
|
|
hello
I developed a activeX com component(.ocx) which is having only two property tabs named "set properties" and "extended". I want to add another property page tab in property sheet view. How can i add and use it.
|
|
|
|
|
Simple question: Is it neccessary to release the instance of GraphBuilder everytime you want to render a new file? Or can you merely release the interfaces queried and call RenderFile with the new filename and query the interfaces again?
Thanks.
|
|
|
|
|
Hi,
I'm trying to register a .NET assembly to COM+, and later use these COM+ services again in a .NET client application in a transaction context.
So far, I've been able to get my .NET assemblies into the W2003 server component manager by registering them into the GAC using regsvcs.
Then I exported the components as application proxies, so my client has access to the server where the COM+ components are hosted.
I install them in my client, but when I try to add a reference it says:
"The ActiveX type library was exported from a .NET assembly and can not be added as reference. Add a reference to the .NET assembly instead"
Sorry if this has been asked before, searched for it but nothing showed up. Any help on what Im doing wrong would be greatly appreciated.
Thanks in advance
|
|
|
|
|
Hi everyone!
I need to code a small project which communicates with a Programmable Logic Controller. I was told to do it with a original DLL file (UnCmDrv1.dll) for that. When I used VS 2002 for my project, everything worked fine.
Now that I have updated to VS 2005 I recieve an error while adding a COM reference dll:. The error is following: "Please make sure that the file is accessible, and that it is a valid assembly or COM component."
Is that some sort of bug of VS 2005 or am i doing something wrong. Any help would be appreciated.
Thanks in advance,
Henry
|
|
|
|
|
Hi !
my problem is as follows:
I have a COM module ( COM_A) written in C++ which receives several [IN] parameters and returns [OUT] parameters.
One of the input parameters is defined as [in] VARIANT vArrIn.
One of the output params is defined as [out] VARIANT *dArrOut.
There is no problem when I make the call directly to the respective method !
The problem arises when I try to call COM_A by means of a second COM module (COM_B), which makes use of the COleDdispatchDriver class. When I call COM_A from within COM_B by invoking InvokeHelper, the call fails and the return code says something like : "stub received bad data ...".
I found out that :
1) If there is a normal [in]int parameter AFTER the [in]VARIANT vArrIn, , the call fails.
2) if I invert the order of the params [in]int iVal, [in]VARIANT vArrIn, the calls succeeds.
2)Anyway, it never succeeds when there is an [out] VARIANT *dArrOut after the [in]VARIANT vArrIn parameter.
Why is this happening ? Is it possible to do it this way ?
Can someone please shed a light on this. I tried out many different possibilities, including trying to define the [in]VARIANT as a pointer and to define the [OUT] VARIANT* array as [in,out], it all wouldn't help.
Please help , because I need to find a solution.
Thanks in advance,
Rubi
|
|
|
|
|
Hello Rubi,
Sounds like your problem may be related to marshaling. However, if possible, it would be best if you could send me a scaled down and modified version of your COM server and client code that can re-create the problem.
Please send to : bio_lim_2004@yahoo.com
Best Regards,
Bio.
|
|
|
|
|
Dear Lim,
thank you for trying to help. I caused the problem by not defining the right order of parameters. Vita stated in his posting (one message entry below yours) that "The arguments in the array should be placed from last to first". As soon as I read his posting I understood that I had overlooked this requirement, which for itself is sad enough...! Defining it the proper way fixed my problem.
Thank you again,
Rubi
|
|
|
|
|
Hello Rubi,
No problem and congratulations on discovering the bug. Best of luck to your project.
Regards,
Bio.
|
|
|
|
|
Take a look into MSDN's "Passing Parameters" topic (or search for these words). From there:
typedef struct FARSTRUCT tagDISPPARAMS{
VARIANTARG FAR* rgvarg;// Array of arguments.
DISPID FAR* rgdispidNamedArgs; // Dispatch IDs of named arguments.
unsigned int cArgs;// Number of arguments.
unsigned int cNamedArgs; // Number of named arguments.
} DISPPARAMS;
The arguments are passed in the array rgvarg[ ], with the number of arguments passed in cArgs. The arguments in the array should be placed from last to first, so rgvarg[0] has the last argument and rgvarg[cArgs -1] has the first argument. The method or property may change the values of elements within the array rgvarg, but only if it has set the VT_BYREF flag. Otherwise, consider the elements as read-only.
With best wishes,
Vita
-- modified at 10:36 Friday 11th November, 2005
|
|
|
|
|
Dear Vita ,
thank you so much for helping me solve the problem. The reason was in fact the order by which the args were defined , I had overlooked the requirement that , as you stated : "The arguments in the array should be placed from last to first". After having fixed this , everything works out fine now .
Thank you,
Rubi
|
|
|
|
|
Hi all,
I have a really difficult problem.
I have an MFC application that hosts scripts via IActveScript engine. Inside the script I have created a COM object that exposes some events. The very same object is correctly used in a regular vbs scipt host by WSH:
<br />
Dim obj<br />
Set obj = CreateObject ("cnitfc.myobj")<br />
wscript.ConnectObject obj, "myobj_"<br />
<br />
Sub myobj_Event (nParam)<br />
msgbox "event fired"<br />
End Sub<br />
and myobj_Eventis is invoked when myobj fires "Event" event.
How to implement the very same "ConnectObject" method that is built-in into wscript object?
Thanks a lot in advance.
Regards,
Andrea
|
|
|
|
|
Now I'm trying to use IFolderCollection:
struct __declspec(uuid("c7c3f5a3-88a3-11d0-abcb-00a0c90fffc0"))
IFolderCollection : IDispatch
{
...
virtual HRESULT __stdcall get_Item (
VARIANT Key,
struct IFolder * * ppfolder ) = 0;
...
}
In my code, I have got an interface of IFolderCollection. And I want to enumerate the sub folders:
LONG nCount = qSubFolders->GetCount();
...
//
for (INT nLoop = 1; nLoop <= nCount; nLoop++)
{
CComVariant vtKey(nLoop);
vtKey.ChangeType(??????????); //Which type is "Key" type?
CComPtr<IFolder> qFolder;
qSubFolders->get_Item(vtKey, &qFolder); //Always fail!
if (qFolder == NULL)
{
}
...
In VB, I can write "Curfolder = Subfolders.Item(1)", but what about C++?
-- modified at 23:27 Sunday 6th November, 2005
|
|
|
|
|
Do you have access to the get_Item function? It is the only way to know the type. If I correctly undestand
<br />
set Curfolder = Subfolders.Item(1)<br />
works, so it should work in C++ as well, with vtKey.ChangeType (VT_I2), vtKey.ChangeType (VT_I4), vtKey.ChangeType (VT_R4), or vtKey.ChangeType (VT_R8).
You should also get the return code or some error info.
Regards,
Andrea
|
|
|
|
|
Thanks a lot.
I'm sorry that I made a mistake.
I haven't used VB for 2 years, so actually
set Curfolder = Subfolders.Item(1) is only in my memory, it can NOT work.
I found I could only visit this collection via "for each" in VB:
<br />
For Each folderCur In subFolders<br />
Debug.Print folderCur.Path<br />
Next<br />
So what should I do in C++?
Shall I use IFolderCollection::get__NewEnum(IUnknown * * ppenum) method?
How to?
Thanks.
-- modified at 7:54 Monday 7th November, 2005
|
|
|
|
|
I'm not an expert with Enum. I found some info on MSDN, look for IEnumXXXX and IEnumUnknown.
In the C++ client you have to call Reset (), Next () in order to enumerate all the items.
Look at ALCCollection sample, and keyword _Copy, CComEnumOnSTL, ICollectionOnSTLImpl, CAdapt, IEnumVARIANT, std::map, std::string, std::vector
Hope this helps.
Regards,
Andrea
|
|
|
|
|
I have tried out one way to enumerate sub folders:
<br />
...<br />
CComPtr<IUnknown> qUnkown;<br />
qSubFolders->get__NewEnum(&qUnkown);<br />
if (qUnkown == NULL)<br />
{<br />
cout << "Fail to query _NewEnum!" << endl;<br />
return;<br />
}<br />
<br />
CComQIPtr<IEnumVARIANT> qEnumVT = qUnkown;<br />
if (qEnumVT == NULL)<br />
{<br />
cout << "Fail to query IEnumVARIANT!" << endl;<br />
return;<br />
}<br />
<br />
for (INT nLoop = 0; nLoop < nCount; nLoop++)<br />
{<br />
CComVariant vtEnum;<br />
qEnumVT->Next(1, &vtEnum, NULL);<br />
<br />
if (vtEnum.vt == VT_DISPATCH)<br />
{<br />
CComQIPtr<IFolder> qFolder = vtEnum.pdispVal;
<br />
vtEnum.pdispVal->Release();<br />
<br />
if (qFolder != NULL)<br />
{<br />
CComBSTR bstrPath;<br />
qFolder->get_Path(&bstrPath);<br />
...<br />
}<br />
}<br />
}<br />
However, how to use property "Item" in VC is still a question.
Thank you.
-- modified at 12:58 Monday 7th November, 2005
|
|
|
|
|
In my opinion Item can be used "as is" and has little to do with enumeration, so I think the variang parameter can be a string instead of a number. This can be a particularity in your object.
|
|
|
|
|
I feel that this is such a stupid question, but I'll feel even more stupid if I don't ask it...
Let's say I have a DCOM app on server machine 'S'.
I have appropriate entries via DCOMCNFG on client 'C' so that it will (and does) run, and my client can instantiate an object on the server, and call it's methods.
For XPSP2 there are two sets of permissions;
Access
Local Access
Remote Access
Launch/Activation
Local Launch
Remote Launch
Local Activation
Remote Activation
Now, my questions are:
How does Launch differ from Activation?
Which machine(s) do the permissions need to be set on? In other words, if I have set security to deny access on the server, do I need to set security on the client as well, in order to allow the client 'out'?
My better question is 'Where can I get more information on DCOM security that is up to date?', I think!
Thanks in advance for any information/help.
Steve S
Developer for hire
|
|
|
|
|
hi all of u,
i am new to com development,while i am developing a component in c++ it will asks unknwn.h header file . i downloaded the file from microsoft and included it in the component.after that i compiled the component then it will gives the fatal error, how can i overcome this problem,Please help i need the solution,it's very Urgent.
RaviKumar
-- modified at 1:46 Saturday 5th November, 2005
|
|
|
|
|
You will find this files and related files in Platform SDK.
Have a great day ahead!
Regards,
Sohail Kadiwala
(My Blog - http://blogs.wdevs.com/sohail/[^])
modified 21-Apr-21 21:01pm.
|
|
|
|
|
My problem is not the function OleCreateLinkToFile() itself, but the resulting pointer.
ppvObj
[out] Address of pointer variable that receives the interface pointer requested in riid. Upon successful return, *ppvObj contains the requested interface pointer on the newly created object.
Is there any way to get the interface-pointer to the "real" com-object itself. For example, if i open a word document can i get the interface-pointer of the shown word.document or running word.application starting from the ppvObj-pointer.
My understanding of OLE is not good enough to see the right way (hope there is one ).
|
|
|
|
|
The second parameter tells the function what interface reference you want to the object. There is no "real" object - there are only interface pointers. If you want another interface of the object, you can always QueryInterface() to get it.
--
Pictures[^] from my Japan trip.
|
|
|
|
|