Solved

Setting acceptable file drops to an application

Posted on 1997-10-28
6
215 Views
Last Modified: 2013-11-20
I want to set my application to accept only files having a particular extension by drag and drop. I have to use CWnd's 'DragAcceptFiles'in the InitInstance. Prior to calling this function, I have to set this filter that my application would reject files of any other extension, except the one I specified. I want this functionality to be in the application class, and not to be handled by various views. how to go about doing this?
Thanks.
0
Comment
Question by:pcasxd0
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 50 total points
ID: 1308988
By calling DragAcceptFiles(), you are telling Windows that the window is a drop target. It does not tell Windows which files are acceptable and which aren't. In fact, there isn't an easy way to do this. If the UI feedback isn't important, you can skip over the files you don't want.
0
 

Author Comment

by:pcasxd0
ID: 1308989
How can I 'skip'over the files I don't want?
0
 
LVL 15

Expert Comment

by:Tommy Hui
ID: 1308990
When you are processing the WM_DROPFILES message, it is up to you to go through all the files by using DragQueryFile and DragFinish(). The DragQueryFile returns the filename. If the filename is not what you want, then don't do anything with it.
0
Percona Live Europe 2017 | Sep 25 - 27, 2017

The Percona Live Open Source Database Conference Europe 2017 is the premier event for the diverse and active European open source database community, as well as businesses that develop and use open source database software.

 

Author Comment

by:pcasxd0
ID: 1308991
One last doubt... can the application class handle the WM-DROPFILES command, or do I have to write an independent function like it? (I want to handle this in the app class, rather than the view classes)
Thanks..
0
 
LVL 15

Expert Comment

by:Tommy Hui
ID: 1308992
I don't think the application class can handle it. Although you can simulate that by having the view class call a member function in the application.
0
 

Author Comment

by:pcasxd0
ID: 1308993
Thank you for the convincing answer. I'll do that.
0

Featured Post

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

622 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