none
Windows 7 drag file not working

    Question

  • After scratching my head for a few hours trying to understand why my MFC app won't let me drag files into it's main window, I've discovered that its a Windows 7 issue. I tried a third party app and it exhibits the same behavior. Both work fine on Vista.

    It appears that a file association must be in place first to allow this because I once I drag the file onto the app icon in the taskbar to associate it, I can then drag/drop the same file into the app window successfully. However, this doesn't seem to work while running the app in the debugger. 

    So, I have three questions: 1) Why the difference when debugging? 2) How do I get around this while debugging? 3) If only files that have app associations created for them in the registry are allowed, how would one write a file manager app where any file type could be dragged in?
    • Edited by snortblt Tuesday, August 11, 2009 4:33 PM
    Tuesday, August 11, 2009 4:31 PM

Answers

  • Good morning snortblt

     

    I performed a test using the below MFC Drag and Drop sample in Windows 7. I’m able to drag and drop files to Views, even though the target file extension is not associated with the current application.

     

    How Do I: Implement Drag and Drop in MFC?

    http://msdn.microsoft.com/en-us/visualc/bb905826.aspx

     

    Would you please try the sample on your side and compare the codes for differences? If the sample is not useful to you, could you please tell me the detailed repro steps so that I can see the problem locally?

     

    A possible reason for the not being able to drag & drop files to the application could be UAC integrity level (IL). With UAC enabled in Vista or Win7, drag and drop is not allowed to happen from low IL process to high IL process by default. Please check whether your application is elevated (run as admin) when the problem happens.

     

    Regards,

    Jialiang Ge

    MSDN Subscriber Support in Forum

    If you have any feedback of our support, please contact msdnmg@microsoft.com.

    Your Feedback, Our Passion :-)


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Wednesday, August 12, 2009 8:33 AM
    Moderator

All replies

  • Good morning snortblt

     

    I performed a test using the below MFC Drag and Drop sample in Windows 7. I’m able to drag and drop files to Views, even though the target file extension is not associated with the current application.

     

    How Do I: Implement Drag and Drop in MFC?

    http://msdn.microsoft.com/en-us/visualc/bb905826.aspx

     

    Would you please try the sample on your side and compare the codes for differences? If the sample is not useful to you, could you please tell me the detailed repro steps so that I can see the problem locally?

     

    A possible reason for the not being able to drag & drop files to the application could be UAC integrity level (IL). With UAC enabled in Vista or Win7, drag and drop is not allowed to happen from low IL process to high IL process by default. Please check whether your application is elevated (run as admin) when the problem happens.

     

    Regards,

    Jialiang Ge

    MSDN Subscriber Support in Forum

    If you have any feedback of our support, please contact msdnmg@microsoft.com.

    Your Feedback, Our Passion :-)


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Wednesday, August 12, 2009 8:33 AM
    Moderator
  • Hello snortblt

    How are you? I'm writing to check the status of this issue on your side. May I know whether my analysis is helpful to you or not?

    Regards,
    Jialiang Ge
    MSDN Subscriber Support in Forum
    If you have any feedback of our support, please contact msdnmg@microsoft.com.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Tuesday, August 25, 2009 7:50 AM
    Moderator