Solved

Simple Listview Filemanager

Posted on 2002-06-13
11
291 Views
Last Modified: 2010-04-02
Hi,
I'm working on a project which requires files to be copied from one directory to another (only 2 key directories), and then to edit an ini file to reflect the change. The way I think would be the best is to make a simple dialog app with two listviews. The first displays the contents of the first directory and the other displays the content of the second directory. I then need to allow a user of the program to drag a list view item (file) from one list view to the other. When this is done i want the file to be copied and the ini file to be updated. I understand how to update the ini file. What i need to know how to make 2 listviews display the contents of a directory and allow files to be dragged across. If that operation also called a function, it would be great because i could put the ini file code in it.

I looked at MSDN but i can't find anything very on topic. Plus, i've been having trouble downloading MSDN examples. Can someone show me the key things to know about this, or point me in the direction of a sample application.
0
Comment
Question by:qqqqqqqqq
  • 6
  • 5
11 Comments
 
LVL 30

Expert Comment

by:Axter
ID: 7077114
Is this an MFC project?
0
 
LVL 30

Expert Comment

by:Axter
ID: 7077118
If this is for an MFC project, take a look at the following link:
http://www.codeguru.com/listview/filedroplistctrl.shtml

0
 
LVL 30

Expert Comment

by:Axter
ID: 7077146
The first link I posted is a drag and drop project.
The following link has several file project.
http://www.codeguru.com/files/index.shtml
0
 

Author Comment

by:qqqqqqqqq
ID: 7077354
yea this is MFC. I'm looking at the links now.
0
 

Author Comment

by:qqqqqqqqq
ID: 7077358
will the drag and drop project let me drag and drop from one list view to another, as opposed to from explorer to a list view?
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:qqqqqqqqq
ID: 7082926
hello?
0
 
LVL 30

Accepted Solution

by:
Axter earned 200 total points
ID: 7083838
>>will the drag and drop project let me drag and drop from
>>one list view to another, as opposed to from
>>explorer to a list view?
I'm not sure if that project will drag and drop between between controls, but the following project will drag and drop between controls.
http://www.codeguru.com/misc/dragdropcontrols.shtml

Another project that will drag and drop between derived windows:
http://www.codeguru.com/misc/DandD.shtml
0
 

Author Comment

by:qqqqqqqqq
ID: 7094028
sorry for the delay. The DandD example is perfect!! Is there a way to make it work with a CListCtrl instead of a CListBox? I tried just deriving from ListCtrl but i got this error:

error C2248: 'messageMap' : cannot access protected member declared in class 'CListCtrl'
        c:\program files\microsoft visual studio\vc98\mfc\include\afxcmn.h(294) : see declaration of 'messageMap'

Also, is it possible to adjust it so that when i drag and drop, it copies the entry instead of moving it? I looked over the guidelines on the webpage but couldn't find any instruction as to doing this.
0
 

Author Comment

by:qqqqqqqqq
ID: 7094041
nevermind on the copy insted of move part. I read the directions backwards. I just removed the override of the CompleteMove function and it works.
0
 
LVL 30

Expert Comment

by:Axter
ID: 7094049
>>Also, is it possible to adjust it so that when i drag >>and drop, it copies the entry instead of moving it?
This is part of the standard Windows behavior, which most windows users would expect.
If the user wants to copy it, the standard method is to hold the shift key, while dragging.
This method should work in your application as well.

>>Is there a way to make it work with a CListCtrl
>>instead of a CListBox? I tried just deriving from
>>ListCtrl but i got this error:
I'm sorry, but I haven't done done MFC code in a while.
You might want to try asking in the MFC topic area:

http://www.experts-exchange.com/jsp/qList.jsp?ta=mfc
0
 

Author Comment

by:qqqqqqqqq
ID: 7094113
ok, i'll do that. i'm looking over the example right now, just making sure i didn't miss anything. i'll close this Q out in a few mins. I am just making copy standard because this program will be copying critical files. These files must absolutly not be moved. I just don't want a possibility of error.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now