IStorage, IStream and folder copying to Clipboard

I have an application which represents the filesystem of a device
connected via a serial link. I do navigate the device's filesystem and
copy files to/from using drag/drop or clipboard. Here comes the
problem. I implemented Drag/Drop and Clipboard using CF_FILEDESCRIPTOR
and CF_FILECONTENTS with IStream. But i donno how to copy the nested
folders from the application to the Windows Explorer. Should i
enumerate the contents of  folder and all itz subfolders to create the
FILEGROUPDESCRIPTOR? It can be timeconsuming over the serial link.
:-(((

Somewhere i read that 'IStorage' can be used for the purpose. But how
? :-( No information or examples regarding  "how to implement
IStorage" is available. Can anybody help me to solve out this,
pleeeeeeeease?

regards
Nathan R.
0
nathan_rr (2)
10/28/2003 12:24:33 PM
vc.mfc 33608 articles. 0 followers. Follow

9 Replies
1376 Views

Similar Articles

[PageSpeed] 30

> Should i enumerate the contents of  folder and all itz subfolders to
create the
> FILEGROUPDESCRIPTOR?

yes, and for folders you have to set the dwFileAttributes member to
FILE_ATTRIBUTE_DIRECTORY







> Somewhere i read that 'IStorage' can be used for the purpose.

thats wrong


0
orp (4)
10/28/2003 9:05:20 PM
I know it. That is not my problem. The FILEDESCRIPTOR for directory is
created using the FILE_ATTRIBUTE_DIRECTORY in the dwFlags. My case is
regarding the copying of a folder which contains a somany subfolders
and files.

I am using delay rendering to set the clipboard. So when the user
right clicks in his Windows explorer or Desktop, my
MyOleDataSource::RenderData(...) is invoked, which will cause the
'Paste' menu item to be enabled in his context menu. In
MyOleDataSource::RenderData(...), the value of 'cfFormat' member of
the parameter 'lpFormatEtc' is g_cfFileGroupDescriptor. At that time
the FileGroupDescriptor is created. Suppose that, the user has copied
a folder (which contains nested folders and files), What i am supposed
to do? I dont have the contents of the folder at hand. So, should i
enumerate the folder to get the list of all the files and folders to
create the FILEGROUPDESCRIPTOR with all the FILEDESCRIPTORS at that
moment itself. As my application is working over a Serial cable
connection, this will take a considerable amount of time. So, is there
any other way to do this? OR, Is this the only way to do it?

A reasoable approach is to enumerate the contents of the folder, when
'paste' occurs. But donot know how it can be done. :-(

Any help or links are appreciated.

regards 
Nathan R.

"kai" <orp@uni.de> wrote in message news:<bnmli1$133e04$1@ID-92595.news.uni-berlin.de>...
> > Should i enumerate the contents of  folder and all itz subfolders to
>  create the
> > FILEGROUPDESCRIPTOR?
> 
> yes, and for folders you have to set the dwFileAttributes member to
> FILE_ATTRIBUTE_DIRECTORY
> 
> 
> 
> 
> 
> 
> 
> > Somewhere i read that 'IStorage' can be used for the purpose.
> 
> thats wrong
0
nathan_rr (2)
10/29/2003 3:49:02 AM
some time ago, i had a similar problem (drag and drop of large directory
structures from a namespace to the desktop, and drag and drop is very
similar to copy and paste)

i know 2 ways to prevent the early directory enumeration:
1. like winzip/winrar: creating a real dummyfolder for dropping
2. like smartftp: create a drag and drop handler which is acting within the
droptarget

(you can use http://www.codeproject.com/clipboard/clipspy.asp to see how and
what formats programs copy or drag)








> I am using delay rendering to set the clipboard. So when the user
> right clicks in his Windows explorer or Desktop, my
> MyOleDataSource::RenderData(...) is invoked, which will cause the
> 'Paste' menu item to be enabled in his context menu. In
> MyOleDataSource::RenderData(...), the value of 'cfFormat' member of
> the parameter 'lpFormatEtc' is g_cfFileGroupDescriptor. At that time
> the FileGroupDescriptor is created. Suppose that, the user has copied
> a folder (which contains nested folders and files), What i am supposed
> to do? I dont have the contents of the folder at hand. So, should i
> enumerate the folder to get the list of all the files and folders to
> create the FILEGROUPDESCRIPTOR with all the FILEDESCRIPTORS at that
> moment itself. As my application is working over a Serial cable
> connection, this will take a considerable amount of time. So, is there
> any other way to do this? OR, Is this the only way to do it?
>



0
orp (4)
10/29/2003 12:58:02 PM
"Nathan R." <nathan_rr@yahoo.com> wrote:
> I am using delay rendering to set the clipboard. So when the user
> right clicks in his Windows explorer or Desktop, my
> MyOleDataSource::RenderData(...) is invoked, which will cause the
> 'Paste' menu item to be enabled in his context menu. In
> MyOleDataSource::RenderData(...), the value of 'cfFormat' member of
> the parameter 'lpFormatEtc' is g_cfFileGroupDescriptor. At that time
> the FileGroupDescriptor is created.=20

The shell is calling GetData because it wants to know whether the =
FD_LINKUI flag is set in the (first) file descriptor. You can prevent =
this by providing the CFSTR_PREFERREDDROPEFFECT format in your data =
object (perhaps set to DROPEFFECT_COPY). This is mentioned in the topics =
"Shell Clipboard Formats" and "Handling Shell Data Transfer Scenarios".

--=20
Jim Barry, MVP for Windows SDK

0
jim1 (8)
10/29/2003 6:13:03 PM
But both approaches have their problems:
1. If you create a dummy folder, don't you need to populate it completely?
Hardly a solution to the problem.
2. The drag and drop handler will only work for Exporer windows, not for
example for Outlook.

"kai" <orp@uni.de> wrote in message
news:bnoddk$12mjta$1@ID-92595.news.uni-berlin.de...
> some time ago, i had a similar problem (drag and drop of large directory
> structures from a namespace to the desktop, and drag and drop is very
> similar to copy and paste)
>
> i know 2 ways to prevent the early directory enumeration:
> 1. like winzip/winrar: creating a real dummyfolder for dropping
> 2. like smartftp: create a drag and drop handler which is acting within
the
> droptarget
>
> (you can use http://www.codeproject.com/clipboard/clipspy.asp to see how
and
> what formats programs copy or drag)
>
>
>
>
>
>
>
>
> > I am using delay rendering to set the clipboard. So when the user
> > right clicks in his Windows explorer or Desktop, my
> > MyOleDataSource::RenderData(...) is invoked, which will cause the
> > 'Paste' menu item to be enabled in his context menu. In
> > MyOleDataSource::RenderData(...), the value of 'cfFormat' member of
> > the parameter 'lpFormatEtc' is g_cfFileGroupDescriptor. At that time
> > the FileGroupDescriptor is created. Suppose that, the user has copied
> > a folder (which contains nested folders and files), What i am supposed
> > to do? I dont have the contents of the folder at hand. So, should i
> > enumerate the folder to get the list of all the files and folders to
> > create the FILEGROUPDESCRIPTOR with all the FILEDESCRIPTORS at that
> > moment itself. As my application is working over a Serial cable
> > connection, this will take a considerable amount of time. So, is there
> > any other way to do this? OR, Is this the only way to do it?
> >
>
>
>


0
info7094 (7)
10/31/2003 9:17:14 AM
You can make sure your GetData is only called when really needed, that's
true.
But you are also supposed to offer all your data in your IEnumFormatETC, 1
CFSTR_FILECONTENTS format for every file.
The enum is called when a drag and drop operation is started.
Would it be save to leave the CFSTR_FILECONTENTS formats out of the enum?

"Jim Barry" <jim@mvps.org> wrote in message
news:utI2XgknDHA.1408@TK2MSFTNGP11.phx.gbl...
"Nathan R." <nathan_rr@yahoo.com> wrote:
> I am using delay rendering to set the clipboard. So when the user
> right clicks in his Windows explorer or Desktop, my
> MyOleDataSource::RenderData(...) is invoked, which will cause the
> 'Paste' menu item to be enabled in his context menu. In
> MyOleDataSource::RenderData(...), the value of 'cfFormat' member of
> the parameter 'lpFormatEtc' is g_cfFileGroupDescriptor. At that time
> the FileGroupDescriptor is created.

The shell is calling GetData because it wants to know whether the FD_LINKUI
flag is set in the (first) file descriptor. You can prevent this by
providing the CFSTR_PREFERREDDROPEFFECT format in your data object (perhaps
set to DROPEFFECT_COPY). This is mentioned in the topics "Shell Clipboard
Formats" and "Handling Shell Data Transfer Scenarios".

--
Jim Barry, MVP for Windows SDK



0
info7094 (7)
10/31/2003 9:20:25 AM
> Would it be save to leave the CFSTR_FILECONTENTS formats out of the enum?


if he starts the drag and drop, he have to enumerate the whole
directorystructure, to provide complete CF_FILEDESCRIPTOR informations

and doing this for every folder-drag-and-drop on a slow medium is not very
userfriendly


0
orp (4)
10/31/2003 3:02:22 PM
> But both approaches have their problems:
> 1. If you create a dummy folder, don't you need to populate it completely?
> Hardly a solution to the problem.

yes, but not at the beginning of the drag and drop, and only if the user
does not cancel the drop






> 2. The drag and drop handler will only work for Exporer windows, not for
> example for Outlook.

nice to know


0
orp (4)
10/31/2003 3:04:10 PM
Henk Devos wrote:
> You can make sure your GetData is only called when really needed, =
that's
> true.
> But you are also supposed to offer all your data in your =
IEnumFormatETC, 1
> CFSTR_FILECONTENTS format for every file.
> The enum is called when a drag and drop operation is started.
> Would it be save to leave the CFSTR_FILECONTENTS formats out of the =
enum?

No. You do need to include CFSTR_FILECONTENTS in the enumerator =
otherwise the shell will not accept the data. However, you don't need to =
(and probably shouldn't) provide a FORMATETC for every file - one will =
suffice. The index can be set to -1, it doesn't really matter because =
the shell ignores it anyway. The whole question of how to handle =
enumeration of indexed formats is rather murky. The OLE documentation =
completely avoids the issue. MFC's COleDataSource does not consider the =
index when managing its cache, meaning that its enumerator cannot =
contain duplicate formats differing only by index. I'd say that's a =
useful precedent :-)

- Jim

0
jim1 (8)
10/31/2003 3:20:12 PM
Reply:

Similar Artilces:

Importing folders
How can I import old folders from a diskette into my new Outlook Express (under "local folders")? Any ideas? Thanks. This newsgroup is for support of Outlook 97, 98, 2000 & 2002 from the Office family for Windows PCs. For Outlook Express (OE) support try posting in one of these newsgroups: microsoft.public.inetexplorer.ie4.outlookexpress for OE 4.x microsoft.public.windows.inetexplorer.ie5.outlookexpress for OE 5.x http://support.microsoft.com/newsgroups/default.aspx?ICP=GSS3&NewsGroup=microsoft.public.windows.inetexplorer.ie5.outlookexpress&SLCID=US&sd=GN&id=f...

Renamed Junk E-Mail Folder
We're using MS Outlook 2003 (Standard) on several of our Dell laptops. After installing Outlook 2003 on a recently reformatted system, I noticed that my user's "Junk E-Mail" folder is named "Correo no deseado" which loosely means "mail not wanted" in Spanish. Since this is a system folder, the user wasn't able to rename it. Neither my manager nor I have any idea about why this folder has been renamed in Spanish or how to correct the problem. This is the only item in Outlook that has a Spanish translation. Too weird! Any ideas? look for l...

Favorite Folders reverts to default list when computer shut-down
I have no problem adding, deleting or moving folders in the Favorite Folders pane. The problem is that they all disappear and revert to the default list everytime my computer is shut down. So I have to keep adding the folders back in Is there a way to keep the shortcut folders in the Favorite Folders pane? ...

Excel formula copied down
Is there a way to copy down a column this formula =F3*A2 and have the A2 stay the same all the way down? The F3 would change on each row, F4, F5 etc. but the A2 would stay 'constant'. Thanks in advance for any help! =F3*A$2 -- Ian -- "Pat" <Pat@discussions.microsoft.com> wrote in message news:73505B29-538A-48C7-8F2F-F6126EF2126B@microsoft.com... > Is there a way to copy down a column this formula =F3*A2 and have the A2 > stay > the same all the way down? The F3 would change on each row, F4, F5 etc. > but > the A2 would stay 'constant'...

simple? pasting simple formula, error on copy
I have some store buying spreadsheets I made up. Very very basic, one of the columns has a total at the bottom or end as you may call it for total $ amount bought. that final number is in c33. c1, c2, c3 etc is a amount from each vendor. I want to have a column telling me the percentage being spent on each, simple enough so I make a column with the following formula =c33/c5. I get a number, change it to percentage and BAM I have exactly what I want. I pasted that formula and pasted it into all the other rows of that certain column, but I keep getting the #div/0 error, cause the new formulas...

Copying values from place to place
Hello community: Is it possible say, to type a value in a textbox in one form (Form A), automatically copy that value, then open another form( Form B) and automatically paste that value into another textbox in Form B? Is this possible? Thank you for your help. -Gabriel M. If you open Form B from Form A you can use the OpenArgs of the OpenForm command line to pass a value to Form B. docmd.OpenForm "FormName",,,,,,Me.TextBoxName On the OnLoad event of the Form B you can use set the value in the text box If not IsNull(Me.OpenArgs) Then Me.TextBox = Me.OpenArgs End If -- ...

I can copy but won't paste
I was able to copy and paste then not sure why but it would only paste the same txt over and over, not allowing new txt copied to be paste. Now I cant paste at all. It will copy but when I click paste it does nothing, help! This could be a poorly designed add-in interfering with copy and paste operations. Did you install something recently? -- Stefan Blom Microsoft Word MVP "Sarlou" <Sarlou@discussions.microsoft.com> wrote in message news:0E5E33F7-2387-4DBC-809E-AA97F930CEF5@microsoft.com... >I was able to copy and paste then not sure why but it would o...

How do I print a list of my E-mail folders?
I need to print a list of my e-mail folders. "AHD23" <AHD23@discussions.microsoft.com> wrote in message news:5BFD12CA-5D55-4376-AF9C-58703042577D@microsoft.com... >I need to print a list of my e-mail folders. I don't believe there's a way to do that, except as a screen shot. -- Brian Tillman [MVP-Outlook] This might be a workaround for you: http://www.vboffice.net/sample.html?mnu=2&smp=12&cmd=showitem&lang=en In example #1, replace the line LoopItems Folder.Items by Debug.Print Folder.Name After running the code,...

Run two copies of Outlook with different profiles
Hello! I'm trying to run two copies of Outlook with different (outlook)profiles at the same time. Normally i can choose the profile with the /profile switch, but if there is already a copy of outlook running, this switch seems to be ignored. Any ideas how to handle this are welcome. Regards, Reinhard "Reinhard" <reinhard.spieker@bkvibro.de> wrote in message news:60a7e218.0311190408.6523100b@posting.google.com... > Hello! > > I'm trying to run two copies of Outlook with different > (outlook)profiles at the same time. > > Normally i can choose the p...

Local folders
G'day, When I go to my Outlook Express, Local Folders The Folder named All forums always comes up opened. It has only just started doing this. When I close it to unopened, ie. + sign it will come up opened, - sign, next time I use Outlook Express. Is there a way to change this? -- chequer When the game is over, the King and the pawn share the same box. This group is for posts concerning MS Office. Outlook Express is not part of Office Please repost giving full details of your Operating system and version of OE. OE newsgroups. news://msnews.microsoft.com/microsoft.pu...

Unable to delete public folder in Exch 5.5
I have 2 exch server 5.5 sp3 under same Org and Site container. 1 of the public folder was created in server b. But server b crashed and left is server a. Even though in the Outlook we can still see the public folder, but in the server a, the public folder does not exist coz it was hosted in server b. I could not delete it and the message says - 'Unable to display the folders.The contents of this public folder is currently unavailable. Either the Microsoft Exch Server computer servicing this public folder is down or the public folder has not been replicated to this site' Anyone ...

What's the function of folder subscription in MS Outlook 2003
Hi, I would like my MS Outlook to show all imap folders in my account, but to run routine updating only on my inbox folder. I would like each of my folders to be updated only when I choose a folder. I checked my folder list and identified a distinction between "all" folders and "subscribed folders". For some reason, all my folders were already subscribed. I've unsubscribed from my folders, but the complete list keeps showing up. Is there anything wrong with my folder list routine, or is my logic erronous? Please suggest a solution? Ran ...

Experts Challenge: MAPI is unable to access Public Folder store items
Goodday to all of you, I have crosspost my messages to several newsgroups. Reason for this is that my previous posts to different newsgroups did not solve the problem. Maybe if I crosspost, there will be an expert that has a solution. Also I am not sure to which group I should post my problem. Maybe this post long-winded, do not see at as material for a novel!!! - I am just trying to explain the exact TERRIBLE situation! ---- ---- ---- ---- I am experiencing a problem with our Public Folder Store. All my users are not be able to access e-mail items in the Public Folders using their Outlo...

Print multiple copies per sheet
I have a pubisher file that is a card with a size of 5 x 6 and is 2 pages. Is it possible to print 2 copies of this file on a letter size page so that there will be 2 double sided copies on the letter size page. I need to laminate these cards so if I could get 2 per page I would just need to cut the page in half. I am using Publisher 2003. Thanks in advance for any help. Best regards, Dee Page setup, Business card, change copies per sheet, Side margin 1.25, top margin ..5, zero gaps, okay out, in the next screen change the measurements to width 6" height 5". The above will...

Need to remove Contact Folder in Outlook 2000
i have a lot of duplicate entries (1000), need to remove the entire folder. Do you want to delete them or do something else with them, have you looked at the duplicate checkers here http://www.slipstick.com/addins/contacts.htm#dupes "Rob Smith" <anonymous@discussions.microsoft.com> wrote in message news:118b501c3f5b4$d44891f0$a301280a@phx.gbl... > i have a lot of duplicate entries (1000), need to remove > the entire folder. > > Need to remove the entire Contact Folder. >-----Original Message----- >Do you want to delete them or do something else with ...

How do I stop Excel from deleting the Window's Clipboard Contents
Note: This is with the Office Clipboard turned OFF! For example, If I write the following in 5 cells in Excel. [Hello ][My ][Name ][Is ][Fred ] Then I Copy (CTRL+C) the Cells: [Is ] and [Fred ] to the Clipboard... Then I press [Esc] (there are a dozen other ways to do this, but, this is the simplest) Now, I go to any cell, anywhere in my workbook, and press Paste (CTRL+V)... No Data... If I open up Notepad... Paste (CTRL+V).... No Data... Excel has *decided* for me, that I want to delete the Window's Clipboard Contents. Although I ha...

Copying specific data from Word to Excel
What I need to do is 1) Extract the monetary amount (always after the 2nd asterisk (*) after the letters BPR. 2) Extract the number (always after the 2nd asterisk (*) after the letters TRN. 3) Place the numbers in the same row on an Excel spreadsheet. 4) Repeat to the end of the document. Sample data BPR*I*925.79*C*ACH*CCP*01*xxxxxxxxxxxx*DA*xxxxxxxxxxxxxxx*xxxxxxxxxxxxxxx**01*xxxxxxxxxxxx*DA*xxxxxxxxxxxxxxx*20091126~TRN*1*999999999*xxxxxxxxxxxx The file I need to extract from is always text. Is this better done from a Word macro or an Excel macro. Or can it be done at al...

net folders #11
I am trying to use a shared calendar between two computers. I have set up everything with net folders based on all of the instructions I could find. The Outlook e-mail is set to Rich Text Format only on both PC's. The folder shares, all of the permissions are as entered, nothing is marked private. I can see the update messages being sent and being received, but nothing updates. What am I doing wrong? Thanks. ...

stange folder after install updates
hello, I've some computers with XP SP3 which after install some updates appear "strange folders". For example there're some folders in c: called: 6ac86d2ad9be93fc0f0ded or 22553c8e848b459d87bc49 I think that these folder are created when the installation on the update fails but my problem is in order to delete them I have to put myself as propietary of the folder manually, Is there any way to delete them automatically? sgr wrote: :: hello, :: :: I've some computers with XP SP3 which after install some updates :: appear "strange folders". F...

Public Folder Question #4
Is there a way to enumerate all folders and posts (including attachment labels where applicable) and redirect to a text file or CSV in a similar fashion that the DOS tree /F /A command would work? Thanks! ...

Can't open folders
Hi all, Whenever I try to open Outlook I get this error. "Unable to open your default email folders. Outlook could not start because a data file to send and receive mail could not be found. To add a data file, such as a personal folder, double-click the mail icon in control panel". And when I go thru the control panel icon it just tells me the file has been deleted. I first tried to repair Outlook with the CD, which didn't work. Then I tried to un-install and re-install, still no good. Is there anything I can do. Please help. TIA! Dan Version of Outlook? Does it star...

Pickup Folder #2
Hey all Basic quistion i am sure. Can someone tell me what info the pick up folder holds in exchange? C:\Program Files\Exchsrvr\Mailroot\vsi 1\PickUp I have a few emails going in there.... ta On 9 Jul 2006 21:24:49 -0700, ksmm80@gmail.com wrote: >Hey all > >Basic quistion i am sure. Can someone tell me what info the pick up >folder holds in exchange? >C:\Program Files\Exchsrvr\Mailroot\vsi 1\PickUp > >I have a few emails going in there.... > >ta That's a directory where you can drop in properly formatted text files and Exchange will deal with them as e...

Copy cell to a new cell
Hi I have a cell value in the format 90TN82C128004K00. I would like to copy the first two digits to another cell i.e. 90 and follow it up with a dummy code 00CPSS00 which will be standard for all values. the new cell should have the following value 9000CPSS00. Is there an automated function that can do this for me. Hi, If you data is in A1 enter in B1: =LEFT(A1,2)&"00CPSS00" Regards, -- AP "mohd21uk" <u20517@uwe> a �crit dans le message de news:5e5292da6a2d1@uwe... > Hi > > I have a cell value in the format 90TN82C128004K00. I would like to copy the ...

where are outlook's folders?
Hi, I made a lot of folder in outlook, and now I want to work with them using a file manager, like Total Commander or Windows explorer, but I can't find them. Where are the folders? This is an XP pro system. Thanks, Avery They are all inside a single file called Outlook.pst. That single file is all a file manager will see. To work with the contents of that file, you will need to use Outlook, AFAIK. "~ Avery Anderson~" wrote: > Hi, > I made a lot of folder in outlook, and now I want to work with them using a > file manager, like Total Commander or Windows exp...

copy data to differences places based on selection
I have a master list of entities name in master name sheets. Let say entity 1 to entitiy 100. If I select Entity 1 to Entity 10, these 1 to 10 entities insert below group1, group2, group 3 in sheet1. It also insert below group4, group5 in sheet2. I don't have preference about how to select the names in master list. Anything like check, or yes is fine to me. I am open to any idea or method. thank you in advance. ...