Autor Beitrag
FragSalat
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 24



BeitragVerfasst: Mi 10.06.09 20:45 
hi leutz ich hab ma ne frage wie kann ich eine tasten kombination wie strg+o an ein programm senden ...

ich kann einzelne tasten senden aber keine kombis auch nicht mit
keydown strg
keydown o
keyup o
keyup strg

sowohl mit der Keys klasse als auch mit den Virtual Keys hats nicht geklappt

bitte um hilfe


Moderiert von user profile iconKha: Topic aus Windows API verschoben am Do 11.06.2009 um 19:20
Xentar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2077
Erhaltene Danke: 2

Win XP
Delphi 5 Ent., Delphi 2007 Prof
BeitragVerfasst: Mi 10.06.09 20:58 
Zeig mal bitte den Code, wie du es bisher probiert hast.

_________________
PROGRAMMER: A device for converting coffee into software.
FragSalat Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 24



BeitragVerfasst: Mi 10.06.09 21:56 
verzeihung mir ist grade jetzt erst aufgefallen das ich im falschen forum bin ich wollte ins csharp forum^^

naja vllt moved das ja nen mod mal

hier jedenfalls mein code

ausblenden C#-Quelltext
1:
2:
3:
4:
                WinApi.SendKey(hWnd, WM_KEYDOWN, VK_CTRL);
                WinApi.SendKey(hWnd, WM_KEYDOWN, VK_O);
                WinApi.SendKey(hWnd, WM_KEYUP, VK_O);
                WinApi.SendKey(hWnd, WM_KEYUP, VK_CTRL);


und meine senkey methode ist so gemacht

ausblenden C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
        [DllImport("user32.dll", SetLastError = true)]
        static extern bool PostMessage( IntPtr hWnd, uint msg, uint wParam,
            long lParam );

        public static void SendKey(IntPtr hWnd, uint msg, uint key)
        {
            PostMessage(hWnd, msg, key, 0);
        }
Marc.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1876
Erhaltene Danke: 129

Win 8.1, Xubuntu 15.10

BeitragVerfasst: Mi 10.06.09 22:33 
Hey!

Ich denke in diesem Falle musst du wohl das keydb_event verwenden. Beispiele findest Du hier im Forum.

Grüße
Xentar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2077
Erhaltene Danke: 2

Win XP
Delphi 5 Ent., Delphi 2007 Prof
BeitragVerfasst: Mi 10.06.09 23:13 
Ok, C# ist nicht ganz mein Ding.
Aber vielleicht hilft es, zwischen den "Tastendrücken" eine Pause einzubauen?

_________________
PROGRAMMER: A device for converting coffee into software.
FragSalat Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 24



BeitragVerfasst: Do 11.06.09 21:26 
also ne pause bringt nicht das ergebnis was ich wollte
ich hab das mal auf sleep 5000 gesetzt und es kam raus was ich erwartet hab er drückt sozusagen strg einmal dann o und bei keyup das selbe nochmal 5 sek später
FragSalat Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 24



BeitragVerfasst: Fr 12.06.09 18:45 
also ich hab mal geguckt und nix zu keydb_event im forum gefunden

hat keiner ne antwort drauf wie man ne tasten kombi sendet???
habs mal probiert mit mausklicks zu senden aber ging auch nicht so gut^^