Skip to content

Commit

Permalink
Add support for dropping files
Browse files Browse the repository at this point in the history
  • Loading branch information
m417z committed Oct 3, 2023
1 parent a204553 commit 60db60b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
14 changes: 14 additions & 0 deletions MainDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 "
Expand Down
2 changes: 2 additions & 0 deletions MainDlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class CMainDlg : public CDialogImpl<CMainDlg>,
CHAIN_MSG_MAP(CDialogResize<CMainDlg>)
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)
Expand All @@ -47,6 +48,7 @@ class CMainDlg : public CDialogImpl<CMainDlg>,

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);
Expand Down
1 change: 1 addition & 0 deletions windhawk-symbol-helper.rc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 60db60b

Please sign in to comment.