Hallo Leute
Ich brauch wieder mal eure Hilfe.
Von irgendwo habe ich mal ein Programm geklaut und entsprechen modifiziert.
Mit der gedrückten Alt- Taste und der Maus kann man einen rechteckigen Rahmen auf den Schirm zeichnen.
Zusätzlich kann es die Koordinaten an ein anderes Prog. senden.
Soweit klappt das auch.
Ich möchte aber auch Daten an das Programm ($Input1) senden können mit:
$Text= "Daten"
$hWnd = WinGetHandle("[REGEXPTITLE:(GTI.*)]")
WinActivate($hWnd)
ControlSetText($hWnd,"","[CLASS:Edit; INSTANCE:1]", $Text)
ToolTip($hWnd)
Dem Programm "GTI" möchte ich mit dem oben genannten Quellencode Daten übermitteln.
Programm GTI zum testen
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;dieses Prog. ist nicht von mir wurde aber von mir modifiziert!!
;Silvermoon
;____________________________________________________________
;Programm 1 von 2
; mit drücken der Alt-Taste lässt sich mit der Maus ein rechteckiger Rahmen aufziehen,welcher
;über alle anderen Fenster liegt.
;zusätzlich können die Rechteck- Koordinaten an ein Fremdprogramm "Form1" senden werden .
; die Function " _eigene_hWnd()" kann gelöscht werden so wie dessen Aufruf.
;zur zeit kann ich keine Daten (Coordinaten) von Programm2 an das GTI-$Input1 senden. :(((
;es werden nochweitere Funktionenen geplant
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;
#include <GDIPlus.au3>
#include <Misc.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>
#include <Array.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
HotKeySet("{ESC}", "_Senden")
Opt("GUIOnEventMode", 1)
$hGui = GUICreate("GDI", @DesktopWidth, @DesktopHeight, 0, 0,$WS_POPUP, $WS_EX_LAYERED)
GUISetBkColor(0x000000)
$Input1 = GUICtrlCreateInput(" ", 102, 5,100, 30)
GUICtrlSetOnEvent(-1, "Meldung")
;GUICtrlSetState($Input1,$GUI_ENABLE )
_WinAPI_SetLayeredWindowAttributes($hGui,0x000000,255)
GUISetOnEvent(-3, "_Shut")
GUISetState()
_GDIPlus_Startup()
Global $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGui)
Global $hBitmap = _GDIPlus_BitmapCreateFromGraphics(@DesktopWidth, @DesktopHeight, $hGraphics)
Global $Backbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
Global $hPen = _GDIPlus_PenCreate(0xFFFF0000, 2)
Global $hPen2 = _GDIPlus_PenCreate(0xFFFFa000, 2)
WinSetOnTop($hGui, "",1)
WinSetOnTop($hGraphics, "",1)
_GDIPlus_GraphicsClear($Backbuffer)
Sleep(300)
;--------------------------------------------------
While 1
;ControlSetText("Form1","","[CLASS:Static; INSTANCE:7]", "Rahmen zeichnen mit Alt+linke Maustaste?")
$R_pos = MouseGetPos();1. Mauspos
if _IsPressed("12") Then; Alt-Taste
While _IsPressed("01")
$R_pos2 = MouseGetPos(); 2. Mauspos
_GDIPlus_GraphicsClear($hGraphics)
_GDIPlus_GraphicsDrawLine($hGraphics, $R_pos[0], $R_pos [1], $R_pos2[0], $R_pos [1], $hPen2);Oben horizontal
_GDIPlus_GraphicsDrawLine($hGraphics, $R_pos[0], $R_pos2[1], $R_pos2[0], $R_pos2[1], $hPen);Unten horizontal
_GDIPlus_GraphicsDrawLine($hGraphics, $R_pos[0], $R_pos[1], $R_pos[0], $R_pos2[1], $hPen2);Links vertikal
_GDIPlus_GraphicsDrawLine($hGraphics, $R_pos2[0], $R_pos[1], $R_pos2[0], $R_pos2[1], $hPen);Rechts vertikal
; _GDIPlus_GraphicsDrawImage($hGraphics, $hBitmap, 0, 0)
ControlSetText("Form1","","[CLASS:Edit; INSTANCE:1]", $R_pos[0]) ;X
ControlSetText("Form1","","[CLASS:Edit; INSTANCE:2]", $R_pos[1]) ;Y
ControlSetText("Form1","","[CLASS:Edit; INSTANCE:3]", $R_pos2[0]) ;X1
ControlSetText("Form1","","[CLASS:Edit; INSTANCE:4]", $R_pos2[1]) ;Y1
if not _IsPressed("01") Then
_eigene_hWnd(); zum testen
;ControlSetText("Form1","","[CLASS:Static; INSTANCE:7]", "Bild mit Pausetaste speichen ?")
EndIf
WEnd
EndIf
;_GDIPlus_GraphicsClear($hGraphics, 0xFF000000); grafig löschen
;Sleep(10)
WEnd
;--------------------------------------------------
Func _Shut()
_GDIPlus_GraphicsDispose($hGraphics)
_GDIPlus_GraphicsDispose($Backbuffer)
_GDIPlus_BitmapDispose($hBitmap)
_GDIPlus_PenCreate($hPen)
_GDIPlus_Shutdown()
Exit
EndFunc ;==>_Shut
;--------------------------------------------------
Func _eigene_hWnd()
;
$hWnd = WinGetHandle("[REGEXPTITLE:(GTI.*)]")
GUICtrlSetData($Input1 ,$hWnd)
ToolTip("_hWnd von GTI... "&$hWnd)
;-----------test
EndFunc
;--------------------------------------------------
Func Meldung()
$T=GUICtrlread($Input1)
;MsgBox($MB_SYSTEMMODAL, "Rückmeldung")
MsgBox($MB_SYSTEMMODAL, "Titel", "Rückmeldung "&$T,1 )
EndFunc
Func _Senden()
Exit
;ControlSetText("Form1","","[CLASS:Edit; INSTANCE:1]", $R_pos[0])
;ControlSetText("Form1","","[CLASS:Edit; INSTANCE:2]", $R_pos[1])
;ControlSetText("Form1","","[CLASS:Edit; INSTANCE:3]", $R_pos2[0])
;ControlSetText("Form1","","[CLASS:Edit; INSTANCE:4]", $R_pos2[1])
EndFunc
Jedoch reagiert das Programm GTI nicht darauf
Wo liegt der Fehler?
Danke für eure Hilfe