|
| Author |
Message |
Articulate
Joined: 04 Oct 2007 Posts: 7
|
Posted: Thu Jan 31, 2008 11:15 pm Post subject: Override Ctrl+I for Rich Text Box |
|
|
I am trying to override the default indent behavior for RTB when Ctrl+I is
pressed. I am using the following routine to subclass the RTB. While it works
to override Ctrl+C and Ctrl+V, it does not work for Ctrl+I. Any help would be
appreciated.
Thanks.
Public Function WndProc(ByVal hwnd As Long, _
ByVal uMsg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long) As Long
Dim handled As Long
handled = False
Select Case uMsg
Case WM_KEYDOWN, WM_KEYUP
Select Case wParam
Case vbKeyI, vbKeyV, vbKeyC
'just ignore this message
Debug.Print wParam
handled = True
End Select
End Select
If Not handled Then
WndProc = CallWindowProc(pOldWindPoc, hwnd, uMsg, wParam, lParam)
End If
End Function
Archived from group: microsoft>public>vb>winapi |
|
| Back to top |
|
 |
BTIS Jeff
Joined: 08 Jan 2008 Posts: 5
|
Posted: Fri Feb 01, 2008 10:56 am Post subject: Re: Override Ctrl+I for Rich Text Box |
|
|
On Jan 31, 9:15 pm, Articulate
wrote:
> I am trying to override the default indent behavior for RTB when Ctrl+I is
> pressed. I am using the following routine to subclass the RTB. While it works
> to override Ctrl+C and Ctrl+V, it does not work for Ctrl+I. Any help would be
> appreciated.
>
Try setting Form.KeyPreview to true so that you can
capture keystrokes in Form's KeyDown, and KeyPress event before
they get to other controls, then you can simply check the keystrokes
there and throw them away if not desired.
Thus no need for subclassing or windows api.
* * Please include a copy of this message with your reply
-----
Jeff Bennettt
Jeff @ Bennet-Tec.Com
* Bennet-Tec Information Systems, Inc
* 50 Jericho Tpk, Jericho, NY 11753
* Phone 516 997 5596, Fax - 5597
* WWW.Bennet-Tec.Com
RELIABLE Component Software
and Custom Software Development Services
* Expert Systems * Text Processing
* Databases * Interactive Web Sites
* Diagramming, Drawing, Hotspot Graphics
* Data Input & Data Presentation Systems
* Desktop Windows, Tablets, Pocket PCs
TList(tm) / ALLText(tm) / MetaDraw(tm) / Web Signature(tm)
=================== ===================
-------------------------------------------------------------------------------------
This message was sent to you by Bennet-Tec Support System
---------------------------------------------------------------------------------------- |
|
| Back to top |
|
 |
mayayana
Joined: 04 Oct 2007 Posts: 734
|
Posted: Fri Feb 01, 2008 2:49 pm Post subject: Re: Override Ctrl+I for Rich Text Box |
|
|
I haven't looked at this for awhile, but in my
own customized RTB I trap ALL hotkeys to provide
a custom implementation. It deals with
pOleControlSite.TranslateAccelerator. Matthew
Curland had an explanation of the issue in his
book, I think. The deal is that standard system
hotkeys get through before you get access to them.
You mind find help here:
http://www.vbaccelerator.com/home/VB/Utilities/ActiveX_Documenter/ActiveX_Do
cumenter_Source_zip_VBRichEdit_ctl.asp
> I am trying to override the default indent behavior for RTB when Ctrl+I is
> pressed. I am using the following routine to subclass the RTB. While it
works
> to override Ctrl+C and Ctrl+V, it does not work for Ctrl+I. Any help would
be
> appreciated.
>
> Thanks.
>
> Public Function WndProc(ByVal hwnd As Long, _
> ByVal uMsg As Long, _
> ByVal wParam As Long, _
> ByVal lParam As Long) As Long
> Dim handled As Long
> handled = False
>
> Select Case uMsg
> Case WM_KEYDOWN, WM_KEYUP
> Select Case wParam
> Case vbKeyI, vbKeyV, vbKeyC
> 'just ignore this message
> Debug.Print wParam
> handled = True
>
> End Select
> End Select
>
> If Not handled Then
> WndProc = CallWindowProc(pOldWindPoc, hwnd, uMsg, wParam, lParam)
> End If
> End Function
> |
|
| Back to top |
|
 |
Articulate
Joined: 04 Oct 2007 Posts: 7
|
Posted: Tue Feb 05, 2008 10:53 pm Post subject: Re: Override Ctrl+I for Rich Text Box |
|
|
Thanks, that worked for my needs.
"BTIS Jeff" wrote:
> On Jan 31, 9:15 pm, Articulate
> wrote:
> > I am trying to override the default indent behavior for RTB when Ctrl+I is
> > pressed. I am using the following routine to subclass the RTB. While it works
> > to override Ctrl+C and Ctrl+V, it does not work for Ctrl+I. Any help would be
> > appreciated.
> >
>
> Try setting Form.KeyPreview to true so that you can
> capture keystrokes in Form's KeyDown, and KeyPress event before
> they get to other controls, then you can simply check the keystrokes
> there and throw them away if not desired.
> Thus no need for subclassing or windows api.
>
>
>
> * * Please include a copy of this message with your reply
>
> -----
>
>
> Jeff Bennettt
> Jeff @ Bennet-Tec.Com
>
>
> * Bennet-Tec Information Systems, Inc
> * 50 Jericho Tpk, Jericho, NY 11753
> * Phone 516 997 5596, Fax - 5597
> * WWW.Bennet-Tec.Com
>
> RELIABLE Component Software
> and Custom Software Development Services
>
> * Expert Systems * Text Processing
> * Databases * Interactive Web Sites
> * Diagramming, Drawing, Hotspot Graphics
> * Data Input & Data Presentation Systems
> * Desktop Windows, Tablets, Pocket PCs
>
> TList(tm) / ALLText(tm) / MetaDraw(tm) / Web Signature(tm)
>
> =================== ===================
> -------------------------------------------------------------------------------------
> This message was sent to you by Bennet-Tec Support System
> ----------------------------------------------------------------------------------------
>
>
|
|
| Back to top |
|
 |
|
|