Hi guys,
i'm new here!
The following QM code is from the forum and I need some help:
There is a editorbox in the dialog box, I can drag and drop multiple files into the editing box
#1. Delete lines 27 and 28, it still works. In what case must it be added?
#2. How do I prevent adding duplicate file paths? (Do not display duplicate file paths)
#3. How to control code execution using the Ctrl key:
A. Drag and drop directly: Execute line 30
B. If the Ctrl key is held down during drag and drop, execute Line 32
#4. How to use Ctrl+a hotkey to select all text? here is the C++ implementation code, how to convert it into QM code?
Solving these problems can help me better understand QM programming, Thanks for any help!
Aaron
Macro Macro2
i'm new here!
The following QM code is from the forum and I need some help:
There is a editorbox in the dialog box, I can drag and drop multiple files into the editing box
#1. Delete lines 27 and 28, it still works. In what case must it be added?
#2. How do I prevent adding duplicate file paths? (Do not display duplicate file paths)
#3. How to control code execution using the Ctrl key:
A. Drag and drop directly: Execute line 30
B. If the Ctrl key is held down during drag and drop, execute Line 32
#4. How to use Ctrl+a hotkey to select all text? here is the C++ implementation code, how to convert it into QM code?
BOOL CMFCApplication1Dlg::PreTranslateMessage(MSG * pMsg)
{
,if (pMsg->message == WM_KEYDOWN)
,{
,,BOOL b = GetKeyState(VK_CONTROL) & 0x80;
,,CWnd *pActiveWnd = GetFocus();
,,DWORD nWndID = 0;
,,if (pActiveWnd)
,,{
,,,nWndID = pActiveWnd->GetDlgCtrlID();
,,}
,,if (b && (pMsg->wParam == 'a' || pMsg->wParam == 'A'))
,,{
,,,SendDlgItemMessage(nWndID, EM_SETSEL, 0, -1);
,,,return TRUE;
,,}
,}
,return CDialog::PreTranslateMessage(pMsg);
}
Solving these problems can help me better understand QM programming, Thanks for any help!
Aaron
Macro Macro2
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog" "4"
;3 Edit 0x54231044 0x200 8 8 208 100 ""
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040C02 "*" "" "" ""
str controls = "3"
str e3
if(!ShowDialog(dd &sub.DlgProc &controls)) ret
#sub DlgProc
function# hDlg message wParam lParam
sel message
,case WM_INITDIALOG
,QmRegisterDropTarget(id(3 hDlg) hDlg 0)
,case WM_DESTROY
,case WM_COMMAND goto messages2
,
,case WM_QM_DRAGDROP
,QMDRAGDROPINFO& di=+lParam
,;sel wParam
,,;case 3 ;;drop
,,_s=di.files; _s+"[]"
,,_s.setsel(0 di.hwndTarget) ;;A: append
,,
,,;s.setwintext(di.hwndTarget) ;;B: Delete before add
,,ret DT_Ret(hDlg 1)
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1