16,012,223 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View .NET questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Member 10993529 (Top 8 by date)
Member 10993529
19-Aug-14 12:48pm
View
Sergey, thanks for your input!
Your comment "Apparently, you don't have a feel what is complete code" is totally true. As a beginner in this field it seems that I am learning by trial and error... which can be very frustrating.
I will follow your last suggestion and rebuild the whole project, step by step. Hopefully I will learn some things along the way.
I need to get past this trial and error phase. Is there a good in-depth book that you could recommend? It seems like a book would be a much better way to learn this than by looking at several different sources of information via the Internet.
Thanks very much Sergey!
Member 10993529
19-Aug-14 9:06am
View
Sergey, as it doesn't seem possible to upload files, I've started a post at VBForums.net on this topic. If you have time, it would be great if you could look at it.
http://www.vbforums.com/showthread.php?773987-Having-difficulty-with-Keyboard-Hooks-Hotkeys
Member 10993529
18-Aug-14 19:55pm
View
Thanks for helping me Sergey. Tomorrow I will post the complete project file. It is clear that I'm making a mistake somewhere. If you have time, please take a look at the project file later.
Member 10993529
18-Aug-14 19:38pm
View
When the MainForm is not minimized, and the key combination occurs, the debugger stops on that line.
When the MainForm is minimized, and the key combination occurs, the debugger doesn't get to that line.
Member 10993529
18-Aug-14 19:26pm
View
Sergey, I'm very much a beginner programmer, so please bear with me :) .
With the debugger running and the MainForm NOT minimized, the following callstack info comes up when I press the Ctrl + Alt + Shift + K key combination:
Callstack
MainForm.WndProc
With the debugger running and the MainForm MINIMIZED, no callstack info comes up when I press the Ctrl + Alt + Shift + K key combination
Perhaps this information is a clue as to what the problem might be?
Member 10993529
18-Aug-14 18:37pm
View
Yes, with debugger!
I added Form2 to the project, just to see if the problem was something to do with the fact that it was a message box.
When I make the key combination Ctrl+Alt+Shift+K (when the app is minimized) Form2 does not show.
But, when I make the key combination when the app is not minimized Form2 shows.
Member 10993529
18-Aug-14 18:30pm
View
I can't get it to work. Adding the breakpoint also doesn't seem to change the outcome. In my original post, I included this code below:
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
If m.Msg = WM_HOTKEY Then
Dim id As IntPtr = m.WParam
Select Case (id.ToString)
Case "100"
MsgBox("Ctrl + Alt + Shift + K was pressed")
End Select
End If
MyBase.WndProc(m)
End Sub
Please add a second form to the app called Form2.
Replace the MsgBox line in the code above with: Form2.Show()
If I do this, I get the following results:
With the app mainform not minimized, the key combination causes Form2 to display
but...
With the app main form minimized to the systray, the key combination does not cause Form2 to display.
Sergey, if you are able to show Form2 when the mainform is minimized, could you post your code? Perhaps I am overlooking a mistake that you (as someone with more experienced) corrected?
Member 10993529
18-Aug-14 16:54pm
View
Hello Sergey! I also originally thought that a global hook would be overkill, but RegisterHotKey doesn't seem to work(at least not as shown in the code posted). When the app is minimized, the key combination produces no result.
Yes, I did use the NotifyIcon.
To duplicate the problem, please follow these steps:
Copy the code found in the question into a new VB project.
Add a form called MainForm.
Add a context menu strip called contextMenuStrip1.
Add a notify icon called notifyIcon1.
Be sure to bind the notifyIcon1 to the contextMenuStrip1.
When the app is **not minimized** a message box with "Ctrl + Alt + Shift + K was pressed" will appear. But when the app **is minimized** to the systray, nothing happens. I don't think its a matter of the msgbox. If I alter the code to display a different icon when the key combination is triggered, the same problem occurs: no reaction when app is in the systray.
So, to me it looks like a global key is the only thing that will work. :)
Show More