-
Jul 3rd, 2006, 12:36 PM
#1
Thread Starter
Hyperactive Member
how can i use ctrl+esc in vb6?
can i ask a question?
how can i use ctrl+esc in vb6?
in my form i have image,label,and buttons.
do have any solutions
tnx!
-
Jul 3rd, 2006, 05:46 PM
#2
Re: how can i use ctrl+esc in vb6?
Moved from CodeBank forum (which is for code examples, not questions)
-
Jul 3rd, 2006, 07:09 PM
#3
Addicted Member
Re: how can i use ctrl+esc in vb6?
basti42,
Welcome to the forum.
Feel free to ask any question that you want.
We're all here to help, but I think we need a little more information.
What are you trying to do. Check for ctrl+esc or send the keys ? Pressing ctrl+esc normally brings up the start menu.
Keith_VB6
If you have any further questions, just ask.
If this solves things, then please mark the thread resolved.
[Thread Tools] --> [Mark Thread Resolved]
-
Jul 4th, 2006, 08:57 AM
#4
Thread Starter
Hyperactive Member
Re: how can i use ctrl+esc in vb6?
tnx to you Keith_VB6,
what i mean is i'm doing a project mini windows
that's why i'm asking how to code the ctrl+esc
pls. reply tnx.
-
Jul 4th, 2006, 09:59 AM
#5
Addicted Member
Re: how can i use ctrl+esc in vb6?
I'm still not sure what you mean. Please explain in more details. What do you mean by "code the ctrl+esc" ?
If you want to send CTRL-Escape then this code does that. Just add a command button.
VB Code:
'API declaration
Private Declare Sub keybd_event Lib "user32" _
(ByVal bVk As Byte, _
ByVal bScan As Byte, _
ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
'constants
Const VK_ESCAPE = &H1B
Const VK_CONTROL = &H11
Const VK_KeyDown = 1
Const VK_KeyUp = 3
Private Sub Command1_Click()
'Simulate Key Press
keybd_event VK_CONTROL, 0, VK_KeyDown, 0
keybd_event VK_ESCAPE,0, VK_KeyDown, 0
'Simulate Key Release
keybd_event VK_ESCAPE, 0, VK_KeyUp, 0
keybd_event VK_CONTROL,0, VK_KeyUp, 0
End Sub
Keith_VB6
If you have any further questions, just ask.
If this solves things, then please mark the thread resolved.
[Thread Tools] --> [Mark Thread Resolved]
-
Jul 4th, 2006, 10:42 AM
#6
Thread Starter
Hyperactive Member
Re: how can i use ctrl+esc in vb6?
tnx for your prompt reply
i have a project its a mini-windows
if i press ctrl+esc it will show the form.
-
Jul 4th, 2006, 03:26 PM
#7
Addicted Member
Re: how can i use ctrl+esc in vb6?
i have a project its a mini-windows
if i press ctrl+esc it will show the form.
I still don't understand. What do you need help doing ? Do you want the from to be displayed when you press CTRL-Escape ?
If that's what you want then do then do a search for "sethotkey". It involves sub-classing, which I have problems with. I usually crash the IDE. I use a sub-classing control that I got sooo long ago that I don't know where it came from.
A non-subclassing way would be to add a timer, interval set to a second or less. Check for the key and then show the form. And here's some sample code.
VB Code:
Option Explicit
Const VK_ESCAPE = &H1B
Const VK_SHIFT = &H10
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Sub Form_Load()
Me.Visible = False
End Sub
Private Sub Timer1_Timer()
If (GetAsyncKeyState(VK_SHIFT) = -32768) Then
If (GetAsyncKeyState(VK_ESCAPE) = -32768) Then
Me.Visible = True
End If
End If
End Sub
This code checks for shift+escape, because it doesn't trap the key like a hotkey, so if it was ctrl-escape the start menu would popup at the same time.
The hotkey would be a better approach, maybe someone else could post some code and then we would both learn. I know it takes RegisterHotKey(), UnRegisterHotkey(), CallWindowProc() and SetWindowLong(). But as I said earlier, sub-classing crashes for me.
Keith_VB6
If you have any further questions, just ask.
If this solves things, then please mark the thread resolved.
[Thread Tools] --> [Mark Thread Resolved]
-
Jul 4th, 2006, 11:28 PM
#8
Re: how can i use ctrl+esc in vb6?
Urgh. Yes, subclassing is a lot better.
We do have a servicable Search facility in these forums.
RegisterHotkey example
-
Jul 5th, 2006, 07:36 AM
#9
Thread Starter
Hyperactive Member
Re: how can i use ctrl+esc in vb6?
hello penagate!
the code is good, but could you give me an example that
instead of pressing ctr+shift+F10 replace it with ctrl+esc,
i tried but the start button of windows appears not
my application.
tnx!
-
Jul 5th, 2006, 07:40 AM
#10
Re: how can i use ctrl+esc in vb6?
Originally Posted by basti42
hello penagate!
the code is good, but could you give me an example that
instead of pressing ctr+shift+F10 replace it with ctrl+esc,
i tried but the start button of windows appears not
my application.
tnx!
Ctrl + Esc like ATl + Tab and CTR+ALT + Del is reserved for use by Operating System. It won't be a good idea to use Ctrl + Esc in your applications. Use some other key combination.
Use [code] source code here[/code] tags when you post source code.
My Articles
-
Jul 5th, 2006, 07:45 AM
#11
Re: how can i use ctrl+esc in vb6?
If Windows Explorer is not set as the desktop shell application then you should be able to use Ctrl+Esc. The only issue is that it is already registered by Explorer. Same with Alt+Tab. Ctrl+Alt+Del however is a low-level hotkey combination which is handled by the kernel, not the shell.
-
Jul 5th, 2006, 07:52 AM
#12
PowerPoster
Re: how can i use ctrl+esc in vb6?
Basti42, the code in Post#5 answers your question.
-
Jul 5th, 2006, 07:55 AM
#13
Thread Starter
Hyperactive Member
Re: how can i use ctrl+esc in vb6?
i already tried rory...
but still the start button of windows appears
tnx
-
Jul 5th, 2006, 08:00 AM
#14
PowerPoster
Re: how can i use ctrl+esc in vb6?
Originally Posted by basti42
i already tried rory...
but still the start button of windows appears
tnx
it will as stated by others .. it is reserved for that while in the Explorer.exe shell ..
-
Jul 5th, 2006, 08:08 AM
#15
Re: how can i use ctrl+esc in vb6?
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\Shell
If that value is "explorer.exe", you cannot use Ctrl+Esc. If it is not, you can, but you lose the desktop, taskbar, and task switcher.
Capeesh?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|