urgently wanted

thank you for all in advance,

i want to know what is the corresponding command for SENDKEYS(in VB) in Delphi

VB               Delphi
-----------------------
Sendkeys         ????  
ams4380361Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
MadshiConnect With a Mentor Commented:
This one presses Ctrl-O:

keybd_event(VK_CONTROL, 0, 0,               0);
  keybd_event(ord('O'),  0, 0,               0);
  keybd_event(ord('O'),  0, KEYEVENTF_KEYUP, 0);
  keybd_event(VK_CONTROL, 0, KEYEVENTF_KEYUP, 0);

Regards, Madshi.
0
 
MadshiCommented:
I don't know SendKeys. What does it do? Look at keybd_event...

Regards, Madshi.
0
 
ams4380361Author Commented:
SENDKEYS enables you to simulate a keyboard (Virtual Key Board)
you can do what any body can do with real keyboard but within your code.

so it could be a kind of magic.

thank you.
0
Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

 
MadshiCommented:
Well, then use keybd_event, it simulates keyboard events at driver level. Should be exactly what you need...

Regards, Madshi.
0
 
ams4380361Author Commented:
i cant understand you.
please give me an example.


thank you.
0
 
TAZICommented:
Use the Events OnKeyPress, OnKeyDown to simulate keyboard events..

Look at Virutal Key Codes in Delphi Help.

Eg:) If you want to use the Escape key on the keyboard to exit your program then the code is as ffg:

On the Form's OnKeyDown event handler type in the following code:

if key = vk_Escape then
   exit;

run the program. Press the escape key and your program should close down.

Hope this is of some assitance to you
Regards
Tazi
0
 
ams4380361Author Commented:
i am sorry, but none of you can understand me.

i will give you an example:

* suppose i have programmed a notePad , and i want to press a button that :

1- writes segment of text as man do.
2- automatically, i want to see my menu opens and the SAVE menu item clicked , then after the appereance of SaveDialog , the programm will write the name of the file
3- press ok to save it.
4- press Alt-F4 to close my program


Notes:
//////////////////////
1-all of this must be within my code
2-i want to see every thing , excactly  when i do these things by myself.

this is the benefit of SENDKEYS command


THANK YOU FOR ALL....
REGARDS.





0
 
kretzschmarCommented:
why do you need this ?

well could be that in vb is no other possibility, but in delphi you can just save the file and terminate the app without emulating a user-access.

meikl
0
 
TAZICommented:
Hi..

I am still abit confused, but let me try to explain how I understand this.

for eg) You want to Press F1 to write the segment of text, Open the drop down menu and execute the save dialog box all by the click of just the F1 Key

Regards
Tazi
0
 
MadshiCommented:
This one pressed Ctrl + Escape.

  keybd_event(VK_CONTROL, 0, 0,               0);
  keybd_event(VK_ESCAPE,  0, 0,               0);
  keybd_event(VK_ESCAPE,  0, KEYEVENTF_KEYUP, 0);
  keybd_event(VK_CONTROL, 0, KEYEVENTF_KEYUP, 0);

This one pressed an "a" key:

  keybd_event(ord('A'), 0, 0,               0);
  keybd_event(ord('A'), 0, KEYEVENTF_KEYUP, 0);

Regards, Madshi.
0
 
TAZICommented:
Hi..

I am still abit confused, but let me try to explain how I understand this.

for eg) You want to Press F1 to write the segment of text, Open the drop down menu and execute the save dialog box all by the click of just the F1 Key

Regards
Tazi
0
 
ams4380361Author Commented:
THANK YOU FOR ALL.
Thank you Madshi , may i ask you how to make a combina
0
 
ams4380361Author Commented:
THANK YOU FOR ALL.
Thank you Madshi , may i ask you how to make a combination between another two keys like Alt-F or Ctrl-O

I would be gratefull if you send me the answer as soon as possible.
0
 
ams4380361Author Commented:
thank you very much Mr.Madshi .
In fact, you are very cooperative, but if possible can you tell me about the compination of Alt-F4
               Alt-F
               .....  
               .....  
               .....  
               .....  
               .....  
               .....  


                 
0
 
MadshiCommented:
 keybd_event(VK_MENU, 0, 0,               0);
  keybd_event(VK_F1,  0, 0,               0);
  keybd_event(VK_F1,  0, KEYEVENTF_KEYUP, 0);
  keybd_event(VK_MENU, 0, KEYEVENTF_KEYUP, 0);

0
 
MadshiCommented:
Change F1 with F4 of course...   :-)
0
 
ams4380361Author Commented:
Thank you very much.

Another Querstion if possible, 5 or 6 days ago, i have asked about how i can put a picture or image in a Moemo or EditBox or RichEdit so i can store, and retrieve it from DB.

if you have any Idea about this, please send me the Headline of this topic, and i prefer few line of code.


Best Regards

0
 
kretzschmarCommented:
madshi, go on ;-)
0
 
ams4380361Author Commented:
Thank you.
0
All Courses

From novice to tech pro — start learning today.