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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
MadshiCommented:
Well, then use keybd_event, it simulates keyboard events at driver level. Should be exactly what you need...

Regards, Madshi.
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

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
MadshiCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.