msvisual.com Forum Index
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Override Ctrl+I for Rich Text Box

 
Post new topic   Reply to topic    msvisual.com Forum Index -> VB WinAPI
Author Message
Articulate



Joined: 04 Oct 2007
Posts: 7

PostPosted: Thu Jan 31, 2008 11:15 pm    Post subject: Override Ctrl+I for Rich Text Box Reply with quote

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
View user's profile Send private message
BTIS Jeff



Joined: 08 Jan 2008
Posts: 5

PostPosted: Fri Feb 01, 2008 10:56 am    Post subject: Re: Override Ctrl+I for Rich Text Box Reply with quote

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
View user's profile Send private message
mayayana



Joined: 04 Oct 2007
Posts: 734

PostPosted: Fri Feb 01, 2008 2:49 pm    Post subject: Re: Override Ctrl+I for Rich Text Box Reply with quote

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
View user's profile Send private message
Articulate



Joined: 04 Oct 2007
Posts: 7

PostPosted: Tue Feb 05, 2008 10:53 pm    Post subject: Re: Override Ctrl+I for Rich Text Box Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    msvisual.com Forum Index -> VB WinAPI All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group