Solved

Setting acceptable file drops to an application

Posted on 1997-10-28
6
155 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
  • 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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
sameEnds challenge 3 107
bigDiff challenge 17 75
sum67 challenge 35 89
withoutTen challenge 14 88
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

760 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

20 Experts available now in Live!

Get 1:1 Help Now