Jump to content

odklizec

Active Members
  • Posts

    66
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

odklizec's Achievements

Wayfarer

Wayfarer (2/7)

0

Reputation

  1. Thanks for info! So this inability of drawing graphics over the image is a "feature" Good to know that! I will give a try to the Tobias graphic library.
  2. Anyone please? Is there a bug/something missing in the above script or it's a GUICtrlSetGraphic/GUICtrlCreatePic bug? Where are all AutoIt experts?
  3. OK, it looks we need to help ourselves. At first, you have to remove the first GUISetState(@SW_SHOW) call from your script. I found that if you call it two times like in your example, the newly drawn graphics is just not correctly refreshed after its creation. If you overlap the gui window with another window (or just drag it outside the visible screen), the circles will be displayed. However, still under the image. Remove the first call of GUISetState and the circles will be drawn right away. Here is my test sample: #include <GUIConstants.au3> $c1=GUICreate("graphics over image test", 320, 240, 0, 0,$WS_SIZEBOX+$WS_SYSMENU) GUISetBkColor(0x000000) $n=GUICtrlCreatePic(@WindowsDir & "\Soap Bubbles.bmp",80,55, 160,120) GuiCtrlSetState(-1,$GUI_DISABLE) $graph = GuiCtrlCreateGraphic(350, 250, 1,1) GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0xffff00) GUICtrlSetGraphic(-1,$GUI_GR_ELLIPSE, -350,-305,360,360) GUICtrlSetGraphic(-1,$GUI_GR_ELLIPSE, -290,-245,240,240) GUICtrlSetGraphic(-1,$GUI_GR_ELLIPSE, -230,-185,120,120) GUICtrlSetState(-1, $GUI_GR_REFRESH) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop Sleep(20) WEnd Can anyone knowledgeable please look at this sample and tell us if it's OK or if there is something wrong with script (or a bug in Autoit)?
  4. Hello phil11! Did you solve this issue? Because I have exactly the same problem. I want to draw something above Pic object. I see filling the Graphic object, but it disappears right after end of GUICtrlSetGraphic operation and I see only the Pic object containing the image.
  5. Oh, yes here is the code, which sends the string from AutoIt to target app.. #include <A3LMemory.au3> Global Const $WM_RUNSCRIPTCODE = 0x08C7 Global Const $RUNSCRIPTCODE_LOUD = 1 Global Const $RUNSCRIPTCODE_QUIET = 0 Local $iItem, $pMemory, $tMemMap, $pText $hwnd = WinGetHandle("Welcome!") $stringToSend='Message("","OK")' $slen = stringlen($stringToSend) +1 $str = "char[" & $slen & "]" $struct= DllStructCreate($str); make a struct for the string so we can get a pointer to it if @error Then MsgBox(0,"","Error in DllStructCreate " & @error) exit endif ; this is the critical part responsible for writing the internal pointer of string in structure to target application memory $iItem = DllStructGetSize($struct); get structure size $pMemory = _Mem_CtrlInit($hwnd, $iItem, $tMemMap); init memory and return pointer to initialized memory in target app DllStructSetData($struct, 1, $stringToSend); set string to structure $pointer = DllStructGetPtr($struct,1); pointer to string in structure _Mem_CtrlWrite($tMemMap, $pointer, $pMemory, $iItem); write string pointer to application memory ; SendMesage to target application (pointer in target application memory) $result = DllCall("user32.dll","int","SendMessage","hWnd",$hwnd ,"int",$WM_RUNSCRIPTCODE,"int",$RUNSCRIPTCODE_LOUD,"ptr",$pMemory) If @error Then MsgBox(0,"_ToggleMonitor", "_SendMessage Error: " & @error) Exit EndIf _Mem_CtrlFree($tMemMap);release the memory In the end, it was easier than I thought. But after reading your last comment I was about giving it up Yes, I'm Czech too, but currently living in Slovakia.
  6. I'm happy to report that I got it working!!! Big thanks Zedna for your suggestions! The last one helped a lot and it now works as expected! Once again thank you and SmOke_N for your tips!
  7. Oh silly me You are of course right Zedna. Thanks for tip!
  8. Thanks for suggestion but yes, I have the #include <A3LMemory.au3> at the top of script.. #include <Misc.au3> #include <A3LConstants.au3> #include <A3LMemory.au3> #include <A3LWinAPI.au3> ...
  9. Hello folks. Can anyone tell me wht I'm getting this errors and warnings? I need to use some memory functions for this problem.. http://www.autoitscript.com/forum/index.ph...c=56213&hl= But I simply cannot go over these errors Installed latest AutoIt beta. Thank you in advance for any advice!
  10. Thanks Zedna. That sound reasonable. I will try that, although I don't know anything about allocating memory in target application. But yesterday I knew nothing about structures. New day..new challenge If I understand the TreeView_GetText() code right, all I need is to use/change this code to write in target application memory? $iItem = DllStructGetSize($tItem) $pMemory = _Mem_CtrlInit($hWnd, $iItem + 4096, $tMemMap) $pText = $pMemory + $iItem DllStructSetData($tItem, "Text", $pText) _Mem_CtrlWrite($tMemMap, $pItem, $pMemory, $iItem) _API_SendMessage($hWnd, $TVM_GETITEM, 0, $pMemory) _Mem_CtrlRead($tMemMap, $pText, $pBuffer, 4096) _Mem_CtrlFree($tMemMap)
  11. Yes, this was my initial code, before I realized there must be a pointer to string in last parameter. However, I made a small progress but it's very odd If I use this code in AutoIt 3.2.0.0 it definitely sends something to the target application... $result = DllCall("user32.dll","int","SendMessage","hWnd",$hwnd ,"int",$WM_RUNSCRIPTCODE,"int","1","str",$pointer) It's wrong code because of str instead of ptr, but it sends something to the target application, which immeditaly invoke the "Unknown Function" error message. It means that the application receives the string from AutoIt. But when the target application trying to run the received string (via RUNSCRIPTCODE), it fails (from obvious reason). Of course, I also tried to replace the $pointer with $stringToSend, but it does not pass the string to application. And replacing str with ptr and leaving the $pointer where it is now does not help either. Now the strange part is, that the same (Unknown Function error) does not happen if the above "wrong" script is compiled with actual 3.2.8.1 or 3.2.9.4 beta! Any idea why is it like that? Why the wrong code partially works with 3.2.0.0 and does not help with the latest versions?
  12. Thanks for tip Zedna! I forgot to mention that I already tried both ways. Still the same. If I wouldn't know for sure that this mechanism works fine from C++ code, I would say there is something wrong in the host application. But it works in C++ based apps? Here is a part of code, which I know work OK... case WM_RUNSCRIPTCODE: if(m_Process && !m_Ignore) { HWND hWnd = theApp.GetPlayerHWnd(); if(hWnd) { CString str; GetWindowText(str); ::SendMessage(hWnd, WM_RUNSCRIPTCODE, RUNSCRIPTCODE_LOUD, LPARAM(LPCTSTR(str))); theApp.StoreCommand(str); SetCurSel(-1); } }
  13. Unfortunately, still the same. DllStructGetData returns the value from structure in bytes but the host application seems not getting it. Here is my actual code: #include <Misc.au3> Global Const $WM_RUNSCRIPTCODE = 0x08C7 Global Const $RUNSCRIPTCODE_LOUD = 1 Global Const $RUNSCRIPTCODE_QUIET = 0 $hwnd = WinGetHandle("Welcome!") $stringToSend="test$='OK'" $slen = stringlen($stringToSend) + 1 ;MsgBox(0,"string len",$slen) $str = "char[" & $slen & "]" $struct= DllStructCreate($str);make a struct for the string so we can get a pointer to it if @error Then MsgBox(0,"","Error in DllStructCreate " & @error); exit endif DllStructSetData($struct,1,$stringToSend) $pointer = DllStructGetPtr($struct,1);the pointer to the string if @error Then MsgBox(0,"","Error in DllStructGetPtr " & @error); exit endif MsgBox(0,"DllStruct","Struct Size: " & DllStructGetSize($struct) & @CRLF & _ "Struct pointer: " & DllStructGetPtr($struct,1) & @CRLF & _ "Data: " & DllStructGetData($struct,1) & @CRLF) $result = DllCall("user32.dll","int","SendMessage","hWnd",$hwnd ,"int",$WM_RUNSCRIPTCODE,"int",$RUNSCRIPTCODE_LOUD,"ptr",$pointer) ;$result = _SendMessage($hwnd, $WM_RUNSCRIPTCODE, $RUNSCRIPTCODE_LOUD, $pointer) If @error Then MsgBox(0,"_ToggleMonitor", "_SendMessage Error: " & @error) Exit EndIf Thanks for help!
  14. Thanks for reply and suggestion regarding the _SendMessage() Yes, I already tried also this UDF function, unfortunately, with the same result. I'm almost sure that the problem is in the last "pointer" part. I just don't know what's wrong here? The WM_RUNSCRIPTCODE is just a message expected in the target application. Basically, it should allow to run the applications' own script from 3rd party apps. The last parameter should be the pointer to a string of the script's source code. Here is the full description from SDK:
  15. Hi guys, I need to convert relative simple C SendMesage code to AutoIt. But from some strange reasons, I cannot make it to work Maybe I don't see something obvious or it's just that I'm not very experienced with C to AutoIt conversion So can someone experienced please look at this? I want this convert to AutoIt: SendMessage(hWnd, WM_RUNSCRIPTCODE, RUNSCRIPTCODE_LOUD, LPARAM(LPCTSTR(str))); I tried the below autoit translation, which I believe should be OK. It creates the structure, gets the structure pointer, but unfortunately, it does not pass the correct result to the last SendMessage parameter. And I know the target application is OK. If the "SendMessage" is done from C code, it works OK. Global Const $WM_RUNSCRIPTCODE = 0x08C7 $hwnd = WinGetHandle("Welcome!") $stringToSend="test$='OK'" $slen = stringlen($stringToSend) + 1 MsgBox(0,"string len",$slen) $str = "char[" & $slen & "]" $struct= DllStructCreate($str); make a structure if @error Then MsgBox(0,"","Error in DllStructCreate " & @error); exit endif DllStructSetData($struct,1,$stringToSend) $pointer = DllStructGetPtr($struct,1); get the pointer to the string if @error Then MsgBox(0,"","Error in DllStructGetPtr " & @error); exit endif MsgBox(0,"DllStruct","Struct Size: " & DllStructGetSize($struct) & @CRLF & _ "Struct pointer: " & DllStructGetPtr($struct) & @CRLF & _ "Data: " & DllStructGetData($struct,1) & @CRLF) $result = DllCall("user32.dll","int","SendMessage","hWnd",$hwnd ,"int",$WM_RUNSCRIPTCODE,"int","1","ptr",$pointer) Does anyone have any idea what's wrong here? Thank you in advance!
×
×
  • Create New...