Programming productivity: How to hide cursor while typing
Whenever I click somewhere to type some code, by definition that's exactly where my mouse cursor is, which is obscuring what I'm trying to type. Often, if I forget to move the cursor away before starting to type, I'll find myself moving my hand from my keyboard back to my mouse just to move the cursor out of the way and then go back to typing.
I know that there is an OS-level "hide cursor while typing" option, but that seems to have no effect in Visual Studio.
Also, I know of utilites that can run constantly in the background (I.e. CursorHider), but, for stability reasons, I'm hesistant to run yet another background service on top of the many that are already running.
Is there a solution?
windows keyboard productivity visual-studio cursor
migrated from stackoverflow.com Oct 12 '09 at 2:40
This question came from our site for professional and enthusiast programmers.
add a comment |
Whenever I click somewhere to type some code, by definition that's exactly where my mouse cursor is, which is obscuring what I'm trying to type. Often, if I forget to move the cursor away before starting to type, I'll find myself moving my hand from my keyboard back to my mouse just to move the cursor out of the way and then go back to typing.
I know that there is an OS-level "hide cursor while typing" option, but that seems to have no effect in Visual Studio.
Also, I know of utilites that can run constantly in the background (I.e. CursorHider), but, for stability reasons, I'm hesistant to run yet another background service on top of the many that are already running.
Is there a solution?
windows keyboard productivity visual-studio cursor
migrated from stackoverflow.com Oct 12 '09 at 2:40
This question came from our site for professional and enthusiast programmers.
Nice question for superuser.com. :-)
– Franci Penov
Oct 12 '09 at 2:10
Well, you could use a mac...
– dmckee
Oct 12 '09 at 2:40
For me, moving the mouse away is a reflex I don't even think about. (that is, until I stopped using regular editors and started using vim)
– hasen
Oct 12 '09 at 7:08
add a comment |
Whenever I click somewhere to type some code, by definition that's exactly where my mouse cursor is, which is obscuring what I'm trying to type. Often, if I forget to move the cursor away before starting to type, I'll find myself moving my hand from my keyboard back to my mouse just to move the cursor out of the way and then go back to typing.
I know that there is an OS-level "hide cursor while typing" option, but that seems to have no effect in Visual Studio.
Also, I know of utilites that can run constantly in the background (I.e. CursorHider), but, for stability reasons, I'm hesistant to run yet another background service on top of the many that are already running.
Is there a solution?
windows keyboard productivity visual-studio cursor
Whenever I click somewhere to type some code, by definition that's exactly where my mouse cursor is, which is obscuring what I'm trying to type. Often, if I forget to move the cursor away before starting to type, I'll find myself moving my hand from my keyboard back to my mouse just to move the cursor out of the way and then go back to typing.
I know that there is an OS-level "hide cursor while typing" option, but that seems to have no effect in Visual Studio.
Also, I know of utilites that can run constantly in the background (I.e. CursorHider), but, for stability reasons, I'm hesistant to run yet another background service on top of the many that are already running.
Is there a solution?
windows keyboard productivity visual-studio cursor
windows keyboard productivity visual-studio cursor
edited Aug 21 '11 at 7:34
studiohack♦
11.3k1880113
11.3k1880113
asked Oct 12 '09 at 1:52
Adam KaneAdam Kane
73741429
73741429
migrated from stackoverflow.com Oct 12 '09 at 2:40
This question came from our site for professional and enthusiast programmers.
migrated from stackoverflow.com Oct 12 '09 at 2:40
This question came from our site for professional and enthusiast programmers.
Nice question for superuser.com. :-)
– Franci Penov
Oct 12 '09 at 2:10
Well, you could use a mac...
– dmckee
Oct 12 '09 at 2:40
For me, moving the mouse away is a reflex I don't even think about. (that is, until I stopped using regular editors and started using vim)
– hasen
Oct 12 '09 at 7:08
add a comment |
Nice question for superuser.com. :-)
– Franci Penov
Oct 12 '09 at 2:10
Well, you could use a mac...
– dmckee
Oct 12 '09 at 2:40
For me, moving the mouse away is a reflex I don't even think about. (that is, until I stopped using regular editors and started using vim)
– hasen
Oct 12 '09 at 7:08
Nice question for superuser.com. :-)
– Franci Penov
Oct 12 '09 at 2:10
Nice question for superuser.com. :-)
– Franci Penov
Oct 12 '09 at 2:10
Well, you could use a mac...
– dmckee
Oct 12 '09 at 2:40
Well, you could use a mac...
– dmckee
Oct 12 '09 at 2:40
For me, moving the mouse away is a reflex I don't even think about. (that is, until I stopped using regular editors and started using vim)
– hasen
Oct 12 '09 at 7:08
For me, moving the mouse away is a reflex I don't even think about. (that is, until I stopped using regular editors and started using vim)
– hasen
Oct 12 '09 at 7:08
add a comment |
4 Answers
4
active
oldest
votes
Like you, I've had this problem forever. So I have written a little script that hides the mouse cursor no matter what Windows application you are using.
Note that if you run Visual Studio (or anything) in elevated mode, you'll need to run my utility also in elevated mode.
I have doubts whether such a forceful method is correct in all situations. The cursor's disappearing whenever any key is typed can for example be very annoying with games.
– harrymc
Jan 8 '14 at 7:06
In that case you can just unload it during a game... that said, I believe most games implement their own cursor
– Stefan Z Camilleri
Feb 23 '14 at 15:15
Windows-Cursor-Hider works good so far. I was looking for something simple like a AHK script. Thanks @StefanZCamilleri!
– russds
Feb 8 '16 at 20:21
add a comment |
It seems like the functionality of "hide pointer while typing" depends on the application.
This option is ticked in my mouse's pointer options, and does work for applications such as notepad, wordpad, Word and Visual Studio 6. But it doesn't work for other applications, like Firefox and Visual Studio 2008.
I believe that the applications where this doesn't work are wrongly programmed to show the cursor repeatedly. As a programmer, I can tell you that programming the cursor in Windows is a big mess, where finally the only way to keep sane is to repeatedly reconstitute the cursor upon certain events. Evidently, the programmers behind Visual Studio 2008 have taken the same shortcuts.
This is an incorrect assumption though, since if you hide the cursor at an OS level, it will remain hidden, voiding the idea of forcing the cursor to show (which would override it) - pls see my answer below
– Stefan Z Camilleri
Jan 7 '14 at 22:41
add a comment |
I know this isn't probably a viable solution for you but I like to not use the mouse at all by having key bindings for everything within the IDE. I can jump from pane to pane, error to error etc without having to touch the mouse. Also if your classes are nice and small, you won't have to be scrolling up and down classes too much (and even if you had to the arrow keys would suffice).
add a comment |
You can avoid the "hide pointer while typing" with catching the EN_UPDATE in WndProc of parent window of edit control, and setting the cursor position:
void CreateEdit( HWND hWnd )
{
WNDCLASSEX wndClass;
memset( &wndClass, 0, sizeof( wndClass ) );
wndClass.cbSize = sizeof( wndClass );
wndClass.style = CS_SAVEBITS;
wndClass.lpfnWndProc = WndProcEditParent;
wndClass.cbClsExtra = 0;
wndClass.cbWndExtra = 0;
wndClass.hInstance = GetModuleHandle( NULL );
wndClass.hIcon = NULL;
wndClass.hCursor = NULL;
wndClass.hbrBackground = NULL;
wndClass.lpszMenuName = NULL;
wndClass.lpszClassName = L"EditParent";
RegisterClassEx( &wndClass );
HWND hWndEditParent = CreateWindowEx( 0
, L"EditParent"
, L""
, WS_CHILD | WS_BORDER
, 0
, 0
, 0
, 0
, hWnd
, NULL
, GetModuleHandle( NULL )
, 0 );
HWND hWndEdit = CreateWindowEx( 0
, L"Edit"
, L""
, WS_CHILD
, 0
, 0
, 0
, 0
, hWndEditParent
, NULL
, GetModuleHandle( NULL )
, 0 );
...
}
LRESULT CALLBACK Edit::WndProcEditParent( HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam )
{
switch( iMessage )
{
...
case WM_COMMAND:
if( HIWORD( wParam ) == EN_UPDATE )
{
// this is the hack to avoid "hide pointer while typing"
POINT point;
GetCursorPos( &point );
SetCursorPos( point.x, point.y );
}
break;
...
}
return DefWindowProc( hWnd, iMessage, wParam, lParam );
}
1
This might be a really great answer, but I have no idea how to use it. Please add an explanation. Do not respond in comments; edit your answer to make it clearer and more complete.
– G-Man
Dec 18 '18 at 18:47
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f54147%2fprogramming-productivity-how-to-hide-cursor-while-typing%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
Like you, I've had this problem forever. So I have written a little script that hides the mouse cursor no matter what Windows application you are using.
Note that if you run Visual Studio (or anything) in elevated mode, you'll need to run my utility also in elevated mode.
I have doubts whether such a forceful method is correct in all situations. The cursor's disappearing whenever any key is typed can for example be very annoying with games.
– harrymc
Jan 8 '14 at 7:06
In that case you can just unload it during a game... that said, I believe most games implement their own cursor
– Stefan Z Camilleri
Feb 23 '14 at 15:15
Windows-Cursor-Hider works good so far. I was looking for something simple like a AHK script. Thanks @StefanZCamilleri!
– russds
Feb 8 '16 at 20:21
add a comment |
Like you, I've had this problem forever. So I have written a little script that hides the mouse cursor no matter what Windows application you are using.
Note that if you run Visual Studio (or anything) in elevated mode, you'll need to run my utility also in elevated mode.
I have doubts whether such a forceful method is correct in all situations. The cursor's disappearing whenever any key is typed can for example be very annoying with games.
– harrymc
Jan 8 '14 at 7:06
In that case you can just unload it during a game... that said, I believe most games implement their own cursor
– Stefan Z Camilleri
Feb 23 '14 at 15:15
Windows-Cursor-Hider works good so far. I was looking for something simple like a AHK script. Thanks @StefanZCamilleri!
– russds
Feb 8 '16 at 20:21
add a comment |
Like you, I've had this problem forever. So I have written a little script that hides the mouse cursor no matter what Windows application you are using.
Note that if you run Visual Studio (or anything) in elevated mode, you'll need to run my utility also in elevated mode.
Like you, I've had this problem forever. So I have written a little script that hides the mouse cursor no matter what Windows application you are using.
Note that if you run Visual Studio (or anything) in elevated mode, you'll need to run my utility also in elevated mode.
edited Jan 7 '14 at 21:36
Jawa
3,14982435
3,14982435
answered Jan 7 '14 at 21:16
Stefan Z CamilleriStefan Z Camilleri
16613
16613
I have doubts whether such a forceful method is correct in all situations. The cursor's disappearing whenever any key is typed can for example be very annoying with games.
– harrymc
Jan 8 '14 at 7:06
In that case you can just unload it during a game... that said, I believe most games implement their own cursor
– Stefan Z Camilleri
Feb 23 '14 at 15:15
Windows-Cursor-Hider works good so far. I was looking for something simple like a AHK script. Thanks @StefanZCamilleri!
– russds
Feb 8 '16 at 20:21
add a comment |
I have doubts whether such a forceful method is correct in all situations. The cursor's disappearing whenever any key is typed can for example be very annoying with games.
– harrymc
Jan 8 '14 at 7:06
In that case you can just unload it during a game... that said, I believe most games implement their own cursor
– Stefan Z Camilleri
Feb 23 '14 at 15:15
Windows-Cursor-Hider works good so far. I was looking for something simple like a AHK script. Thanks @StefanZCamilleri!
– russds
Feb 8 '16 at 20:21
I have doubts whether such a forceful method is correct in all situations. The cursor's disappearing whenever any key is typed can for example be very annoying with games.
– harrymc
Jan 8 '14 at 7:06
I have doubts whether such a forceful method is correct in all situations. The cursor's disappearing whenever any key is typed can for example be very annoying with games.
– harrymc
Jan 8 '14 at 7:06
In that case you can just unload it during a game... that said, I believe most games implement their own cursor
– Stefan Z Camilleri
Feb 23 '14 at 15:15
In that case you can just unload it during a game... that said, I believe most games implement their own cursor
– Stefan Z Camilleri
Feb 23 '14 at 15:15
Windows-Cursor-Hider works good so far. I was looking for something simple like a AHK script. Thanks @StefanZCamilleri!
– russds
Feb 8 '16 at 20:21
Windows-Cursor-Hider works good so far. I was looking for something simple like a AHK script. Thanks @StefanZCamilleri!
– russds
Feb 8 '16 at 20:21
add a comment |
It seems like the functionality of "hide pointer while typing" depends on the application.
This option is ticked in my mouse's pointer options, and does work for applications such as notepad, wordpad, Word and Visual Studio 6. But it doesn't work for other applications, like Firefox and Visual Studio 2008.
I believe that the applications where this doesn't work are wrongly programmed to show the cursor repeatedly. As a programmer, I can tell you that programming the cursor in Windows is a big mess, where finally the only way to keep sane is to repeatedly reconstitute the cursor upon certain events. Evidently, the programmers behind Visual Studio 2008 have taken the same shortcuts.
This is an incorrect assumption though, since if you hide the cursor at an OS level, it will remain hidden, voiding the idea of forcing the cursor to show (which would override it) - pls see my answer below
– Stefan Z Camilleri
Jan 7 '14 at 22:41
add a comment |
It seems like the functionality of "hide pointer while typing" depends on the application.
This option is ticked in my mouse's pointer options, and does work for applications such as notepad, wordpad, Word and Visual Studio 6. But it doesn't work for other applications, like Firefox and Visual Studio 2008.
I believe that the applications where this doesn't work are wrongly programmed to show the cursor repeatedly. As a programmer, I can tell you that programming the cursor in Windows is a big mess, where finally the only way to keep sane is to repeatedly reconstitute the cursor upon certain events. Evidently, the programmers behind Visual Studio 2008 have taken the same shortcuts.
This is an incorrect assumption though, since if you hide the cursor at an OS level, it will remain hidden, voiding the idea of forcing the cursor to show (which would override it) - pls see my answer below
– Stefan Z Camilleri
Jan 7 '14 at 22:41
add a comment |
It seems like the functionality of "hide pointer while typing" depends on the application.
This option is ticked in my mouse's pointer options, and does work for applications such as notepad, wordpad, Word and Visual Studio 6. But it doesn't work for other applications, like Firefox and Visual Studio 2008.
I believe that the applications where this doesn't work are wrongly programmed to show the cursor repeatedly. As a programmer, I can tell you that programming the cursor in Windows is a big mess, where finally the only way to keep sane is to repeatedly reconstitute the cursor upon certain events. Evidently, the programmers behind Visual Studio 2008 have taken the same shortcuts.
It seems like the functionality of "hide pointer while typing" depends on the application.
This option is ticked in my mouse's pointer options, and does work for applications such as notepad, wordpad, Word and Visual Studio 6. But it doesn't work for other applications, like Firefox and Visual Studio 2008.
I believe that the applications where this doesn't work are wrongly programmed to show the cursor repeatedly. As a programmer, I can tell you that programming the cursor in Windows is a big mess, where finally the only way to keep sane is to repeatedly reconstitute the cursor upon certain events. Evidently, the programmers behind Visual Studio 2008 have taken the same shortcuts.
answered Oct 12 '09 at 8:02
harrymcharrymc
255k14265565
255k14265565
This is an incorrect assumption though, since if you hide the cursor at an OS level, it will remain hidden, voiding the idea of forcing the cursor to show (which would override it) - pls see my answer below
– Stefan Z Camilleri
Jan 7 '14 at 22:41
add a comment |
This is an incorrect assumption though, since if you hide the cursor at an OS level, it will remain hidden, voiding the idea of forcing the cursor to show (which would override it) - pls see my answer below
– Stefan Z Camilleri
Jan 7 '14 at 22:41
This is an incorrect assumption though, since if you hide the cursor at an OS level, it will remain hidden, voiding the idea of forcing the cursor to show (which would override it) - pls see my answer below
– Stefan Z Camilleri
Jan 7 '14 at 22:41
This is an incorrect assumption though, since if you hide the cursor at an OS level, it will remain hidden, voiding the idea of forcing the cursor to show (which would override it) - pls see my answer below
– Stefan Z Camilleri
Jan 7 '14 at 22:41
add a comment |
I know this isn't probably a viable solution for you but I like to not use the mouse at all by having key bindings for everything within the IDE. I can jump from pane to pane, error to error etc without having to touch the mouse. Also if your classes are nice and small, you won't have to be scrolling up and down classes too much (and even if you had to the arrow keys would suffice).
add a comment |
I know this isn't probably a viable solution for you but I like to not use the mouse at all by having key bindings for everything within the IDE. I can jump from pane to pane, error to error etc without having to touch the mouse. Also if your classes are nice and small, you won't have to be scrolling up and down classes too much (and even if you had to the arrow keys would suffice).
add a comment |
I know this isn't probably a viable solution for you but I like to not use the mouse at all by having key bindings for everything within the IDE. I can jump from pane to pane, error to error etc without having to touch the mouse. Also if your classes are nice and small, you won't have to be scrolling up and down classes too much (and even if you had to the arrow keys would suffice).
I know this isn't probably a viable solution for you but I like to not use the mouse at all by having key bindings for everything within the IDE. I can jump from pane to pane, error to error etc without having to touch the mouse. Also if your classes are nice and small, you won't have to be scrolling up and down classes too much (and even if you had to the arrow keys would suffice).
answered Oct 12 '09 at 1:58
digiarniedigiarnie
1112
1112
add a comment |
add a comment |
You can avoid the "hide pointer while typing" with catching the EN_UPDATE in WndProc of parent window of edit control, and setting the cursor position:
void CreateEdit( HWND hWnd )
{
WNDCLASSEX wndClass;
memset( &wndClass, 0, sizeof( wndClass ) );
wndClass.cbSize = sizeof( wndClass );
wndClass.style = CS_SAVEBITS;
wndClass.lpfnWndProc = WndProcEditParent;
wndClass.cbClsExtra = 0;
wndClass.cbWndExtra = 0;
wndClass.hInstance = GetModuleHandle( NULL );
wndClass.hIcon = NULL;
wndClass.hCursor = NULL;
wndClass.hbrBackground = NULL;
wndClass.lpszMenuName = NULL;
wndClass.lpszClassName = L"EditParent";
RegisterClassEx( &wndClass );
HWND hWndEditParent = CreateWindowEx( 0
, L"EditParent"
, L""
, WS_CHILD | WS_BORDER
, 0
, 0
, 0
, 0
, hWnd
, NULL
, GetModuleHandle( NULL )
, 0 );
HWND hWndEdit = CreateWindowEx( 0
, L"Edit"
, L""
, WS_CHILD
, 0
, 0
, 0
, 0
, hWndEditParent
, NULL
, GetModuleHandle( NULL )
, 0 );
...
}
LRESULT CALLBACK Edit::WndProcEditParent( HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam )
{
switch( iMessage )
{
...
case WM_COMMAND:
if( HIWORD( wParam ) == EN_UPDATE )
{
// this is the hack to avoid "hide pointer while typing"
POINT point;
GetCursorPos( &point );
SetCursorPos( point.x, point.y );
}
break;
...
}
return DefWindowProc( hWnd, iMessage, wParam, lParam );
}
1
This might be a really great answer, but I have no idea how to use it. Please add an explanation. Do not respond in comments; edit your answer to make it clearer and more complete.
– G-Man
Dec 18 '18 at 18:47
add a comment |
You can avoid the "hide pointer while typing" with catching the EN_UPDATE in WndProc of parent window of edit control, and setting the cursor position:
void CreateEdit( HWND hWnd )
{
WNDCLASSEX wndClass;
memset( &wndClass, 0, sizeof( wndClass ) );
wndClass.cbSize = sizeof( wndClass );
wndClass.style = CS_SAVEBITS;
wndClass.lpfnWndProc = WndProcEditParent;
wndClass.cbClsExtra = 0;
wndClass.cbWndExtra = 0;
wndClass.hInstance = GetModuleHandle( NULL );
wndClass.hIcon = NULL;
wndClass.hCursor = NULL;
wndClass.hbrBackground = NULL;
wndClass.lpszMenuName = NULL;
wndClass.lpszClassName = L"EditParent";
RegisterClassEx( &wndClass );
HWND hWndEditParent = CreateWindowEx( 0
, L"EditParent"
, L""
, WS_CHILD | WS_BORDER
, 0
, 0
, 0
, 0
, hWnd
, NULL
, GetModuleHandle( NULL )
, 0 );
HWND hWndEdit = CreateWindowEx( 0
, L"Edit"
, L""
, WS_CHILD
, 0
, 0
, 0
, 0
, hWndEditParent
, NULL
, GetModuleHandle( NULL )
, 0 );
...
}
LRESULT CALLBACK Edit::WndProcEditParent( HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam )
{
switch( iMessage )
{
...
case WM_COMMAND:
if( HIWORD( wParam ) == EN_UPDATE )
{
// this is the hack to avoid "hide pointer while typing"
POINT point;
GetCursorPos( &point );
SetCursorPos( point.x, point.y );
}
break;
...
}
return DefWindowProc( hWnd, iMessage, wParam, lParam );
}
1
This might be a really great answer, but I have no idea how to use it. Please add an explanation. Do not respond in comments; edit your answer to make it clearer and more complete.
– G-Man
Dec 18 '18 at 18:47
add a comment |
You can avoid the "hide pointer while typing" with catching the EN_UPDATE in WndProc of parent window of edit control, and setting the cursor position:
void CreateEdit( HWND hWnd )
{
WNDCLASSEX wndClass;
memset( &wndClass, 0, sizeof( wndClass ) );
wndClass.cbSize = sizeof( wndClass );
wndClass.style = CS_SAVEBITS;
wndClass.lpfnWndProc = WndProcEditParent;
wndClass.cbClsExtra = 0;
wndClass.cbWndExtra = 0;
wndClass.hInstance = GetModuleHandle( NULL );
wndClass.hIcon = NULL;
wndClass.hCursor = NULL;
wndClass.hbrBackground = NULL;
wndClass.lpszMenuName = NULL;
wndClass.lpszClassName = L"EditParent";
RegisterClassEx( &wndClass );
HWND hWndEditParent = CreateWindowEx( 0
, L"EditParent"
, L""
, WS_CHILD | WS_BORDER
, 0
, 0
, 0
, 0
, hWnd
, NULL
, GetModuleHandle( NULL )
, 0 );
HWND hWndEdit = CreateWindowEx( 0
, L"Edit"
, L""
, WS_CHILD
, 0
, 0
, 0
, 0
, hWndEditParent
, NULL
, GetModuleHandle( NULL )
, 0 );
...
}
LRESULT CALLBACK Edit::WndProcEditParent( HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam )
{
switch( iMessage )
{
...
case WM_COMMAND:
if( HIWORD( wParam ) == EN_UPDATE )
{
// this is the hack to avoid "hide pointer while typing"
POINT point;
GetCursorPos( &point );
SetCursorPos( point.x, point.y );
}
break;
...
}
return DefWindowProc( hWnd, iMessage, wParam, lParam );
}
You can avoid the "hide pointer while typing" with catching the EN_UPDATE in WndProc of parent window of edit control, and setting the cursor position:
void CreateEdit( HWND hWnd )
{
WNDCLASSEX wndClass;
memset( &wndClass, 0, sizeof( wndClass ) );
wndClass.cbSize = sizeof( wndClass );
wndClass.style = CS_SAVEBITS;
wndClass.lpfnWndProc = WndProcEditParent;
wndClass.cbClsExtra = 0;
wndClass.cbWndExtra = 0;
wndClass.hInstance = GetModuleHandle( NULL );
wndClass.hIcon = NULL;
wndClass.hCursor = NULL;
wndClass.hbrBackground = NULL;
wndClass.lpszMenuName = NULL;
wndClass.lpszClassName = L"EditParent";
RegisterClassEx( &wndClass );
HWND hWndEditParent = CreateWindowEx( 0
, L"EditParent"
, L""
, WS_CHILD | WS_BORDER
, 0
, 0
, 0
, 0
, hWnd
, NULL
, GetModuleHandle( NULL )
, 0 );
HWND hWndEdit = CreateWindowEx( 0
, L"Edit"
, L""
, WS_CHILD
, 0
, 0
, 0
, 0
, hWndEditParent
, NULL
, GetModuleHandle( NULL )
, 0 );
...
}
LRESULT CALLBACK Edit::WndProcEditParent( HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam )
{
switch( iMessage )
{
...
case WM_COMMAND:
if( HIWORD( wParam ) == EN_UPDATE )
{
// this is the hack to avoid "hide pointer while typing"
POINT point;
GetCursorPos( &point );
SetCursorPos( point.x, point.y );
}
break;
...
}
return DefWindowProc( hWnd, iMessage, wParam, lParam );
}
edited Jan 1 at 10:25
answered Dec 18 '18 at 18:37
user3383940user3383940
12
12
1
This might be a really great answer, but I have no idea how to use it. Please add an explanation. Do not respond in comments; edit your answer to make it clearer and more complete.
– G-Man
Dec 18 '18 at 18:47
add a comment |
1
This might be a really great answer, but I have no idea how to use it. Please add an explanation. Do not respond in comments; edit your answer to make it clearer and more complete.
– G-Man
Dec 18 '18 at 18:47
1
1
This might be a really great answer, but I have no idea how to use it. Please add an explanation. Do not respond in comments; edit your answer to make it clearer and more complete.
– G-Man
Dec 18 '18 at 18:47
This might be a really great answer, but I have no idea how to use it. Please add an explanation. Do not respond in comments; edit your answer to make it clearer and more complete.
– G-Man
Dec 18 '18 at 18:47
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f54147%2fprogramming-productivity-how-to-hide-cursor-while-typing%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Nice question for superuser.com. :-)
– Franci Penov
Oct 12 '09 at 2:10
Well, you could use a mac...
– dmckee
Oct 12 '09 at 2:40
For me, moving the mouse away is a reflex I don't even think about. (that is, until I stopped using regular editors and started using vim)
– hasen
Oct 12 '09 at 7:08