From 60db60b70956c3a5ed075aa694008b0382b5224b Mon Sep 17 00:00:00 2001 From: Michael Maltsev <4129781+m417z@users.noreply.github.com> Date: Tue, 3 Oct 2023 23:28:59 +0300 Subject: [PATCH] Add support for dropping files --- MainDlg.cpp | 14 ++++++++++++++ MainDlg.h | 2 ++ windhawk-symbol-helper.rc | 1 + 3 files changed, 17 insertions(+) diff --git a/MainDlg.cpp b/MainDlg.cpp index 0394f44..ca7886c 100644 --- a/MainDlg.cpp +++ b/MainDlg.cpp @@ -178,6 +178,20 @@ void CMainDlg::OnDestroy() { PostQuitMessage(0); } +void CMainDlg::OnDropFiles(HDROP hDropInfo) { + if (DragQueryFile(hDropInfo, 0xFFFFFFFF, NULL, 0) == 1) { + WCHAR fileName[MAX_PATH]; + DragQueryFile(hDropInfo, 0, fileName, MAX_PATH); + + SetDlgItemText(IDC_TARGET_EXECUTABLE, fileName); + } else { + MessageBox(L"Please drop one file at a time", L"Unsupported", + MB_ICONINFORMATION); + } + + DragFinish(hDropInfo); +} + void CMainDlg::OnAppAbout(UINT uNotifyCode, int nID, CWindow wndCtl) { PCWSTR content = L"A tool to get symbols from executables the same way Windhawk mods do " diff --git a/MainDlg.h b/MainDlg.h index d697616..9a8e667 100644 --- a/MainDlg.h +++ b/MainDlg.h @@ -35,6 +35,7 @@ class CMainDlg : public CDialogImpl, CHAIN_MSG_MAP(CDialogResize) MSG_WM_INITDIALOG(OnInitDialog) MSG_WM_DESTROY(OnDestroy) + MSG_WM_DROPFILES(OnDropFiles) COMMAND_ID_HANDLER_EX(ID_APP_ABOUT, OnAppAbout) COMMAND_ID_HANDLER_EX(IDOK, OnOK) COMMAND_ID_HANDLER_EX(IDCANCEL, OnCancel) @@ -47,6 +48,7 @@ class CMainDlg : public CDialogImpl, BOOL OnInitDialog(CWindow wndFocus, LPARAM lInitParam); void OnDestroy(); + void OnDropFiles(HDROP hDropInfo); void OnAppAbout(UINT uNotifyCode, int nID, CWindow wndCtl); void OnOK(UINT uNotifyCode, int nID, CWindow wndCtl); void OnCancel(UINT uNotifyCode, int nID, CWindow wndCtl); diff --git a/windhawk-symbol-helper.rc b/windhawk-symbol-helper.rc index 4800ac5..ea6cdc0 100644 --- a/windhawk-symbol-helper.rc +++ b/windhawk-symbol-helper.rc @@ -61,6 +61,7 @@ IDR_MAINFRAME ICON "res\\windhawk-symbol-helper.ico IDD_MAINDLG DIALOGEX 0, 0, 277, 296 STYLE DS_SETFONT | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME +EXSTYLE WS_EX_ACCEPTFILES CAPTION "Windhawk Symbol Helper" FONT 9, "Segoe UI", 0, 0, 0x0 BEGIN