View Single Post
Old 06-26-2021, 01:57 PM   #17
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 4,937
Default

Quote:
Originally Posted by TonyGlover View Post
I tried like this, but it doesn't work.

Cannot work exactly like windows I suppose, there is a variable m_supports_ddrop which is false, this disable drop actions.

Maybe must call swellSetExtendedStyle to set m_supports_ddrop=true
SetWindowLong calls swellSetExtendedStyle. (WS_EX_ACCEPTFILES can also be put in the resource file, mac_resgen.php supports it.)

This works here:

Code:
WDL_DLGRET DialogProc(HWND handle, UINT msg, WPARAM wParam, LPARAM lParam)
{
  switch(msg) {
  case WM_INITDIALOG:
    SetWindowLong(handle, GWL_EXSTYLE, WS_EX_ACCEPTFILES);
    return 0;
  case WM_DROPFILES: {
    HDROP drop { reinterpret_cast<HDROP>(wParam) };
    unsigned int count { DragQueryFile(drop, -1, nullptr, 0) };
    printf("dropped %d files\n", count);
    DragFinish(drop);
    return 0;
  }
  // ...
  }
}
cfillion is offline   Reply With Quote