add_pch(consrv consrv/consrv.h CONSRV_SOURCE)
#add_object_library(consrv ${CONSRV_SOURCE})
list(APPEND CONSRV_IMPORT_LIBS psapi)
-list(APPEND CONSRV_DELAY_IMPORT_LIBS ole32)
+list(APPEND CONSRV_DELAY_IMPORT_LIBS shell32 ole32)
list(APPEND CONSRV_TARGET_LINK_LIBS concfg uuid)
set_module_type(consrv module UNICODE)
* Johannes Anderwald
* Jeffrey Morlan
* Hermes Belusca-Maito (hermes.belusca@sfr.fr)
+ * Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com)
*/
/* INCLUDES *******************************************************************/
#include <consrv.h>
#include <intrin.h>
#include <windowsx.h>
+#include <shellapi.h>
#define NDEBUG
#include <debug.h>
PGUI_CONSOLE_DATA GuiData = (PGUI_CONSOLE_DATA)Create->lpCreateParams;
PCONSRV_CONSOLE Console;
- if (NULL == GuiData)
+ if (GuiData == NULL)
{
DPRINT1("GuiConsoleNcCreate: No GUI data\n");
return FALSE;
DPRINT("OnNcCreate - setting start event\n");
NtSetEvent(GuiData->hGuiInitEvent, NULL);
+ /* We accept dropped files */
+ DragAcceptFiles(GuiData->hWindow, TRUE);
+
return (BOOL)DefWindowProcW(GuiData->hWindow, WM_NCCREATE, 0, (LPARAM)Create);
}
GuiData->GuiInfo.WindowOrigin.y = rcWnd.top;
}
+static VOID
+OnDropFiles(PCONSRV_CONSOLE Console, HDROP hDrop)
+{
+ LPWSTR pszPath;
+ WCHAR szPath[MAX_PATH + 2];
+
+ szPath[0] = L'"';
+
+ DragQueryFileW(hDrop, 0, &szPath[1], ARRAYSIZE(szPath) - 1);
+ DragFinish(hDrop);
+
+ if (wcschr(&szPath[1], L' ') != NULL)
+ {
+ StringCchCatW(szPath, ARRAYSIZE(szPath), L"\"");
+ pszPath = szPath;
+ }
+ else
+ {
+ pszPath = &szPath[1];
+ }
+
+ PasteText(Console, pszPath, wcslen(pszPath));
+}
/*
// HACK: This functionality is standard for general scrollbars. Don't add it by hand.
break;
}
+ case WM_DROPFILES:
+ OnDropFiles(Console, (HDROP)wParam);
+ break;
+
case WM_SETFOCUS:
case WM_KILLFOCUS:
OnFocus(GuiData, (msg == WM_SETFOCUS));