Recent

Author Topic: Sendkeys  (Read 28382 times)

conray

  • New Member
  • *
  • Posts: 19
    • http://www.conray.co.za
Sendkeys
« on: September 20, 2007, 01:47:18 pm »
how can i perform the sendkey function in lazarus  :lol:

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2582
RE: Sendkeys
« Reply #1 on: September 20, 2007, 05:56:41 pm »
not
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

antonio

  • Hero Member
  • *****
  • Posts: 605
RE: Sendkeys
« Reply #2 on: September 20, 2007, 05:59:06 pm »
Do you want to simulate keyboard? Why?

conray

  • New Member
  • *
  • Posts: 19
    • http://www.conray.co.za
Sendkeys
« Reply #3 on: September 20, 2007, 06:44:47 pm »
The reason why i need the sendkey to emulate the keyboard press is that instead of press the key board enter button a million times ,i can get it done via software or any other key on the keyboard


felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
RE: Sendkeys
« Reply #5 on: September 20, 2007, 09:25:38 pm »
You can use the Windows API SendMessage. Of course this will only work on Windows.

antonio

  • Hero Member
  • *****
  • Posts: 605
RE: Sendkeys
« Reply #6 on: September 20, 2007, 09:28:09 pm »
sekel: And which is the message, please?

conray

  • New Member
  • *
  • Posts: 19
    • http://www.conray.co.za
RE: Sendkeys
« Reply #7 on: September 20, 2007, 09:29:46 pm »
Sekel i need it to work in linux as well
:mrgreen:

antonio

  • Hero Member
  • *****
  • Posts: 605
RE: Sendkeys
« Reply #8 on: September 20, 2007, 09:31:44 pm »
Probably there is no way.

conray

  • New Member
  • *
  • Posts: 19
    • http://www.conray.co.za
RE: Sendkeys
« Reply #9 on: September 20, 2007, 09:36:07 pm »
is it possible to import .pas fle from delphi , if that is possible then it can be done
 :mrgreen:

antonio

  • Hero Member
  • *****
  • Posts: 605
RE: Sendkeys
« Reply #10 on: September 20, 2007, 09:38:18 pm »
Delphi implements this through Windows API.

conray

  • New Member
  • *
  • Posts: 19
    • http://www.conray.co.za
RE: Sendkeys
« Reply #11 on: September 20, 2007, 09:40:04 pm »
Thanks :)

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
RE: Sendkeys
« Reply #12 on: September 20, 2007, 10:20:13 pm »
It may be possible to do this using ifdefs. Use SendMessage on windows and a gtk function on linux. I have no idea which gtk function that would be, or even if there is one that does it.

antonio

  • Hero Member
  • *****
  • Posts: 605
RE: Sendkeys
« Reply #13 on: September 20, 2007, 10:21:48 pm »
sendmessage(handle, wm_close, 0, 0) ?

kris

  • Jr. Member
  • **
  • Posts: 59
Re: Sendkeys
« Reply #14 on: December 03, 2017, 06:22:59 am »
First of all, to all of you, but especially to: Marc and antonio:
PLEASE DO NOT say that something cannot be done just because you don't know how to do it!

Now, regarding the Linux part, I think the way to gou would be with gtk_main_do_event() from libgtk-x11-2.0.

The declaration in Lazarus would be:
  procedure gtk_main_do_event(GDKEvent : PGDKEvent); cdecl;external 'gtk-x11-2.0' name 'gtk_main_do_event';

The PGdkEvent type is declared in gdk2 unit;

The documentation mentions the call here: https://developer.gnome.org/gtk3/stable/gtk3-General.html#gtk-main-do-event

and someone has a code snipped on using it for sending key event (although not in Lazarus) here: https://mail.gnome.org/archives/gtk-app-devel-list/2004-July/msg00016.html

Btw, I just myself am tyring to implement this, and googled out this thread. People who comment on things not being possible without actually knowing, or questioning the asker's reason for wanting to do something in the first place ARE NOT HELPFUL !

 

TinyPortal © 2005-2018