using ctrl+shift ,then enter

using ctrl+shift ,then enter in sendkeys.send

Page 1 of 1

2 Replies - 4445 Views - Last Post: 15 August 2008 - 06:54 PM Rate Topic: -----

#1 Hasyman  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 12-August 08

using ctrl+shift ,then enter

Posted 12 August 2008 - 08:18 PM

here's my code for my program

(just the button1_sub)

Private Sub btnnote_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnnote.Click


		Shell("notepad", AppWinStyle.NormalFocus)

		SendKeys.Send("example. ^(+{ENTER})")

	End Sub


and i need to know how to tell the sendkey method to hold the ctrl and shift button, then too press the enter button

ive tried alot of combinations but it always ends up doing ctrl, then enter or shift, then enter


Thank You

Is This A Good Question/Topic? 0
  • +

Replies To: using ctrl+shift ,then enter

#2 sired22  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 25
  • Joined: 09-August 08

Re: using ctrl+shift ,then enter

Posted 12 August 2008 - 08:34 PM

in your other post i posted code for the api. using this you can send any key

because the api needs yo be called for both press and release of the keys you should (not sure though) be able to use the api for special keys & combo's combined with sendkeys
Was This Post Helpful? 0
  • +
  • -

#3 gbertoli3  Icon User is offline

  • DIC at Heart + Code
  • member icon

Reputation: 40
  • View blog
  • Posts: 1,162
  • Joined: 23-June 08

Re: using ctrl+shift ,then enter

Posted 15 August 2008 - 06:54 PM

View PostHasyman, on 12 Aug, 2008 - 08:18 PM, said:

here's my code for my program

(just the button1_sub)

Private Sub btnnote_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnnote.Click


		Shell("notepad", AppWinStyle.NormalFocus)

		SendKeys.Send("example. ^(+{ENTER})")

	End Sub


and i need to know how to tell the sendkey method to hold the ctrl and shift button, then too press the enter button

ive tried alot of combinations but it always ends up doing ctrl, then enter or shift, then enter


Thank You


If you want it to be for the Click() event then use this code
Dim ctrl As Boolean = False
Dim shift As Boolean = False

Private Sub btnnote_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnnote.Click
If ctrl = True Then
	If shift = True Then	  
		If e.KeyCode = Keys.Enter Then
		Shell("notepad", AppWinStyle.NormalFocus)

		SendKeys.Send("example. ^(+{ENTER})")
		End If
	End If
End If

Private Sub form1_KeyDown(ByVal sender as System.Object, ByVal e as KeyEventArgs)
If e.KeyCode = Keys.Control Then
	ctrl = True
	If e.KeyCode = Keys.Shift Then
		shift = True
	End If
End If
End Sub



For the KeyDown() event use this code
Dim ctrl As Boolean = False
Dim shift As Boolean = False
If e.KeyCode = Keys.Control Then
	ctrl = True
	If e.KeyCode = Keys.Shift Then
		shift = True
	End If
End If
If ctrl = True Then
	If shift = True Then	  
		If e.KeyCode = Keys.Enter Then
		Shell("notepad", AppWinStyle.NormalFocus)

		SendKeys.Send("example. ^(+{ENTER})")
		End If
	End If
End If


Was This Post Helpful? 0
  • +
  • -

Page 1 of 1