473,405 Members | 2,344 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

how to cal window+button programmatically

I want to cal window button using sendkeys.send() method. I have tried with sendkeys.send("{WIN}") and sendkeys.send("{Lwin}"). but not working..
Can you help me
Nov 26 '09 #1
10 8764
tlhintoq
3,525 Expert 2GB
"How to cal" ??
What do you mean by "cal" ?

Are you trying to press the Windows key programmatically?
I don't see as the Windows key is part of the SendKeys methods on the MSDN.

Are you trying to send Win+L for lockworkstation?
Expand|Select|Wrap|Line Numbers
  1. Process.Start("rundll32.exe", "user32.dll,LockWorkStation");
Nov 26 '09 #2
I created client-server application. In that, if I press windows key in server side that should be triggered programmatically at the client end. I want to know how to invoke that key press at client end using send-key methods.
Nov 30 '09 #3
debasisdas
8,127 Expert 4TB
You can't handle windows key.
Nov 30 '09 #4
!NoItAll
297 100+
You can't handle it, but you can react to it.

Expand|Select|Wrap|Line Numbers
  1.     Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
  2.         If e.keyvalue = 91 Then
  3.             'the windows key has been pressed
  4.         End If
  5.  
  6.     End Sub
  7.  
The key still gets handled by windows. You can not suppress it, or cancel it, but you can have code in your program do something when it is pressed.

If you want to send it you can send it with SendKeys.send(key.lwin) - which sends the left windows key to the application with the current focus - but apparently does NOT send it to the OS because I have been unable to get Windows to react to it. I may be doing something wrong though...

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  3.  
  4.         AppActivate("Some Unsuspecting Application")
  5.         SendKeys.Send(Keys.LWin)
  6.  
  7.     End Sub
  8.  
Nov 30 '09 #5
tlhintoq
3,525 Expert 2GB
I created client-server application. In that, if I press windows key in server side that should be triggered programmatically at the client end. I want to know how to invoke that key press at client end using send-key methods.
Maybe the answer is concentrate on *why* you want to send the Windows key. Sending the Windows key is a means to an end. What is the end goal you are trying to achieve. There may be another way to do it. For example in the LockWorkstation example you don't send Windows-L, but you can call the LockWorkstation WinAPI call. So what are you trying to do by sending the Windows key?
Nov 30 '09 #6
!NoItAll
297 100+
I concur with tlhintoq, it seems like sendkeys is just the wrong approach for what you may want to do. Let us know more about what you want to do and someone may be able to suggest a workable solution for you.
Windows API's aren't all that scary ....
Nov 30 '09 #7
Just I want to invoke the following keys like win+d,win+E and other so that I need..... Is there any another way?
Dec 1 '09 #8
!NoItAll
297 100+
Newbie:
We already know that. It won't help for you to ask the same question over and over again without answering any of ours! Tells us more about what it is you want to do. Win+E brings up an explorer panel - that's easy to do without trying to stuff keystrokes into the system.
Dec 1 '09 #9
tlhintoq
3,525 Expert 2GB
Just I want to invoke the following keys like win+d,win+E and other so that I need..... Is there any another way?
Yes. There are other ways to do things you are wanting to do. Don't get tunnel vision. You are so focused on sending a Windows key that you are not looking for other methods or reading the tips given to you.

Win+L gives you a lockworkstation and you have been given a method for that.

You want to do a Win+E for Windows explorer.
Expand|Select|Wrap|Line Numbers
  1. Process.Start("explorer.exe", locationToOpen.Text);
Try searching for your actual goals ("C# Open WIndows Explorer") instead of what you think is the only method.
Dec 1 '09 #10
Thank you for your kind response.....
Dec 2 '09 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: black | last post by:
Howdy~ i am with Win2k and had built a window with Tkinter, it has 3 button on its topright corner as common window, but what i want is just one or tow of them. ie, is there any way i can...
2
by: black | last post by:
Howdy~ i am with Win2k and had built a window with Tkinter, it has 3 button on its topright corner as common window, but what i want is just one or tow of them. ie, is there any way i can...
2
by: William Gill | last post by:
I am trying to make a simple data editor in Tkinter where each data element has a corresponding Entry widget. I have tried to use the FocusIn/FocusOut events to set a 'hasChanged' flag (if a...
4
by: ...D. | last post by:
OK. I am halfway decent with HTML. Now I want to try javascript for some things that HTML cannot do. I have looked over a tutorial & all. What I want to do is create a button, that when...
1
by: Damien Kay | last post by:
Hi, Is there a way of disabling the close window, minimise and maximise buttons on a webform? Thanks, Damien.
5
by: Nathan Sokalski | last post by:
How do I open and change properties of (such as size, position, scroll position, visibility of toolbars, etc.) a browser window? Thanks. -- Nathan Sokalski njsokalski@hotmail.com...
6
by: rakesh_nits | last post by:
Hi All, I want to close a directory which is being opened.what i have is only the path of the directory.How can i emulate clicking the close button on this window programmatically.Thanks in...
1
by: askarnice | last post by:
How to Refresh a page on Back button. Cannot be refresh on click back button . How we can solve this problem pleae Reply
1
by: King Coffee | last post by:
Hi, I popupped a new asp.net window. Within it I want to display an explicit close button. How .Net object can I call to close this popup window programmatically? King
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.