drag/drop files with different name

I have a CListCtrl which contains a list of files from a directory
tree. I have it so that you can drag-and-drop files from the list into
an Explorer Window, and files get copied just fine.

What I would like to do is rename the destination file. So if
F:\foo\bar.txt is dragged on to the Desktop, I'd figure out that it
should be called qux.txt instead, and that's what should appear on the
Desktop.

Is there a way of munging my data source object? Should I try to find
the drop destination instead, and try to rename it there?

Any help is appreciated.

Thanks,
Gopi.

-- 
Gopi Sundaram

0
gopalan (2)
11/16/2005 6:50:52 AM
vc.mfc 33608 articles. 0 followers. Follow

3 Replies
507 Views

Similar Articles

[PageSpeed] 1

If you are dragging it from your application you can change the name of it 
when you create the drag object.  If you are dragging it onto your 
application you can change the name there (in your application) when it is 
dropped.

So, you'll have to do the figuring out while the drag is being created.

Tom

"Gopi Sundaram" <gopalan@cs.sc.edu> wrote in message 
news:1132123852.682809.306660@g49g2000cwa.googlegroups.com...
>I have a CListCtrl which contains a list of files from a directory
> tree. I have it so that you can drag-and-drop files from the list into
> an Explorer Window, and files get copied just fine.
>
> What I would like to do is rename the destination file. So if
> F:\foo\bar.txt is dragged on to the Desktop, I'd figure out that it
> should be called qux.txt instead, and that's what should appear on the
> Desktop.
>
> Is there a way of munging my data source object? Should I try to find
> the drop destination instead, and try to rename it there?
>
> Any help is appreciated.
>
> Thanks,
> Gopi.
>
> -- 
> Gopi Sundaram
> 


0
tserface (3860)
11/16/2005 2:44:31 PM
Okay, I'm not much of a Windows programmer. My drag-drop code was
pretty much cargo-cult from here:

    <http://www.codeproject.com/shell/explorerdragdrop.asp>

My app is just a data source, not target.

I can't rename the files before the drag, and revert them after,
because the source filesystem is read-only.

As far as I can tell, I'm only populating the DATASOURCE struct with
the source filenames. How would I tell it a new name? My guess is, I
can't just use the new name in there, because the target won't know
what to pick up.

--
Gopi Sundaram

Tom Serface wrote:
> If you are dragging it from your application you can change the name of it
> when you create the drag object.  If you are dragging it onto your
> application you can change the name there (in your application) when it is
> dropped.
>
> So, you'll have to do the figuring out while the drag is being created.
>
> Tom
>
> "Gopi Sundaram" <gopalan@cs.sc.edu> wrote in message
> news:1132123852.682809.306660@g49g2000cwa.googlegroups.com...
> >I have a CListCtrl which contains a list of files from a directory
> > tree. I have it so that you can drag-and-drop files from the list into
> > an Explorer Window, and files get copied just fine.
> >
> > What I would like to do is rename the destination file. So if
> > F:\foo\bar.txt is dragged on to the Desktop, I'd figure out that it
> > should be called qux.txt instead, and that's what should appear on the
> > Desktop.
> >
> > Is there a way of munging my data source object? Should I try to find
> > the drop destination instead, and try to rename it there?
> >
> > Any help is appreciated.
> >
> > Thanks,
> > Gopi.
> >
> > -- 
> > Gopi Sundaram
> >

0
gopalan (2)
11/16/2005 4:56:44 PM
Yeah that's true.  From what I know (which isn't all that much compared with 
universe and all) you would have:

1. Write some code to hook into when you drag it and rename it there by 
popping up a dialog. You would have to put the right name in the data source 
and rename the actual file before finishing the drag.
2. Hook into the Explorer (perhaps a namespace extension) to rename it 
there.
3. Live with the original name :o)

Tom

"Gopi Sundaram" <gopalan@cs.sc.edu> wrote in message 
news:1132160204.059627.4170@o13g2000cwo.googlegroups.com...
> Okay, I'm not much of a Windows programmer. My drag-drop code was
> pretty much cargo-cult from here:
>
>    <http://www.codeproject.com/shell/explorerdragdrop.asp>
>
> My app is just a data source, not target.
>
> I can't rename the files before the drag, and revert them after,
> because the source filesystem is read-only.
>
> As far as I can tell, I'm only populating the DATASOURCE struct with
> the source filenames. How would I tell it a new name? My guess is, I
> can't just use the new name in there, because the target won't know
> what to pick up.


0
tserface (3860)
11/16/2005 5:09:49 PM
Reply:

Similar Artilces:

Drag and drop with CRichEditCtrl
I have an application that makes heavy use of the rich edit control. One of the things I needed to do was to customize text when it is pasted or dropped onto the rich edit control. This wasn't too hard to do: I have an object implementing IRichEditOleCallback attached to the rich edit, and in the QueryAcceptData() method I modify the data as needed before adding it to the control. My problem comes with drag and drop, specifically with the "move" drop operation. Following the MSDN documentation, my QueryAcceptData() method returns S_FALSE to indicate that it's processed the d...

outcmd file
We have several computers that continually have a corrupt outcmd.dat file. We have renamed these files and allowed outlook to rebuild the file as per Knowledge Base Article 241390, however they continue to become corrupt. Is there a permanent fix? ...

Message re: pdf file
I'm utilizing Outlook Express and when attempting to open certain attachments (pdf files) the message reads: "Cannot open Outlook. Command line arguement not valid. Verify the switch you are using" Can someone advise how to correct? Thanks! ...

Changing background color in multiple files?
I want to change the background color in hundreds of .doc files. To do so one at a time would take hours. Is there any way of doing this for all the files at once? You could modify the method in the article "Find & ReplaceAll on a batch of documents in the same folder" at: http://www.word.mvps.org/FAQs/MacrosVBA/BatchFR.htm -- Hope this helps, Doug Robbins - Word MVP Please reply only to the newsgroups unless you wish to obtain my services on a paid professional basis. "MICROSOFT" <blah@blah.blah> wrote in message news:op.u6fsyvsq...

Drop Down list with colours
Hi, Is there any way in Excel to create a drop down list which contains colours? For example to show RAG status (i.e. Red Amber Green). At the moment I can only show text in the drop down list. Would anyone know a way of working around this? Thanks. Thanks Roger, and Chip, for replying. I was playing around with it and found that I could conditionally format the cell depending on the text selected - so if I choose "RED" it goes red. It's just about enough to work for what I intend to use it for, but I'll experiment with your suggestion in case I need to develop thi...

MS Works Database (.wdb) File Import
I just want to confirm that there is no easy way to migrate data from an existing MS Works database file (.wdb) into Access, even via an intermediate data format? Done a number of searches and come up with nothing. Read the MS KB article about exporting from Works to dBase, but if you don't have Works ...... Thanks! Don Hi Don, The best way is to have Works. If you don't, there's a database at http://www.j.nurick.dial.pipex.com/Code/index.htm (near the bottom of the page) with sample code that extracts data from some? most? Works databases and puts it in an Access table...

Fixed Assets
I'm testing the fixed assets module in Great Plains. I want to switch from FAS to GP as soon as possible. The issue I am running into is that I have a fiscal year end of 6/30 for the books, but the tax year remains a calendar year. GP Fixed Assets doesn't seem to allow different fiscal years for each set of books. Will GP be updated with this feature soon? I would think that other companies have run into this issue, as well. If there is a way around this problem or "opportunity", please reply with that information. That would help a lot. Thanks. The Fixed Asse...

Encrypted files
As result of a crash, and reformatting hard drive, I am unable to load or open Excell encrypted files from my back, any suggestions please Hi Tom what is the error message you receive?. also what do you mean with 'encrypted' Note: You also have Excel re-installed on your harddisk? -- Regards Frank Kabel Frankfurt, Germany tom wrote: > As result of a crash, and reformatting hard drive, I am > unable to load or open Excell encrypted files from my > back, any suggestions please ...

Publisher won't open file
I am having serious issues with Publisher XP/2002 Creating a simple 2 page file, after closing Publisher refuses to open the file at all, to the point of crashing the application. Deciding not to create the file for a 3rd time and loosing it, i decided that after every change i would save a new copy of the file. All I have done is just added images when it stops working. it doesn't even have to be the same image. at any random point it will just stop working. Help please! Do you have the service packs? Description of Microsoft Office XP Service Pack 3 http://support.microsoft.com/kb/83...

OPENFILENAME w/ wierd file history popup?
We are using a standard OPENFILENAME to allow a user to choose a file to open in our MFC app. If the user clicks on the file type popup, he sees our list of file types that he can open, which is as we expect. However, if he clicks on the popup for the filename, he sees a list of past files. First off, we are not sure where this list comes from? Second, the list has full pathnames of all the files, but the user only sees the first xx characters (about 50 maybe?), which means he see a useless list -- the files we direct the user to are typically inside 'documents and settings' whic...

Drag n' Drop emails to a Java application
Hi, We are developing a Java application where we want to import information received in e-mails. The email client are Outlook 2003 (at least for now). The best way would be to be able to drag the e-mail to the Java app and then access/parse the e-mail in the Java app. I have searched the web but can not find anything useful. Do I have to use COM and/or OLE for doing such operations? Please help me!! Best Regards Joacim ...

Mailbox name does not resolve?
I have added all users in the company to the exchange server with no issue except one user. I am using Exchange 2003 and outlook 2003 on all desktops. In outlook I enter the server name and mail box name in both full name and alias form and neither will resolve. The machine connects through file sharing to the exchange box with no problem. I have deleted the box and readded it and it still does not work. David Lewis <*@*.*> wrote in news:e7rig0he6c4h4t16jn3v6bjp1pt673hnhn@4ax.com: > I have added all users in the company to the exchange server with no > issue except one user. I...

Importing .txt file
I'm trying to import an .txt file into excel 2000 which has to many columns, is there anyway I can increase the number of columns. With Excel 97 it would show me the data for the columns upto its maximum, but excel 2000 just crashes Hi no way to increase the number of columns in Excel -- Regards Frank Kabel Frankfurt, Germany SimonT wrote: > I'm trying to import an .txt file into excel 2000 which > has to many columns, is there anyway I can increase the > number of columns. With Excel 97 it would show me the data > for the columns upto its maximum, but excel 2000...

Drop Downs and lookups from other sheets
I have a workbook where the front sheet is a display page and the three sheets behind are reserved for data tables. What I want to do is have one cell in the front page which is a drop down and selects names from one of the tables on the other sheets. From there I can use Vlookup to populate the info from the tables on the front page based on that name. The problem is I can't seem to get this list of names from another sheet. Every time I try, I get an error. How would I do this? thanks! Hi,. first insert a name for your list in the other sheet, go to insert, name, ...

Auto insert tab name in cell
Is there a function to use the Tabname or sheetname in a cell? Norm, Use the following formula: =MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,99) The file must have been saved for this to work. "Norm" <aka_norm@charter.net> wrote in message news:vvu5amfnisfacf@corp.supernews.com... > Is there a function to use the Tabname or sheetname in a cell? > Thx chip Chip Pearson wrote: > Norm, > > Use the following formula: > > =MID(CELL("filename",A1),FIND("]",CELL("filename",A1))...

Possible to convert xls files to qif files ?
I'd like to export excel files to quicken, can this be done? Does anyone know of a macro or shareware program that can do this? Can excel files also be converted to .txf files? thanks ..txf = tax exchange files ...

how do I change the lerrers in the header of each cell to a name?
I am trying to create a spreadsheet that names or at least name the firstcell so that it will be present even when I scroll down . is this possible? I think you are talking about Freeze Panes. Select cell A2, assuming you have headers or whatever in A1, then click on Windows - Freeze Panes. Now scroll down and you will see that row 1 stays visible at all times. Is this what you want? HTH Otto "robush3" <robush3@discussions.microsoft.com> wrote in message news:8664E670-87FF-486A-8E8A-4B51002B5ACF@microsoft.com... >I am trying to create a spreadsheet that names o...

Drop-down data not appearing in exported XML
I'm exporting data as XML from an Excel spreadsheet. Cells with plain text in them work fine, but cells with a selection from a drop-down list do not. The XML file shows everything is there, except data from cells with drop-down selections. No error message generated, just no trace of the data. Any suggestions? thanks kc Fixed the problem. Found out that the drop-downs were actually objects placed on top of the cell, the options were not coded into the cells themselves. "Kristi" <kristi@NOSPAMinscriber.com> wrote in message news:MaCdnWD2xtF6CtveRVn-qQ@golden.net... > ...

Find a Contact doesn't pick up company names
Hi, Outlook 2002, SP3. If I search for a company by typing its name into the 'Find a Contact' bar it isn't found unless the contact entry has something entered for a person's name also. E.g. Woolworths, filed as Woolworths, is not found, but Woolworths filed, as John Smith but with Woolworths in the Company field is found. Is there any way to set Outlook to find companies on their own through the 'Find a Contact' bar (I know it can be done via the 'Look for' bar or advanced search). Many thanks, Jez My experience is that Outlook searches the Company...

matlab mex-files with mfc
Hi, I wanted to implement a matlab mex-File with the following command line: mex ParseLine.cpp libc.lib. I linked 'libc.lib' due to the MFC standard objects like CString etc. Compilation and linking was ok, but calling the function in matlab I get the following error message: Unable to load ParseLine.dll Illegal memory access (Unzulaessiger Zugriff auf einen Speicherbereich) Has anybody an idea? thanks in advance, steffen A wrong path is not the reason. The working directory of matlab is the same one where the dll is. If I don't use objects or classes which nee...

Drop down list #8
I created a drop down list using the data, validation menu. It works well. However, I only have two items in the list and I am wondering if there is a better way to alternate between them. With the drop down list it takes a couple of clicks. First you select the cell, then you click to drop down the list, then you highlight the item, then you click on it. Is there a way to select the alternate item with fewer clicks? Don, You need only click the cell, click the dropdown button, then click the desired item. Three clicks. This event-fired sub will alternate between "Choice a&qu...

dragging array UDFs
Hi I built an array function and it is working well. However when I dra it to other cel regions I got the message "VALUE". The exact formul and the code is below. Thanks for any help. Eduardo Exact formula: {=samLMR(B5:B20;0;0)} Code: x is a sorted array. Public Function samLMR(x As Variant, Optional a As Double = 0# Optional b As Double = 0#) As Variant Dim xmom() As Double Dim xm() As Double Dim sum(8) As Double Dim R As Integer Dim C As Integer Dim ReturnColumn As Boolean R = Selection.Rows.Count C = Selection.Columns.Count n = x.Count n = n - nfails If R < C Then nm...

How do I add header information to an Excel file? In other words,.
how do I name the columns? Alvin You cannot rename the columns as such, but if you put you titles in row 1 for example, you can always show these on screen by clicking on B2" and invoking Window>Freeze Panes. You can make them appear on every page of a printout by going to File>Page setup...>Sheet>Rows to repeat at top and entering 1:1 -- HTH Nick Hodge Microsoft MVP - Excel Southampton, England nick_hodgeTAKETHISOUT@zen.co.uk.ANDTHIS "Alvin M." <Alvin M.@discussions.microsoft.com> wrote in message news:1238EA89-E323-4D3D-A851-AA4DB3E16CE0@microsoft....

Getting machine name when connecting to db
We have an application in Access 2000, front end/back end design,10-12 users. I want to save the dates and times they enter and exitfrom the app from their workstations in a table in the back end.How do I get the name of their workstation to save to that table? Theworkstations have names like "sales1", "sales2", "Reception", etc.Paul Fenton Add error handling as required. Place in a module and call functionwhen needed.'example by Donavon Kuhn (Donavon.Kuhn@Nextel.com)Private Const MAX_COMPUTERNAME_LENGTH As Long = 31Private Declare Function GetComputerName L...

My Drag Image Flickers
Hi guys, My drag image flickers, I understand the cause of this (I think) but I don't know how to fix it. I use this to auto-scroll during a drag and drop: // in OnTimer() m_pDragImage->DragShowNolock(FALSE); SendMessage(WM_VSCROLL,MAKEWPARAM(SB_LINEDOWN,0),NULL); m_pDragImage->DragShowNolock(TRUE); So since I'm hiding it, then showing it again, it flickers. Can I fix this ? Thanks, Robert A. ...