| 526 | |
| 527 | |
| 528 | void CMatchToolDlg::OnDropFiles (HDROP hDropInfo) |
| 529 | { |
| 530 | // TODO: 在此加入您的訊息處理常式程式碼和 (或) 呼叫預設值 |
| 531 | int iCount_droppedfile = DragQueryFile (hDropInfo, 0xFFFFFFFF, NULL, 0); |
| 532 | CRect rectSrc, rectDst; |
| 533 | ::GetWindowRect (GetDlgItem (IDC_STATIC_SRC_VIEW)->m_hWnd, rectSrc); |
| 534 | ::GetWindowRect (GetDlgItem (IDC_STATIC_DST_VIEW)->m_hWnd, rectDst); |
| 535 | ScreenToClient (rectSrc); |
| 536 | ScreenToClient (rectDst); |
| 537 | POINT pointCursor; |
| 538 | GetCursorPos (&pointCursor); |
| 539 | ScreenToClient (&pointCursor); |
| 540 | CPoint ptCursor (pointCursor); |
| 541 | |
| 542 | for (int i = 0; i < iCount_droppedfile; i++) |
| 543 | { |
| 544 | wchar_t filepath[MAX_PATH] = { 0 }; |
| 545 | if (DragQueryFile (hDropInfo, i, filepath, MAX_PATH) > 0) |
| 546 | { |
| 547 | CString cstrFile = filepath; |
| 548 | |
| 549 | _TCHAR szPath[MAX_PATH]; |
| 550 | _TCHAR szDrv[_MAX_DRIVE] = _T ("");//C: or D: |
| 551 | _TCHAR szDir[_MAX_DIR] = _T ("");//資料夾 |
| 552 | _TCHAR szName[_MAX_FNAME] = _T ("");//檔名 |
| 553 | _TCHAR szExt[_MAX_EXT] = _T ("");//副檔名 |
| 554 | //swprintf (szPath, _MAX_PATH, L"%hs", cstrFile); |
| 555 | _tsplitpath_s (filepath, szDrv, _MAX_DRIVE, szDir, _MAX_DIR, szName, _MAX_FNAME, szExt, _MAX_EXT); |
| 556 | _stprintf_s (szPath, MAX_PATH, _T ("%s%s%s"), szDrv, szDir, szName); |
| 557 | CString cstrFileName (szPath); |
| 558 | if (rectSrc.PtInRect (pointCursor)) |
| 559 | { |
| 560 | m_matSrc = Read_TCHAR (cstrFile.GetBuffer ()); |
| 561 | cstrFile.ReleaseBuffer (); |
| 562 | LoadSrc (); |
| 563 | } |
| 564 | else if (rectDst.PtInRect (pointCursor)) |
| 565 | { |
| 566 | m_matDst = Read_TCHAR (cstrFile.GetBuffer ()); |
| 567 | cstrFile.ReleaseBuffer (); |
| 568 | LoadDst (); |
| 569 | } |
| 570 | } |
| 571 | } |
| 572 | CDialogEx::OnDropFiles (hDropInfo); |
| 573 | } |
| 574 | |
| 575 | |
| 576 | void CMatchToolDlg::OnMouseMove (UINT nFlags, CPoint point) |
nothing calls this directly
no test coverage detected