Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Drag and drop not working on run as administrator
Forum Updated to NodeBB v4.3 + New Features

Drag and drop not working on run as administrator

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 2.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Pradeep Reddy
    wrote on last edited by
    #1

    Hi all .. why drag and drop is not working in qml when we running application as administrator mode .. any solution .. to workaround for it .. one solution to modify registry key value 'EnableLUA' to 0 it is working but i don't want to modify registry .

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #2

      Hi
      If you are talking about windows OS, its due to the fact that
      administrator is run in another security context.
      https://superuser.com/questions/59051/drag-and-drop-file-into-application-under-run-as-administrator

      You try ( while running the app as adim)
      launch cmd (Command Prompt) using Run As Administrator

      Type:
      taskkill /f /im explorer.exe
      start explorer.exe

      Then try to drag to your app and see if that makes any difference.

      This is not isolated to Qt apps. btw.

      1 Reply Last reply
      3
      • xanaduX Offline
        xanaduX Offline
        xanadu
        wrote on last edited by
        #3

        What I'm trying to say is that only QT has this problem! ! !

        call the following function
        // application
        ::ChangeWindowMessageFilter(WM_DROPFILES, MSGFLT_ADD);
        ::ChangeWindowMessageFilter(WM_COPYDATA, MSGFLT_ADD);
        ::ChangeWindowMessageFilter(WM_COPYGLOBALDATA, MSGFLT_ADD);

        // window
        ::DragAcceptFiles(HWND, TRUE);
        ::ChangeWindowMessageFilterEx(HWND, WM_DROPFILES, MSGFLT_ALLOW, nullptr);
        ::ChangeWindowMessageFilterEx(HWND, WM_COPYDATA, MSGFLT_ALLOW, nullptr);
        ::ChangeWindowMessageFilterEx(HWND, WM_COPYGLOBALDATA, MSGFLT_ALLOW, nullptr);
        When I use MFC, Win32, wxWidgets, there is no problem.

        Only QT, called and nothing happens.
        I don't understand, why my use of WinId doesn't work.
        How exactly is it different from the HWND returned by CreateWindow?
        Or, what is QT doing internally that causes these calls to fail.

        1 Reply Last reply
        0
        • xanaduX Offline
          xanaduX Offline
          xanadu
          wrote on last edited by
          #4

          Here is the solution:
          https://github.com/libxcc/QWidget-Admin-Drag

          Obviously, Qt does have some problems under administrator privileges.
          The drag-and-drop method used by Qt can display some icons on the interface, but it cannot respond when the administrator is in the administrator's role.
          So we can only use alternative methods to bypass it and send events ourselves. The disadvantage is that the icon cannot be displayed. Alternatively, we can use Qt's method to add an icon, but I did not deal with it.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved