src/video/windows/SDL_windowsevents.c
changeset 6523 62d0193a7a02
parent 6430 48d519500f7e
child 6682 a0cbe4e5a07a
     1.1 --- a/src/video/windows/SDL_windowsevents.c	Sun Sep 30 01:08:48 2012 -0700
     1.2 +++ b/src/video/windows/SDL_windowsevents.c	Sun Sep 30 11:10:17 2012 -0700
     1.3 @@ -29,6 +29,10 @@
     1.4  #include "../../events/SDL_events_c.h"
     1.5  #include "../../events/SDL_touch_c.h"
     1.6  
     1.7 +/* Dropfile support */
     1.8 +#include <shellapi.h>
     1.9 +
    1.10 +
    1.11  
    1.12  
    1.13  /*#define WMMSG_DEBUG*/
    1.14 @@ -619,7 +623,29 @@
    1.15  			return 0;
    1.16  		}
    1.17  		break;
    1.18 -	}
    1.19 +
    1.20 +    case WM_DROPFILES:
    1.21 +        {
    1.22 +            UINT i;
    1.23 +            HDROP drop = (HDROP) wParam;
    1.24 +            UINT count = DragQueryFile(drop, 0xFFFFFFFF, NULL, 0);
    1.25 +            for (i = 0; i < count; ++i) {
    1.26 +                UINT size = DragQueryFile(drop, i, NULL, 0) + 1;
    1.27 +                LPTSTR buffer = SDL_stack_alloc(TCHAR, size);
    1.28 +                if (buffer) {
    1.29 +                    if (DragQueryFile(drop, i, buffer, size)) {
    1.30 +                        char *file = WIN_StringToUTF8(buffer);
    1.31 +                        SDL_SendDropFile(file);
    1.32 +                        SDL_free(file);
    1.33 +                    }
    1.34 +                    SDL_stack_free(buffer);
    1.35 +                }
    1.36 +            }
    1.37 +            DragFinish(drop);
    1.38 +            return 0;
    1.39 +        }
    1.40 +        break;
    1.41 +    }
    1.42  
    1.43      /* If there's a window proc, assume it's going to handle messages */
    1.44      if (data->wndproc) {