Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Browser toolbar
#31
Acknowledged.
#32
ok, moved to status bar as you give a practical and functional exmaple in QM

TB StatusBar in Samples - toolbars and menus

Wanted to know how :

make toolbar black

write in it white

with custom font, bold

TY
#33
Look in Properties.
#34
i look again, then because it does not work..

maybe i fail in color codes...
#35
Click the color edit field, then click the [...] button.
#36
i really don't get it

no black toolbar..


Attached Files Image(s)
   
#37
Need to restart the toolbar. For example in Properties click Apply/Test.
#38
doing this for 30 min, no joy, sure i miss something
#39
hmmm, tried al last with a fresh toolbar, works...

seems to be the modified status bar exmaple that does not obey..

going back to stock toolbar and stop using status bar example...
#40
Gintaras,

is it possible to send from a function a custom message to a toolbar hook procedure ??
sendmessage WM_MYCUSTOMMESSAGE toolbarwindow param1 param2
in hook

case WM_MYCUSTOMMESSAGE
if(param1=....
if(param2=...

thanks
#41
Yes.
#42
external call


Code:
Copy      Help
def WM_MYMESSAGE 0x658741
SendMessage(win("CHROMEBAR" "QM_toolbar") WM_MYMESSAGE 1 2)



Hook procedure

Function ChromeBarProc
Code:
Copy      Help
function# hWnd message wParam lParam
def WM_MYMESSAGE 0x658741
;<help #IDH_EXTOOLBAR>Toolbar hook help</help>
;outw hWnd

sel message
,case WM_MYMESSAGE
,out "recu"



No message from toolbar hook procedure..where do I do wrong???
#43
I guess Windows does not allow to send messages in whole int range. Use WM_APP+n instead of 0x658741.
#44
def WM_MYMESSAGE WM_APP+1000 did the trick, ty.
#45
is there example code to have the toolbar containing only one button (ie one definition in toolbar macro like abcdf :dosomething), sized to toolbar dimensions, and black with white font???

i looked in many examples but fail..

if too complcated, will do something else
#46
Look in MSDN, TB_x messages, I don't remember.
#47
sure will...
#48
Reviving this, I need to be able to pop a menu when i middle click or left double click on the toolbar, where
find example in documentation (or if you can provide a framework)

Thanks
#49
Toolbar Toolbar72
Code:
Copy      Help
;/hook WndProc_ToolbarHook6

Function WndProc_ToolbarHook6
Code:
Copy      Help
;/
function# hwnd message wParam lParam

;<help #IDH_EXTOOLBAR>Toolbar hook help</help>

;OutWinMsg message wParam lParam ;;uncomment to see received messages

sel message
,case WM_INITDIALOG
,SetWindowSubclass(id(9999 hwnd) &sub.WndProc_Subclass 1 0)
,
,case WM_DESTROY
,
,;case WM_


#sub WndProc_Subclass
function# hwnd message wParam lParam uIdSubclass dwRefData

;OutWinMsg message wParam lParam ;;uncomment to see received messages

sel message
,case WM_MBUTTONUP
,int i=ShowMenu("1 one[]2 two" hwnd)
,out i

int R=DefSubclassProc(hwnd message wParam lParam)

sel message
,case WM_NCDESTROY
,RemoveWindowSubclass(hwnd &sub.WndProc_Subclass uIdSubclass)
,
,;case ...

ret R
#50
ok, perfect as usual...

Is it possible then to interact between toolbar and Macro chrome address function provided earlier???

Can the main function pass string or array to toolbar via wParam or lParam, i tried with no success..

Function ChromeMonitor
Trigger !cv"* - Google Chrome" "Chrome_WidgetWin_1" "" "" "" 0x2 /CHROME     Help - how to add the trigger to the macro
Code:
Copy      Help
#sub Hook
function hHook event hwnd idObject idChild dwEventThread dwmsEventTime
ARRAY(str)+ h
IStringMap+ m
if(!hwnd) ret

Acc a.FromEvent(hwnd idObject idChild)
sel a.Name
,case ["Barre d'adresse et de recherche"]
,str url=a.Value
,SendMessage toolbarwindow WM_MYMESSAGE h m
,case else ret
#51
Macro Macro2825
Code:
Copy      Help
type MyToolbarInteractData IStringMap'm ARRAY(str)h
MyToolbarInteractData- x
x.m._create

;;set hook and wait


#sub Hook
function hHook event hwnd idObject idChild dwEventThread dwmsEventTime
if(!hwnd) ret

MyToolbarInteractData- x
;x.m.Add(...)
;...

Acc a.FromEvent(hwnd idObject idChild)
sel a.Name
,case ["Barre d'adresse et de recherche"]
,str url=a.Value
,SendMessage toolbarwindow WM_MYMESSAGE 0 &x
,case else ret
Function WndProc_ToolbarHook6
Code:
Copy      Help
;/
function# hwnd message wParam lParam

;<help #IDH_EXTOOLBAR>Toolbar hook help</help>

;OutWinMsg message wParam lParam ;;uncomment to see received messages

#compile "macro containing type MyToolbarInteractData..."

sel message
,case WM_MYMESSAGE
,MyToolbarInteractData& x=+lParam
,;out x.h.len
#52
Perfect, my program is almost done, QM is a fantastic toy, and its creator a master...
#53
Changed the code to avoid copying the array. But the old code also works.
#54
OK, just cosmetics...

1. anyway to have the toolbar button color text modified? I modified to Comic MS font, but always black color...boring

2. How to shrink toolbar to 1 pixel, and expand it back *by code*??

3. this one is important:

in the window procedure of the toolbar, what is the relation of the variables declared in the "body" of the function (i.e at the beginning of it) and the sub functions???

I want ot declare a str in body, and use it (i.e accessing it's value) in a sub function..sometimes I have problems doing it.

Must it be declared as global variable??

Macro Macro24
Code:
Copy      Help
function# hWnd message wParam lParam
def WM_MYMESSAGE WM_APP+1000

;here my str variable to use anywhere

str+ fichier="ORIGIN"
sel message

,case WM_INITDIALOG
,fichiers="VALUE TO KEEP EVERYWHERE"
,SetWindowSubclass(id(9999 hWnd) &sub.WndProc_Subclass 1 0)


,case WM_MYMESSAGE


#sub WndProc_Subclass
function# hwnd message wParam lParam uIdSubclass dwRefData

;NEEDED TO DECLARE GLOBAL??????
str+ fichier
;OutWinMsg message wParam lParam ;;uncomment to see received messages
sel message
,case WM_MBUTTONUP
,fichier="MODIFIED"
,sub.ecrire

int R=DefSubclassProc(hwnd message wParam lParam)

sel message
,case WM_NCDESTROY
,RemoveWindowSubclass(hwnd &sub.WndProc_Subclass uIdSubclass)
,;case ...
ret R

#sub ecrire v
str+ fichiers
out fichiers ;;should be "MODIFIED" after mouse click, "VALUE TO KEEP EVERYWHERE" if not
#55
3. Please read #sub help. Don't need global or thread variables.

1, 2, don't have time now.
#56
no problem for 1 & 2, not important.

For 3, will read again then, maybe i missed something.

Anyway, project is acheived now, thanks for your help...
#57
just reactivation for a problem I can solve and would make the toolbar more useful

The macro works as expected, i.e it monitor changes and modifies toolbar label as wished if relevant info if found on the matching url.

But the hook function does not allow to type in url bar without "eating" the typed keys, and therfore i can't anymore use the google search function.

Where can I modifiy it to allow search on type, but pass keys as usual if nothing relevant is found?

ty
#58
What code it is? Please post all related functions or remind me which of the posted code it is.
#59
Macro Macro16
Code:
Copy      Help
if(getopt(nthreads)>1) ret ;;allow single instance
def WM_MYMESSAGE WM_APP+1000
int hwnd=TriggerWindow ;;if trigger
if(!hwnd) hwnd=win("* - Google Chrome" "Chrome_WidgetWin_1" "" 1) ;;if Run button
if(!hwnd) ret ;;no Chrome
int pid; if(!GetWindowThreadProcessId(hwnd &pid)) end ERR_FAILED 16 ;;hook only this Chrome process
type MyToolbarInteractData str'h
MyToolbarInteractData- x
int hh=SetWinEventHook(EVENT_OBJECT_NAMECHANGE EVENT_OBJECT_NAMECHANGE 0 &sub.Hook pid 0 WINEVENT_OUTOFCONTEXT)
if(!hh) end ERR_FAILED 16
cop- "$my qm$\chrome.txt" "$my qm$\chrome-backup.txt" FOF_ALLOWUNDO|FOF_NOCONFIRMMKDIR|FOF_NOERRORUI|FOF_SILENT|FOF_FILESONLY

opt waitmsg 1 ;;don't block Windows messages, else sub.Hook cannot be called
wait 0 WP hwnd ;;wait until Chrome process exits
UnhookWinEvent hh


;
#sub Hook v
function hHook event hwnd idObject idChild dwEventThread dwmsEventTime
if(!hwnd) ret
MyToolbarInteractData- x
;outw hwnd ;;debug
Acc a.FromEvent(hwnd idObject idChild)
str f
_s=a.Name
if(_s.beg("Barre d'adresse et de recherche"))
,int w1=win(" - Google Chrome" "Chrome_WidgetWin_1")
,Acc a1.Find(hwnd "TEXT" "Barre d'adresse et de recherche" "class=Chrome_WidgetWin_1[]xy=146 43" 0x1005)
,x.h=a1.Value
,if(empty(x.h)) ret
,if(strcmp(x.h "Barre d'adresse et de recherche")=0) ret
,if(x.h.beg("chrome-extension://klbibkeccnjlkjkiokjodocebajanakg/suspended.html#uri="))
,,2
,,a1.Find(hwnd "TEXT" "Barre d'adresse et de recherche" "class=Chrome_WidgetWin_1[]xy=146 43" 0x1005)
,,x.h=a1.Value
,,SendMessage win("CHROMEBAR" "QM_toolbar") WM_MYMESSAGE 0 &x.h
,SendMessage win("CHROMEBAR" "QM_toolbar") WM_MYMESSAGE 0 &x.h
err+ ;;Acc functions throw error when closing Chrome


when this code is loaded (function running in QM), all works flawlessly for what i need except i can't anymore type urls in chrome's url edit box....
#60
the problem is the last

SendMessage win("CHROMEBAR" "QM_toolbar") WM_MYMESSAGE 0 &x.h

function, which prevents typing int the chrome url's bar.....


Forum Jump:


Users browsing this thread: 1 Guest(s)