|
One convenient way to copy a collection of files to the clipboard is the implement the IContextMenu interface (then ivoking commands like "copy", "delete",...). For this you need to call GetUIObjectOf on the files parent folder (IShellFolder interface).
This even works when the files belongs to different folders (subfolders) since you provide files PIDLs that are relative to the parent folder one.
But I've got a situation where the files belong to different drives. And I can't build PIDLs relative to C:\something\ for files belonging to D:\someother\. It would also be the same with network folders.
1/ Can I build PIDLs relative to another drive ?
or
2/ Can I have an IShellFolder interface common to severall drives so that I can call a successfull GetUIObjectOf for the IContextMenu interface
or
3/ Another solution ?
Thanks
Yarp
http://www.senosoft.com/
|
|
|
|
|
I do think this is the right place to post this, because as I understand Office Automation is just a fancier word for COM to Office.
I've done a small program that generates a bunch of worddocumnets and sends it either to printer or as a attached file in an e-mail.
The printing works fine, it prints all the generated docs with the recipients name and stuff.
The problem is with the mail. When my program tells word to send it to the specified e-mails, I first get a warning that a program is trying to use my mail and I can allow it to do so for an amount of time. This is fine, I can live with that.
But then there comes another warning(excuse my bad english translation, I get the error message in swedish):
A program is trying to send automatic e-mail. Will you allow this? If this is unexpected, it could involve a virus and you should choose No.
Then I have to wait for about 5 seconds before I can press Yes.
Is there any way to get around this message, or should I try a diffent approach? I've already allowed the program to use my mail program.
I use MailMerge functions from word to send the documents, both to printer and to mail.
I really hope someone can help me out
/Markus
|
|
|
|
|
Microsoft added this to Outlook after one of the slews of e-mail viruses. In older versions of outlook (98 and maybe 2000), this could be turned off, but I've never been able to find a way around it with outlook 2003. I ended up getting a 3rd party component for sending out e-mails. Sorry I don't have a better answer.
|
|
|
|
|
Hi
Is it possible to pass the object (in C# which has got methods and member variables) to a COM in VC++? If so how to implement it?
Please Help.
Many Thanks
Diana
|
|
|
|
|
Hi Diana
I'm not sure if there is a way of doing what you want, probably yes. Maybe some COM guru over here could point it out. You'd have to manage interfaces like IMarshal, IStreamXXX, and similars to stream your object from one side to the other, but as I said I don't know too much about the subject.
Anyway you could encapsulate your object into a COM interface (which provide access to members and methods), and then, pass the interface pointer to COM.
You can ask in microsoft.public.win32.programmer.ole. I think you will get a better answer there.
Best regards.
|
|
|
|
|
Hi
I think I need to explain more.
There is one class say Class1 and it is implementing an interface IClass1. Object of this class is communicating with a COM in VC++ by calling a method in a class from COM. Before coming out of this method it is required to call method in Class1.
IClass1 pointer is available in COM through type library and object of the class is passed to COM as VARIANT. I have reached till this point and don't know how to proceed. Or is there any other way to implement it?
Thanks in Advance
Diana.
|
|
|
|
|
Diana Fernandez wrote: IClass1 pointer is available in COM through type library and object of the class is passed to COM as VARIANT. I have reached till this point and don't know how to proceed. Or is there any other way to implement it?
If I have undertood well you have a VARIANT that contains a IClass1 pointer...so you can
VARIANT vtPointer;
<br />
if(vtPointer == VT_DISPATCH)
{<br />
IDispatch * pDisp = vtPointer.pdispVal;
IClass1 * pClass1 = NULL;<br />
HRESULT hr = pDisp->QueryInterface(IID_IClass1, (void**)&pClass1);<br />
if(FAILED(hr))<br />
{<br />
}<br />
<br />
pClass1->Release();<br />
}
I hope it helps.
Best regards.
-- modified at 3:29 Friday 25th November, 2005
aaarrggh!!! I don't know how to insert tabs in the code!! sorry for the bad format
|
|
|
|
|
Hi Gizzo,
Many Thanks for the prompt reply. Its working fine.
I think the QueryInterface is giving me a new pointer to IClass1. Not the same which is there in the variant. Because while debugging its going into the methods of Class1, but all the other members of the Class1 remains undefined.
Thanks & Regards,
Diana.
|
|
|
|
|
Diana Fernandez wrote: I think the QueryInterface is giving me a new pointer to IClass1
I don't think so. What QueryInterface does is basically a casting. An implementation example could be:
HRESULT CClass1::QueryInterface(REFIID riid, void** ppvObject)<br />
{<br />
if(riid == IID_IUnknown)<br />
*ppvObject = reinterpret_cast<IUnknown*>(this);<br />
else if(riid == IID_IDispatch)<br />
*ppvObject = reinterpret_cast<IDispatch*>(this);<br />
else if(riid == IID_IClass1)<br />
*ppvObject = static_cast<IClass1*>(this);<br />
else<br />
{<br />
*ppvObject = NULL;<br />
return E_NOINTERFACE;<br />
}<br />
<br />
AddRef();<br />
return S_OK;<br />
}
So, when you call QueryInterface, the object returns a pointer to the requested interface, but the object is the same. You say that the members remains undefined. Well, maybe the object wasn't initialized properly, but is should be the same object.
Regards.
-- modified at 5:15 Friday 25th November, 2005
|
|
|
|
|
That's not necessarily true. Tear-off interfaces are an example in which QI doesn't just cast.
--
Pictures[^] from my Japan trip.
|
|
|
|
|
Hi Gizzo,
Many Many Thanks!!!
Object wasn't initialized properly!!!! Its working . Great!!!
Once again Thanks.
Keep it up!!!!
Diana.
|
|
|
|
|
Hi,
I tried to automate an MFC Dialog App using the recipe from the MyCoolApp article. In a few words, you make a CApplication : public CCmdTarget, add the macros by hand and insert the necessary registration calls to initInstance of the CMyApp : public CWinApp.
The sample app from the article is an MDI and has a Document-View-Architecture. It works fine, but with my own app the client freezes when calling OleRun in _com_ptr_t<...>::CreateInstance.
OleRun(LPUNKNOWN pUnknown) queries an IRunnableObject from IUnknown an calls its member Run (MSDN).
What is generally wrong when OleRun freezes? Is the IRunnableObject missing? Is the com object which has IRunnableObject trying to contact its container, which is missing? But CreateInstance always calls OleRun.
Any suggestions? Thank you.
Regards Werner
-- modified at 7:42 Wednesday 23rd November, 2005
|
|
|
|
|
Hi
i have a shell extension dll which i am using as a Drag drop handler . i have built the DLL using the x64 settings . Although the DLL is getting registered the shell extension doesnt perform any function when drag drop is performed . Any idea on how to overcome this
Thanks in advance
|
|
|
|
|
Hello,
I added the Get/Set property in activeX cotrol which contain the "Invalidate()". While i use these properties in an application, the exe get terminate by saying unreferenced handle m_hwnd.
What else i have to do.
Please help me.
gajesh mangal
Pune(India)
|
|
|
|
|
I'm trying to make my own activex on the same model as the Instant Messenging activex provided by Microsoft: Name.NameCtrl.1
In such a model, a javascript function is passed to the activex:
...
IMNControlObj = new ActiveXObject("Name.NameCtrl.1");
...
IMNControlObj.OnStatusChange = IMNOnStatusChange;
...
And at the activex side (in C#), I have this:
public object OnStatusChange
{
set
{
// Couln't find any way to cast the 'value'
}
}
I've been looking for a solution for a long time.
I would appreciate if you have a solution or even a clue to help me.
Thanks.
|
|
|
|
|
Hello Everybody,
I have created one ActiveX DLL for printing Web page for my ASP Application. When I run the application i am getting Error like (0x800A01E2 Printer error) please help me in brief because i am new in ActiveX DLL Creation...
Thanks
N.Rajakumar B.E.,
Application Developer,
|
|
|
|
|
Iam struct with the problem of passing events from activex control property page to the control. My custom property page contains flexi grid where i define properties.
My problem is to pass events from grid on property page to control.
Can anyone help me on this problem....or any clue or example to find the solution.
Regards,
ashwin
|
|
|
|
|
hello,
I am using a OCX control in a dialog based application. While using the "all" tab in property page, the color dialog is displayed for a property.
But when i select the color from the color dialog, the selected color is not reflected.
What should i do to implement the OLE_COLOR property properly.
Thank You
Gajesh Mangal
Pune(India)
|
|
|
|
|
Dear friends,
Few days ago i developed an ActiveX control using MFC. The control was intened to be used by MFC dialog based clients. It is a windowless control. I preferred ActiveX control over simple COM dll, because it is easy to deal with the control events in MFC dialog based application. Just drop the control on the dialog, add a member variable, right click on it and handle events. So easy.
Now i want to use the functionality of this control in an application with no User Interface (i.e windows service). Is it possible to use the functionality exposed by ActiveX control in an application which provides no GUI container. If yes, then how ???
Ahsan
|
|
|
|
|
What you're really using, when you let ClassWizard do all that magic, is something called "connection points".
It's a way for the server to communicate asynchronously with the client about changes in the server, e.g. incoming data or user input.
You already have the server, but you need to implement a connection point sink. The sink is a COM interface defined by the server that the client implements and hands over a pointer to the server by a call to IConnectionPoint::Advise().
It's usually easier to have an example to look at so go and have a look at it here.[^]
Tip of the day, free of charge
Don't forget to marshal the sink interface in your server if you plan to fire events from different threads than the one that created the server.
It's supposed to be hard, otherwise anybody could do it!
|
|
|
|
|
I have created active X controls to capture images from various devices such as
fingerprint scanners. The final solution must now be deployed on a web solution.
Sure we all know about ActiveX controls and web pages, but put that aside,
How do I retrieve the information (blob) from the active X control and make it
part of the POST when the user presses Submit. ?
Some thoughts I have on this,
Save the blob temporary on the clients hard disk, and upload it via a
"file post" message, which is easy, but not ideal.
Start an independant "Thread" solution to ftp the file to the server.
Ideally it should form part of the post, but I am not sure how to impliment these
in the COM c++ code ?
Help appreciated
|
|
|
|
|
Hi guys,
I am new to COM. Any suggestions on how I should proceed.:->
I need tips on how to write my first simple hello world program using COM.
Thanks
Owner Drawn
--Nothing special
|
|
|
|
|
Hi,
1. There are a lot of resources here, in The Code Project. Use them.
2. If you have the posibility of buying books or taking them from anywhere, I recommend you Essential COM, from Don Box. The first chapter is the best introduction to COM I've ever read. There are a lot of books. Search in Amazon and just read the reviews.
In my case I've found some 2'nd hand copies of
Essential COM,
Inside Distributed COM (Gut Eddon, Henry Eddon) and
Developer's Workshop to COM and ATL 3.0.
3. Use the forums. This one and ...
microsoft.public.vc.atl
microsoft.public.win32.programmer.ole
4. be patient...
-- modified at 12:35 Friday 11th November, 2005
3 and a half. Here you can find some links of interest:
http://www.sellsbrothers.com/links/#unmanlinks[^]
|
|
|
|
|
Owner drawn wrote: need tips on how to write my first simple hello world program using COM.
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,
Please help on the following issue.
How can I creat a BSTR using a char array, containing NULLS . I am failing to do it this ways:-
void CEquipMain::varTest(){
char str[] = {'L',0x00,0x00,0x01,0x00,'S',0x08,0x00};
BSTR bstrng = ::SysAllocStringByteLen(str,sizeof(str));
char* data = _com_util::ConvertBSTRToString(bstrng);
printf("4th element in str:%d ",str[3]);
printf("4th element in :%d ",data[3]);
SysFreeString(bstrng);// deallocates the memory and kills the object
bstrng = NULL; // varaible is initialised to null
}
the output i get is :
4th element in str:1
4th element in str:8
If we dont count the Nulls, the 4th character is 0x08.
This proves that the BSTR is not properly created and it skipped the NULLs while creating the BSTR!!!
amit
|
|
|
|