Autor Beitrag
KleinesProgramm
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 21



BeitragVerfasst: Mi 19.03.08 13:50 
hallo, ich möchte ein Programm schreiben, das im Hintergrund läuft und im programm Paint (welches im vordergrund läuft) nach meinen Anweisungen zeichnet.

Ein Problem dabei ist: Die Cursorkontrolle

kann jemand von euch mir vll sagen wie man schreibt, dass der cursor an die stelle (X, Y) auf dem Bildschirm soll und da klicken soll?

vll falls möglich schritt für schritt erklären, und viel ein kleines Beispiel dazu schreiben? weil mit begriffen wie Parameter und sowas kann ich nicht umgehen...

danke für eure antworten



(P.S. ich habe noch mehr topics zu diesem Thema, aber man soll hier ja Fragen einzeln listen...
weitere Topics:
Probleme bei Tastaturkontrolle
Hexadezimal Farbencode
Delphi im Hintergrund)
huuuuuh
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 665
Erhaltene Danke: 19

win xp, (win vista), win 7
VS 2008 Express Edition, VS 2010 Express Edition, VS 2010 Professionell
BeitragVerfasst: Mi 19.03.08 14:31 
such mal über google nach einer seite namens "delphi-fundgrube"
da steht was darüber
huuuuuh
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 665
Erhaltene Danke: 19

win xp, (win vista), win 7
VS 2008 Express Edition, VS 2010 Express Edition, VS 2010 Professionell
BeitragVerfasst: Mi 19.03.08 14:44 
is nur ein befehl
ausblenden Delphi-Quelltext
1:
SetCursorPos (x,y); //x und y sind beides integer-zahlen					
huuuuuh
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 665
Erhaltene Danke: 19

win xp, (win vista), win 7
VS 2008 Express Edition, VS 2010 Express Edition, VS 2010 Professionell
BeitragVerfasst: Mi 19.03.08 14:49 
www.wer-weiss-was.de.../article1856838.html
dies könnte dir auch weiterhelfen
KleinesProgramm Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 21



BeitragVerfasst: Mi 19.03.08 19:52 
und gibts auch einen befehl dass der cursor klickt? also auf paint bezogen dass der eben einenpunkt da malt???

hoffe auf positive antwort *hope*
huuuuuh
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 665
Erhaltene Danke: 19

win xp, (win vista), win 7
VS 2008 Express Edition, VS 2010 Express Edition, VS 2010 Professionell
BeitragVerfasst: Mi 19.03.08 20:00 
ausblenden Delphi-Quelltext
1:
2:
sendmessage(WM_MOUSEDOWN);
sendmessage(WM_MOUSEUP);

ohne garantie
KleinesProgramm Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 21



BeitragVerfasst: Mi 19.03.08 20:18 
kannste ma bitte ausprobieren?
KleinesProgramm Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 21



BeitragVerfasst: Mi 19.03.08 21:16 
habs ausprobiert, undefinierter Bezeichner....

ich habs ma mit: sendmessage(MOUSEDOWN);

probiert, aber da kommt dann "nicht genügend wirkliche Parameter"

die hilfe sagt irgendwas von reaktion(nachlesen unter "TControl.MouseDown") dass da eventuell WM_LBUTTONDOWN, WM_MBUTTONDOWN, WM_RBUTTONDOWN steht, aber auch das klappt net...

bei durch klicken der hilfe kam noch was interessantes: "TControl.Perform" sich selbst windows-botschaften senden... vll hilft euch das, ICH kenn mcih jetzt garnicht mehr aus...

viel glück *RICHTIG VIEL* dass iwie das klappt
Silas
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 478

Windows XP Home
Delphi 2005, RAD Studio 2007, MASM32, FASM, SharpDevelop 3.0
BeitragVerfasst: Mi 19.03.08 21:43 
Probiers mal mit keybd_event:
ausblenden Delphi-Quelltext
1:
2:
keybd_event(VK_LBUTTON, 0, 0, 0);
keybd_event(VK_LBUTTON, 0, KEYEVENTF_KEYUP, 0);
Für die rechte Maustaste einfach VK_LBUTTON durch VK_RBUTTON ersetzen :wink: .

_________________
Religionskriege sind nur Streitigkeiten darüber, wer den cooleren imaginären Freund hat ;-)
KleinesProgramm Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 21



BeitragVerfasst: Do 20.03.08 08:36 
will iwie auch net...

also testweise hab ich ma ggaaaaanz schnell so was geschrieben:

Zwei buttons, wenn ma aus ersten klickt verschwindetet die maus sofort auf zweiten, dann 1000 MSekunden sleep und dann eben ein Klickbefehl der sie wieder vom zweiten butten zum ersten teleportieren sollte...

also zum button2 kam die maus, aber klicken wollt sie nicht, auch nicht bei keyevent...mhhh kannste nochma drüber nachdenken? weil keyevent hatte schonmal keine fehlermeldung....
Silas
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 478

Windows XP Home
Delphi 2005, RAD Studio 2007, MASM32, FASM, SharpDevelop 3.0
BeitragVerfasst: Do 20.03.08 09:08 
Hm... bis jetzt hab ich keybd_event nur mit Keyboard-Tasten probiert....
Versuchs mal damit:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
var ScanCode: Word;
...
ScanCode := MapVirtualKey(VK_LBUTTON, 0);
keybd_event(VK_LBUTTON, ScanCode, 0, 0);
keybd_event(VK_LBUTTON, ScanCode, KEYEVENTF_KEYUP, 0);
Die API-Doc sagt zwar das man den ScanCode-Parameter nicht braucht, aber probiers mal aus.

_________________
Religionskriege sind nur Streitigkeiten darüber, wer den cooleren imaginären Freund hat ;-)
KleinesProgramm Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 21



BeitragVerfasst: Do 20.03.08 18:39 
geht bei mir net, andere ideen?

also wenn das klappt... des wär echt super, würde mich wahnsinnig freuen wenn einer von euch iwie einen virtuellen mausklick hinkriegt!
huuuuuh
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 665
Erhaltene Danke: 19

win xp, (win vista), win 7
VS 2008 Express Edition, VS 2010 Express Edition, VS 2010 Professionell
BeitragVerfasst: Do 20.03.08 23:36 
versuch ma das, bin ich grad zufällig drüber gestolpert...
ausblenden Delphi-Quelltext
1:
2:
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);

für rechte maustaste das "LEFT" durch "RIGHT" erstezen
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Fr 21.03.08 01:03 
wie wäre es, wenn du einfach selber alles zeichnest und das über die Zwischenablage nur in Paint einfügst? Dann genügt es die entsprechende Tastenkombination zu senden.
Hidden
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 2242
Erhaltene Danke: 55

Win10
VS Code, Delphi 2010 Prof.
BeitragVerfasst: Fr 21.03.08 08:52 
Hi,

Damit wäre zwar das Problem des Treadstellers umgangen, hat denn aber keiner eine Lösung? Dass das ab und zu gebraucht werden könnte steht für mich außer Frage(z.B. bei Suche bei Google SCREENSHARING) :!:

mfG,

_________________
Centaur spears can block many spells, but no one tries to block if they see that the spell is a certain shade of green. For this purpose it is useful to know some green stunning hexes. (HPMoR)


Zuletzt bearbeitet von Hidden am Fr 21.03.08 10:03, insgesamt 1-mal bearbeitet
KleinesProgramm Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 21



BeitragVerfasst: Fr 21.03.08 09:36 
was ist screensharing?

p.s. ES FUNKTIONIERT!!! meine frage ist beantwortet,die antwort:

a)SetCursorPos (x,y);

um cursorzu verschieben

b)mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);

umzu klicken