JackDinn Posted April 16, 2009 Share Posted April 16, 2009 (edited) i thought i understood GUIRegisterMsg but obviously not, im trying to trigger a func when i copy anything "ctr c" or right click copy, but i dont seem be able to get this right. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form=Form1.kxf $Form1 = GUICreate("Form1", 633, 452, 193, 125) $Edit1 = GUICtrlCreateEdit("", 88, 24, 353, 369) GUICtrlSetData(-1, "Edit1") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### ;####### Register the windows message ############ GUIRegisterMsg($WM_COPY, "Win_message") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd func Win_message() MsgBox(0,"","Copy Captured") EndFunc i also tried to use $WM_LBUTTONDOWN just to c if it was a problem with $WM_COPY but it says undefined constant ? and also where do i find a proper list of what all the windows messages do ? basically im trying to trigger a func if the clipboard changes (cut or copy) i just seem to go 3 steps forward and 4 steps backward thx for any help. Edited April 16, 2009 by JackDinn Thx all,Jack Dinn. JD's Auto Internet Speed Tester JD's Clip Catch (With Screen Shot Helper) Projects :- AutoIt - My projects My software never has bugs. It just develops random features. :-D Link to comment Share on other sites More sharing options...
sandin Posted April 16, 2009 Share Posted April 16, 2009 (edited) expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ClipBoard.au3> $Form1 = GUICreate("Form1", 633, 452, 193, 125) $Edit1 = GUICtrlCreateEdit("", 88, 24, 353, 369) GUICtrlSetData(-1, "Edit1") GUISetState(@SW_SHOW) ;####### Register the windows message ############ _ClipBoard_SetViewer ($Form1) GUIRegisterMsg($WM_DRAWCLIPBOARD, "Copy_command") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd func Copy_command() Local $iFormat _ClipBoard_Open ($Form1) Do $iFormat = _ClipBoard_EnumFormats ($iFormat) If $iFormat <> 0 Then if _ClipBoard_FormatStr ($iFormat) = "Unicode Text" Then Local $new_clip = ClipGet() GUICtrlSetData($Edit1, $new_clip) ConsoleWrite(">New COPY:" & @CRLF & ">" & $new_clip & @CRLF & "----------" & @CRLF) else ConsoleWrite(">New COPY:" & @CRLF & ">" & _ClipBoard_FormatStr ($iFormat) & @CRLF & "----------" & @CRLF) EndIf EndIf Until $iFormat = 0 _ClipBoard_Close () EndFunc Edited April 16, 2009 by sandin Some cool glass and image menu | WinLIRC remote controler | Happy Holidays to all... | Bounce the sun, a game in which you must save the sun from falling by bouncing it back into the sky | Hook Leadtek WinFast TV Card Remote Control Msges | GDI+ sliding toolbar | MIDI Keyboard (early alpha stage, with lots of bugs to fix) | Alt+Tab replacement | CPU Benchmark with pretty GUI | Ini Editor - Edit/Create your ini files with great ease | Window Manager (take total control of your windows) Pretty GUI! | Pop-Up window from a button | Box slider for toolbar | Display sound volume on desktop | Switch hotkeys with mouse scroll Link to comment Share on other sites More sharing options...
WideBoyDixon Posted April 16, 2009 Share Posted April 16, 2009 (edited) Actually, I'm pretty pleased with this one You need to set your window as being a clipboard viewer then you'll get a notification (WM_DRAWCLIPBOARD) whenever the contents of the clipboard change. Global Const $WM_DRAWCLIPBOARD = 0x0308 Global $hEdit _Main() Exit Func _Main() Local $hGUI = GUICreate("Clipboard Monitor", 272, 272) $hEdit = GUICtrlCreateEdit("", 8, 8, 256, 256) GUISetState() GUIRegisterMsg($WM_DRAWCLIPBOARD, "_DrawClipboard") Local $hNext = DllCall("user32.dll", "hwnd", "SetClipboardViewer", "hwnd", $hGUI) Do Until GUIGetMsg() = -3 DllCall("user32.dll", "long", "ChangeClipboardChain", "hwnd", $hGUI, "hwnd", $hNext) GUIDelete() EndFunc Func _DrawClipboard($hWnd, $iMsg, $wParam, $lParam) GUICtrlSetData($hEdit, ClipGet()) EndFunc EDIT: Curse you Sandin!! Edited April 16, 2009 by WideBoyDixon [center]Wide by name, Wide by nature and Wide by girth[u]Scripts[/u]{Hot Folders} {Screen Calipers} {Screen Crosshairs} {Cross-Process Subclassing} {GDI+ Clock} {ASCII Art Signatures}{Another GDI+ Clock} {Desktop Goldfish} {Game of Life} {3D Pie Chart} {Stock Tracker}[u]UDFs[/u]{_FileReplaceText} {_ArrayCompare} {_ToBase}~ My Scripts On Google Code ~[/center] Link to comment Share on other sites More sharing options...
sandin Posted April 16, 2009 Share Posted April 16, 2009 @WideBoyDixon 1 min. faster, heheheh @JackDinn and WideBoyDixon: <ClipBoard.au3> already contain dll call functions related to clipboard, so browse the help file for _ClipBoard_ functions to get them all Some cool glass and image menu | WinLIRC remote controler | Happy Holidays to all... | Bounce the sun, a game in which you must save the sun from falling by bouncing it back into the sky | Hook Leadtek WinFast TV Card Remote Control Msges | GDI+ sliding toolbar | MIDI Keyboard (early alpha stage, with lots of bugs to fix) | Alt+Tab replacement | CPU Benchmark with pretty GUI | Ini Editor - Edit/Create your ini files with great ease | Window Manager (take total control of your windows) Pretty GUI! | Pop-Up window from a button | Box slider for toolbar | Display sound volume on desktop | Switch hotkeys with mouse scroll Link to comment Share on other sites More sharing options...
WideBoyDixon Posted April 16, 2009 Share Posted April 16, 2009 Actually, I wasn't aware of Clipboard.au3 so now I'm feeling a bit foolish. I'm sure I'll get over it.Best idea would be to take a look at this : http://www.autoitscript.com/autoit3/docs/l...d_SetViewer.htmWBD [center]Wide by name, Wide by nature and Wide by girth[u]Scripts[/u]{Hot Folders} {Screen Calipers} {Screen Crosshairs} {Cross-Process Subclassing} {GDI+ Clock} {ASCII Art Signatures}{Another GDI+ Clock} {Desktop Goldfish} {Game of Life} {3D Pie Chart} {Stock Tracker}[u]UDFs[/u]{_FileReplaceText} {_ArrayCompare} {_ToBase}~ My Scripts On Google Code ~[/center] Link to comment Share on other sites More sharing options...
JackDinn Posted April 16, 2009 Author Share Posted April 16, 2009 well thx , both of you , darn odd things i did not know i couldn't receive a clipboard msg without having set a window as being a clipboard viewer !! odd cos surly the msg is still getting sent, but what do i know a lot of the Constants are not defined in <WindowsConstants.au3> like $WM_LBUTTONDOWN & a good few others, not a prob though just use the raw value. and also where do i find a proper list of what all the windows messages do ? MSDN ? ok thx both of you i'll tinker a little more. Thx all,Jack Dinn. JD's Auto Internet Speed Tester JD's Clip Catch (With Screen Shot Helper) Projects :- AutoIt - My projects My software never has bugs. It just develops random features. :-D Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now