pretranslatemessage behaviour

Hi,

I have a problem when I press CTRL+ALT+D keys the PreTranslateMessage
function is not fired for WM_KEYDOWN, only for WM_KEYUP.

Any suggestions?


Thanks!


0
5/11/2005 5:04:58 PM
vc.mfc 33608 articles. 0 followers. Follow

3 Replies
485 Views

Similar Articles

[PageSpeed] 27

Hey Luis, check out this article and see it if helps (talks about disabling 
that key combination by setting up a hotkey so you get the message instead 
of the OS)
http://www.codeguru.com/Cpp/misc/misc/keyboard/article.php/c433

"Luis Porras" <luis.porras@dakotaimaging.com> wrote in message 
news:OiUM1tkVFHA.2960@TK2MSFTNGP15.phx.gbl...
> Hi,
>
> I have a problem when I press CTRL+ALT+D keys the PreTranslateMessage
> function is not fired for WM_KEYDOWN, only for WM_KEYUP.
>
> Any suggestions?
>
>
> Thanks!
>
> 


0
Arlis
5/11/2005 5:24:32 PM
In addition to Arlis Rose post, PreTranslateMessage should not be used for 
things other than translating accelerators, filtering dialog messages or 
tooltip messages.

That is what PreTranslateMessage was designed for. Using it to check for 
keboard output can create crippled application. All keyboard input should be 
handled by controls or (as previously stated) hot key should be employed.


"Arlis Rose" wrote:

> Hey Luis, check out this article and see it if helps (talks about disabling 
> that key combination by setting up a hotkey so you get the message instead 
> of the OS)
> http://www.codeguru.com/Cpp/misc/misc/keyboard/article.php/c433
> 
> "Luis Porras" <luis.porras@dakotaimaging.com> wrote in message 
> news:OiUM1tkVFHA.2960@TK2MSFTNGP15.phx.gbl...
> > Hi,
> >
> > I have a problem when I press CTRL+ALT+D keys the PreTranslateMessage
> > function is not fired for WM_KEYDOWN, only for WM_KEYUP.
> >
> > Any suggestions?
> >
> >
> > Thanks!
> >
> > 
> 
> 
> 
0
RainMan6256 (150)
5/12/2005 11:50:08 AM
In addition to Arlis Rose post, PreTranslateMessage should not be used for 
things other than translating accelerators, filtering dialog messages or 
tooltip messages.

That is what PreTranslateMessage was designed for. Using it to check for 
keboard output can create crippled application. All keyboard input should be 
handled by controls or (as previously stated) hot key should be employed.


"Arlis Rose" wrote:

> Hey Luis, check out this article and see it if helps (talks about disabling 
> that key combination by setting up a hotkey so you get the message instead 
> of the OS)
> http://www.codeguru.com/Cpp/misc/misc/keyboard/article.php/c433
> 
> "Luis Porras" <luis.porras@dakotaimaging.com> wrote in message 
> news:OiUM1tkVFHA.2960@TK2MSFTNGP15.phx.gbl...
> > Hi,
> >
> > I have a problem when I press CTRL+ALT+D keys the PreTranslateMessage
> > function is not fired for WM_KEYDOWN, only for WM_KEYUP.
> >
> > Any suggestions?
> >
> >
> > Thanks!
> >
> > 
> 
> 
> 
0
RainMan6256 (150)
5/12/2005 11:51:03 AM
Reply:

Similar Artilces:

Calendar behaviour
This is a little strange. I have a user that is using outlook 2003, xp sp2, exchange server 2000 sp4. The user's appointments are not showing up in his inbox. He has no delegates, and the checkbox under tools|Options|Delegates is NOT checked. The Inbox indicates their is an unread msg for every appointment that shows up, but it's not viewable in his inbox. The "pop up" notifications does pop up, and for the brief moments it is there, the fact that it is indeed a meeting request is noticeable. The meeting request is being automatically accepted and placed in his calendar bu...

CComboBox behaviour
I'm trying to create a custom control who would mainly imitate the behaviour of a drop list combo box. I found information in the other threads about parenting the dropdown window to the desktop and things like that. Now I can't find how the ComboLBox (drop list part of the combo) deals with hiding itself when the user clicks outside of its rectangle. I tracked the messages with Winspector, and it appears that it receives the mouse events happening elsewhere on the screen, so I guess the hiding is triggered by WM_LBUTTONDOWN. The problem is the ComboLBox doesn't have mouse c...

How to trap PreTranslateMessage in Win32 (non-MFC) app?
How do you trap PreTranslateMessage in a Win32 (non-MFC) app? I have an existing MFC class called CCustomEditCtrl that I have to convert to pure Win32. I am doing some processing in it's PreTranslateMessage event. Can someone tell me where to put this code in the Win32 version? Do I hvae to trap some WM_ event ? Thanks. Jeff, You would just handle the messages in the control window function. If you want to do something before all other messages, take care of it towards the top of the window function. In pseudo-code: control_function() { // You can, for example, add your proces...

Strange Behaviour with Maximize
I am experiencing the same (or very similar) problem as another user posted a couple of weeks ago in a thread "Report is maximizing weird" - see http://groups.google.com.au/group/microsoft.public.access.reports/browse_frm/thread/17ffe2ba4106be11/a37cf67468fb6232?lnk=st&q=#a37cf67468fb6232 I have several reports in a database (running in Access 2002 under Win XP Pro, with all service packs; database in Access 2000 file format). All these reports have the following code: Private Sub Report_Activate() DoCmd.Maximize End Sub Private Sub Report_Deactivate() DoCmd.Restore E...

Workflow Monitor behaviour
Hi In our most recent install of CRM 3.0, Workflow Monitor does not appear to be behaving as expected at all. I can click a paused workflow in the process pane of the monitor and select "cancel" but nothing happens (apart from a pregnant pause where WFM thinks hard and refreshes the view) Likewise (and more expected in light of above) if i try to purge the log nothing happens. I can put this last problem down to the workflow process still being paused. Has anyone else come across this (undocumented) feature??? Loving CRM more each day (sarcastically) Tracey ...

Owner draw CListCtrl, EnsureVisible, PreTranslateMessage
There is Owner draw CListCtrl with overriden DrawItem. This class has subitems arbitrary controls (CEdit, CButton...). It should be fine to detect arrows keys in controls to jump with caret in CEdit boxes in one column by pressed arrow key. I tried to catch it in CEdit -> PreTranslateMessage() in block if(pMsg->wParam == VK_UP) then to call EnsureVisible() to parent CListCtrl to be caret always visible and CListCtrl scrolls if needed. Problem is when first time it scrolls up, some infinite loop begins and CPU 100% . It seems that something wrong with this... Can be EnsureVisible(...

Strange USB-Audio streaming behaviour of DPC
I am running up to 6 USB audio devices (8bit 8khz sampling rate) in parallel and I have observed on my computer, that DPC starts with a CPU load of 35-50% and after 2 minutes the CPU load decreases down to 0%. However, sometimes the DPC pulses in the following way: * 5 seconds no CPU load * 3 seconds 20-30% CPU load. I am not sure what could cause such an effect and until now I have tried different configurations without a hint. However, the USB host controller should not be a bottleneck. I have a load of less than 5% of total USB bandwidth. Environment: * Windows 7 64bit...

Outlook 2007 weird junk filter behaviour
Hi, I'm setting up an automatic email script, but I find that most of the emails I send from PHP end up in my junk folder. Playing around I found an interesting pattern. Anything that includes the word 'password' in the subject (case insensitive) is sent to Inbox, everything else so far has been sent to Junk. The problem I have is that my webhost overrides the From: header to something that Outlook does not accept to be a valid email address. I'd rather not have to force the word Password into each and every email, instead I'd like to know more about these o...

pretranslatemessage behaviour
Hi, I have a problem when I press CTRL+ALT+D keys the PreTranslateMessage function is not fired for WM_KEYDOWN, only for WM_KEYUP. Any suggestions? Thanks! Hey Luis, check out this article and see it if helps (talks about disabling that key combination by setting up a hotkey so you get the message instead of the OS) http://www.codeguru.com/Cpp/misc/misc/keyboard/article.php/c433 "Luis Porras" <luis.porras@dakotaimaging.com> wrote in message news:OiUM1tkVFHA.2960@TK2MSFTNGP15.phx.gbl... > Hi, > > I have a problem when I press CTRL+ALT+D keys the PreTranslateM...

Buggy Word2007 Behaviour
Yesterday a Word MVP sent me some code to review and consider adding to my ClassicFormAddIn for Word2007. The code provides a method for rapidly adding , deleting and editing dropdown field list entries. The process involves two procedures. Starting with a dropdown field selected in a protected document, the first procedure (exectued from a ribbon button control) presents the user with a Word table populated with any list entries already in the dropdown field and a macro button. The user adds, deletes, or edits entries in the table and then executes the macrobutton which u...

Strange Macro Behaviour
Hi, I have a workbook that has a load of macros built into it doing all sorts of things, but primarily it is concerned with producing a set of charts based on data imported from another source. There are three main macros: 1) One imports all the source data to a specific place. 2) One populates the various charts. 3) One populates a Word document with a pre-defined selection of these charts. Each macro is triggered by a different button click. Each macro works as a standalone piece of code and produces the outputs I want. However, if I run macro 2) (populate the various charts) then imm...

Bad behaviour
hello, I have been reading a website called Butterflies & Wheels for many months. Suddenly I cannot contact it, I get an error message by 'Bad Behaviour' telling me I have a virus or something. I have Norton and I dont think I have any viruses. I suspect that 'Bad Behaviour' is reliable, and is finding something suspicious on my registry. The Bad Behaviour page has an automatic removal option for the problematic entries. Can I trust it ? Has anyone else met 'Bad Behaviour ' ? Help pls K "KRK" <trebor@yeleek.nospam.f...

PreTranslateMessage
Hi I'm trying to catch a CTRL+V event in my PreTranslateMessage function. Now when V is pressed pMsg->wParam == 86 but what is it when CTRL+V is pressed. Or is there some other way of catching the CTRL+V key press Thanks. If there's another way, we'll hear about it. Here's what I do: When you get a WM_KEYDOWN and a VK_SHIFT, set m_shiftdown=1. When you get a 'V', check if m_shifdown==1 When you get a WM_KEYUP and a VK_SHIFT, set m_shiftdown=0. Tom, > Hi I'm trying to catch a CTRL+V event in my PreTranslateMessage function. > Now when V is pressed p...

_bstr_t behaviour
Hi, I am using Visual C++ 6.0 and I am insterested to know what constructors get called when the following call is made: int main() { _bstr_t b = _bstr_t("Hello world"); return 0; } I would expect the constructor which accepts a const char* would be called which would return a temporary object then the copy-constructor would be called to assign the temporary to "b". When I run the debugger, the const char* constructor is called but no copy-constructor! At first I thought this may be a compiler optimization of some sort, or maybe some obsure feature of Visual C++ 6....

Strange PreTranslateMessage Behavior
Hi: I have a vc++ 6.0 dialog-based application where I'm using PreTranslateMessage to send keyboard characters out the serial port with the following code: BOOL CMyDlg::PreTranslateMessage(MSG* pMsg) { if (pMsg->message == WM_CHAR ) { WPARAM wp = pMsg->wParam; char by = (char) wp; char *p_cs; p_cs = &by; pSPort->WriteData( p_cs, 1 ); } return CDialog::PreTranslateMessage(pMsg); } I also have a couple of buttons that perform some functions and are enabled and/or disabled after the functions are complete. Stripped of all irrelevant code these functions are: v...

no more PreTranslateMessage
All my Dialogs are derived from AbstractDialog. This AbstractDialog overrides PreTanslateMessage so I can catch keystrokes in all my Dialogs. BOOL AbstractDialog::PreTranslateMessage(MSG* pMsg) { if(pMsg->message==WM_KEYDOWN) { DEBUG(_T("WM_KEYDOWN")); ... OnKey(); ... } return CDialog::PreTranslateMessage(pMsg); } Now in a particular Dialog I override the virtual OnKey() function and execute whatever should happen in that Dialog on a particular keystroke. Works like charm! Now I have also a CButton handler which creates a w...

Odd Add-in behaviour #2
HI all, We have created an Excel application for a client which consists of an Add-In (xla) and a workbook. We tested it thoroughly under Win2K+Office2K (client set-up) and WinXP-OfficeXP (our setup). All seemed fine. One of our test users now has a problem in that when the Add-In is enabled in Excel Tools>AddIns, his machine slows down tremendously (most noticably using Outlook over a network), disenabling the Addin speeds things up. The Add-In itself is simple - just a user settings management routine and adds a control to the Excel Menu Bar - with no complex references etc. And perh...

SetIcon strange behaviour
In an AppWizard created dialog application, there are two lines to set the icon SetIcon(hIcon, true); // Set the large ico SetIcon(hIcon, false); // Set the small ico If, in the resource editor, I make the small (16x16) and large (32x32) icons visibly different, I find that the small icon I actually get on the program's taskbar is a compressed version of the large one, while if I remove the second line, then both icons seem to be assigned correctly. Can anyone explain this, please Thanks Nigel Hoult "Nigel Hoult" <anonymous@discussions.microsoft.com> wrote in message n...

Strange behaviour
Excel 2007 I have workbook with a workbook.open event, which sets up the workbook and ensures certain pages are visible. If I open this workbook first every runs fine and the code for activate and deactivate works well when opening another file. If I open up another file first, the first time I run the workbook with the workbook.open event it runs exactly as its suppose to. If I then close the file with the events and leave the other workbook active (It has some macros but no workbook.open or activate deactivate events) and then re-open the workbook with workbook.open eve...

Inconsistent behaviour of attributes accessed through structured r
I have a table that represents information in an outline structure. The table has two columns, "Level" and "Requirement" that look like this- Level Requirement 1 Top Level 2 Next Level 2 Next Level again 3 Further sublevel 2 Back to Level 2 Now, what I want to two functions that will- 1) Set the indents of the "Requirements" column based on the level numbers, or- 2) Se the Level numbers based on the indents of the Requirements column. Sounds easy, And one way it is! Can anyo...

PreTranslateMessage and Ctrl + A
Hello NG, how can I check in PreTranslateMessage, if the user has pressed Ctrl and A? if(pMsg->message==WM_KEYDOWN) { pMsg->wParam; //?? Ctrl+A ? pMsg->lParam; //?? Ctrl+A ? } Thanks for help, Guido On Wed, 25 Jul 2007 18:42:17 +0200, "Guido Franzke" <guidof73@yahoo.de> wrote: >Hello NG, > >how can I check in PreTranslateMessage, if the user has pressed Ctrl and A? > > if(pMsg->message==WM_KEYDOWN) > { > pMsg->wParam; //?? Ctrl+A ? > pMsg->lParam; //?? Ctrl+A ? > } > >Thanks ...

Strange keyboard behaviour
My daughter has been using a usb keyboard on her laptop and now, suddenly, some of the keys have started typing 2 items at once, here are some: press m and you get m, press , and you get ,m press j and you get jk press k and you get jk y] ui ui y] 6= 78 78 6= I have tried the keyboard on my desktop and it still does the same. I asked if she had spilt anything on it and she said no, not that that is true. Is there anything I can try before I bin the keyboard. Many thanks Paul "Paul" <Paul@discussions.microsoft.com> wrote in message news:DFE165E5-63...

Strange Behaviour of Aliased Address Names
I am using the ability to define mailbox aliases within Exchange 2003 SP2 to allow incoming email for several people to be collected in one mailbox. When the mailbox is viewed from within Outlook 2003 you see the address name that was "Set as Primary SMTP" as the label adjacent to the TO field. What the user needs to know though is the name that was present in the TO field of the message prior to being aliased to the Primary address name. Right clicking on this name label does reveal one of the alias names in the Sendmail Option. The alias name displayed is the correct one the f...

PreTranslateMessage question
I have an MFC application which is based on a modal CDialog. It contains a Picture control which is resized if the parent dialog size changes - this keeps the picture control occupying the full width of the CDialog's client area. The Picture Control is used to display video, but when the dialog box size is stretched it causes a lot of flickering because the Picture Control repeatedly redraws its background while also displaying the video. According to the documentation, I just have to trap WM_ERASEBKGND messages for the Picture Control to prevent it drawing its background. So I created ...

The behaviour of getchar()
In Visual C++ 6.0 I try to write a program in Ansii C. I found out that calling the getchar() function result not in reading just one character from the keyboard and then continue with next program line. Instead I need to press RETURN to exit this function. Also every char I enter is echoed on the screen. What can I do if I wan't to just read one character from the keyboard at a time and then continue in the program and not to echo what I enter? getch(); AliR. "JanF" <JanF@discussions.microsoft.com> wrote in message news:B9C76843-CAA7-4A1C-844B-5CC955DEF68D@microsof...