i want to build a global toolbar with all my credentials.
i want to drop my password button onto firefox password field in order to prevent a lot of manual actions.
Maybe easier would be to click button, then let the macro wait for another click... I often do it. For example, this macro deletes a music file in winamp library and scrolls to the next item.
OnScreenDisplay"click the item in 10 seconds" wait10 ML;errret OsdHide int hlv=child(mouse) Acc a=acc("""LIST" hlv """"0x1000);errret ARRAY(Acc) aa
a.Selection(aa) if(!aa.len)ret
a=aa[0]
a.Mouse(2) wait5 WV "+#32768" key rrrRp 0.5
a.Select(2);;now a is first element after deleted element SendMessage hlv LVM_ENSUREVISIBLE a.elem 0
;Call this function in a toolbar hook function, before sel message. ;It detects when you drag and drop a button somewhere outside the toolbar. ;If you drag and drop a button, it returns 1 and stores button text into buttonText. ;Else it returns 0.
;Call this function on WM_QM_DRAGDROP in toolbar hook function. ;Gets some info about the button on which dropped. ;Returns toolbar line index. Returns 0 if dropped not on a button.
;hWnd - hWnd. ;tbLabel - receives button text. Can be 0. ;tbLine - receives button line text. Can be 0.
;button index int htb=id(9999 hWnd) POINT p;xm p htb 1 int b=SendMessage(htb TB_HITTEST0&p) if(b<1)ret
function!str&s [flags] ;;flags: 1 drag source must not delete text
;Extracts dropped text. ;Returns 1 if successful, 0 if failed.
s.fix(0)
int k=GetMod sel(k)case [0,2] caseelse this.effect=DROPEFFECT_NONE;ret if(flags&1) k=2
int i for(i 0 this.formats.len)if(this.formats[i].cfFormat=CF_UNICODETEXT)break if(i=this.formats.len)ret
STGMEDIUM sm
this.dataObj.GetData(&this.formats[i] &sm);errret
int gs=GlobalSize(sm.hGlobal)-2;if(gs<=0)ret
s.all(gs 2) byte* m=GlobalLock(sm.hGlobal);if(!m)ret memcpy s m s.len GlobalUnlock sm.hGlobal ReleaseStgMedium(&sm)
s.ansi
sel k ,case0 this.effect&DROPEFFECT_MOVE ,case2 this.effect&DROPEFFECT_COPY
hello gintaras, it has been a while since i last edited the related code for that.
i now want to use a toolbar like this for overlaying a text field, which does not allow drag text.
that all is working, but since i am so rusty with qm code, can you please give me a hint or a topic about how to extract urls from dropped text?
str s="http://a.b.c/x?y=z&b=5 http://e.f.g" ARRAY(str) a if(!findrx(s "http(s)?://([\w\-]+\.)?[\w\-]+\.\w+/?\S*"04 a))ret int i for i 0 a.len ,out a[0 i]
;Creates a partially transparent window over a control. ;When you drop text on it, it transfers the text to the control. ;Not fully working. Just an example of how you can do it. Need much more code in dlg_TextDrop.
;hwndControl - control handle. ;flags: ;;;0 - wait until the control is destroyed (its window closed). Returns 1. ;;;1 - return immediately. Returns handle of the transparent window. Then the thread must not exit; it must process messages.
if(!IsWindow(hwndControl))ret int hDlg=ShowDialog("dlg_TextDrop"&dlg_TextDrop0 hwndControl 100 hwndControl)
ret ;messages ;OutWinMsg message wParam lParam int hwndControl=DT_GetParam(hDlg) sel message ,caseWM_INITDIALOG ,RECT r;GetWindowRect hwndControl &r ,SetWindowPos hDlg 0 r.left r.top r.right-r.left r.bottom-r.top SWP_NOZORDER|SWP_NOACTIVATE ,Transparent hDlg 64 ,SetWindowPos hDlg 00000SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER|SWP_NOACTIVATE ,SetTimer hDlg 110000 ,QmRegisterDropTarget(hDlg hDlg 0) , ,caseWM_QM_DRAGDROP ,QMDRAGDROPINFO& di=+lParam ,sel wParam ,,case3;;drop ,,str s ,,if(!di.GetText(s))ret ,,s.setwintext(hwndControl) ,,retDT_Ret(hDlg 1) , ,caseWM_TIMER ,sel wParam ,,case1 ,,if(!IsWindow(hwndControl))DestroyWindow hDlg;ret ,,;also should move dialog if hwndControl moved; hide if hidden or minimized, etc ret
;Should also somehow relay mouse and some other messages to hwndControl, ;because now it is covered by this dialog and therefore is like disabled. ;Cannot make this dialog completely transparent, because dag/drop will not work. ;Easier would be to move this dialog beside the control, not to cover the control. ;Need much more code to make this work well in all cases.
In "dlg_ole_drop_text" from March 27,2009, can you add a rich text control or a web browser control and still maintain the same drag / drop functionality for the main window? ie: you could display text in the control and drag portions of that text from that control and drop it on the main host window.
Usually I add controls in the basic way:
str controls = "3"
str rea3 = "$documents$\testFolder\testFile.rtf"
if(!ShowDialog("Dialog19" &Dialog19 &controls)) ret
---------------
Could you please show how to add a rich text control to "dlg_ole_drop_text" ?
I don't understand how to work with [[ 0 _hwndqm 0 0 0 0 1 -1 ]] part:
if(!ShowDialog("dlg_ole_drop_text" &dlg_ole_drop_text 0 _hwndqm 0 0 0 0 1 -1)) ret
1. Open dlg_ole_drop_text.
2. Right click selection bar in first line. It will insert 1 space.
3. Click Run button. It will show dialog editor.
4. Click Options button, click Together... button, OK.
5. Add rich edit control.
6. Apply. It will update dialog definition, add/update dialog variables and ShowDialog line.