TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Santosh Gurav
1.5k
253
971
Reading Keystrokes Using Windows Service
Oct 16 2018 11:34 AM
Hi Techies,
I have some applications which I want to launch when user presses specific keys from the keyboard, and for this I want to use WndProc method.
I am successful in this in a WinForms application. I want to develop a Windows Service to achieve this.
I get the following errors while trying to use the code in a Windows Service.
1. RegHotKeys.CreateParams : no suitable method found to override
2. RegHotKeys.WndProc(ref Message) : no suitable method found to override
3. ServiceBase does not contain a definition for WndProc
4. ServiceBase does not contain a definition for CreateParams
Following is the code snippet:
protected
override
void
WndProc(
ref
Message keyPressed)
{
Keys keyData = ((Keys)((
int
)((
long
)keyPressed.WParam))) | Control.ModifierKeys;
if
(keyPressed.LParam.ToInt32() == hotKey1)
{
//ACTION 1
}
else
if
(keyPressed.LParam.ToInt32() == hotKey2)
{
//ACTION 2
}
else
if
(keyPressed.LParam.ToInt32() == hotKey3)
{
//ACTION 3
}
else
if
(keyPressed.LParam.ToInt32() == hotKey4)
{
//ACTION 4
}
base
.WndProc(
ref
keyPressed);
}
protected
override
CreateParams CreateParams
{
get
{
var cp =
base
.CreateParams;
cp.ExStyle |= 0x80;
// Turn on WS_EX_TOOLWINDOW
return
cp;
}
}
So can anybody suggest what could be the possible solution to this please?
Reply
Answers (
0
)
Hello all, Related to WPF
Howcreate calculate column usingfour multifulcolumns powerbi