keystroke in MFC(Dialog app)

hi

I am trying to capture the keyboard input user press in my application i 
have declared the message WM_KEYUP and WM_KEYDOWN and their correspoding 
function also get declared

void CTeestDlg::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) 
{

	MessageBox("Key Presses");
	
	CDialog::OnKeyDown(nChar, nRepCnt, nFlags);
}

now when user press any key in my dialog application message box should be 
displayed but nothing happend no message box displayed I also used the break 
point in side this function but no break point is called ....

please let me know how to solve this problem
Thanks
0
Sohrab (2)
12/7/2004 5:59:02 AM
vc.mfc 33608 articles. 0 followers. Follow

2 Replies
1013 Views

Similar Articles

[PageSpeed] 39

See http://www.voidnish.com/articles/ShowArticle.aspx?code=pretransdialog01

-- 
Regards,
Nish [VC++ MVP]
http://www.voidnish.com /* MVP tips tricks and essays web site */
http://blog.voidnish.com /* My blog on C++/CLI, MFC, Whidbey, CLR... */


"Sohrab" <Sohrab@discussions.microsoft.com> wrote in message
news:C0E531E7-AAA6-4AE9-8914-EFAB3F47F695@microsoft.com...
> hi
>
> I am trying to capture the keyboard input user press in my application i
> have declared the message WM_KEYUP and WM_KEYDOWN and their correspoding
> function also get declared
>
> void CTeestDlg::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
> {
>
> MessageBox("Key Presses");
>
> CDialog::OnKeyDown(nChar, nRepCnt, nFlags);
> }
>
> now when user press any key in my dialog application message box should be
> displayed but nothing happend no message box displayed I also used the
break
> point in side this function but no break point is called ....
>
> please let me know how to solve this problem
> Thanks


0
nish (347)
12/7/2004 6:23:14 AM
Thanks alot..........

"Nishant S" wrote:

> See http://www.voidnish.com/articles/ShowArticle.aspx?code=pretransdialog01
> 
> -- 
> Regards,
> Nish [VC++ MVP]
> http://www.voidnish.com /* MVP tips tricks and essays web site */
> http://blog.voidnish.com /* My blog on C++/CLI, MFC, Whidbey, CLR... */
> 
> 
> "Sohrab" <Sohrab@discussions.microsoft.com> wrote in message
> news:C0E531E7-AAA6-4AE9-8914-EFAB3F47F695@microsoft.com...
> > hi
> >
> > I am trying to capture the keyboard input user press in my application i
> > have declared the message WM_KEYUP and WM_KEYDOWN and their correspoding
> > function also get declared
> >
> > void CTeestDlg::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
> > {
> >
> > MessageBox("Key Presses");
> >
> > CDialog::OnKeyDown(nChar, nRepCnt, nFlags);
> > }
> >
> > now when user press any key in my dialog application message box should be
> > displayed but nothing happend no message box displayed I also used the
> break
> > point in side this function but no break point is called ....
> >
> > please let me know how to solve this problem
> > Thanks
> 
> 
> 
0
Sohrab (2)
12/7/2004 6:35:30 AM
Reply:

Similar Artilces:

Macro Keys no functioning via Keystroke
I have set up a number of marcos assigned to Function keys, but though they function fine when triggering them with the mouse, you can't use them via a Keystroke. ie Alt F11. Does anyone have any suggestions? were they created with a mouse? try creating them with the keyboard only. "Tom" <ttaylor@cherrybrook.com> wrote in message news:563701c5258c$4e5cf050$a501280a@phx.gbl... > I have set up a number of marcos assigned to Function > keys, but though they function fine when triggering them > with the mouse, you can't use them via a Keystroke. ie Alt >...

dialog bars and documents,
I have a dialog bar attached to the MainFrame. I created a CMyDlgBar class to house variables associated with controls on the dialog bar. However, the single CDocument instance (SDI app) will need to have access to the variables of the dialog bar. What is the correct object oriented way to handle this communication in the MFC framework. Easiest way seems to just give the dialog bar a pointer to the doc object. Any advice appreciated. You should provide some public methods on the document which can be accessed by other objects. You CDialogBar can then get to the document (GetActiv...

No Dialog Box when Pasting Cut Cells
I am using one of the Microsoft Press books to learn Microsoft 2003. When I cut a group of cells it instructs me to go to the Insert menu and click cut cells and says that the content in the cells that I am overwriting should be shifted to the right, but instead they shift up. Because no Dialog box appears I have now way to change this. I would appreciate any clues on either how to make the Dialog box appear or to get the cells to shift to the right. I have already used the Options menu to make sure that the Dialog box is activated. Best regards, -- Albert Lan Hi, That is the corr...

MFC get drive information
Dear all, How to get drive information of my computer? I want to get available driver letters and the corresponding disk space information. Thanks! Best Regards, Crystal Use GetLogicalDrives() to get drive informatio. Use GetDiskFreeSpace(... to get drive space. Sekhar Hyderabad. "Crystal" wrote: > Dear all, > > How to get drive information of my computer? > > I want to get available driver letters and the corresponding disk space > information. > > Thanks! > > Best Regards, > Crystal > > > > > You can use cha...

Keystrokes
In the old Outlook Express, I would use Ctrl-U to go to the next unread message, then I'd use the spacebar to scroll the message. Now, using the spacebar moves to the next message (not the next *unread* message, just the next message in the queue.) Is there a new keystroke to replace the spacebar that scrolls the message instead of moving to the next message? -- Ronin Right click on the upper tool bar and select Customize and Next Unread for a new button. "Ronin" <wanderer> wrote in message news:OXFHgDGwKHA.4636@TK2MSFTNGP06.phx.gbl... > In th...

Bug in MFC CList?
Hello there! I have just noticed a bug in MFC, in the CList class. To make sure there are no unexpected memory leaks, Just create a new clean MFC solution, and write the following, somewhere...: CList<int> * lstBuggy = new CList<int>[5]; delete lstBuggy; // Exception thrown - Corrupted Heap!!! Something is going wrong when dynamically allocating an array of CList... I'm working with VS2005 SP1, if somebody out there can test this code with other version of VS, it'll be great... Thanks! On Sun, 22 Jul 2007 23:12:02 -0700, Dani <Dani@discussions.microsoft.com> wr...

Enumerating SQL Server database tables rows and sprocs using MFC
Hi, I've been looking around for a while now after an efficient way to enumerate tables, rows and sprocs of a MsSQL database. The best I could come up with was SQL DMO, but one cannot have it installed without installing SQL Server itself or MSDE, so I'm looking for alternative. After a table name was fetched, I will need to know the rows it contains, what type they are, and what are the indexes and identity defined for this table. Effectively, if I could somehow get the CREATE SQL statement from the DB itself that would be ideal. Also, I will need a way to get the sprocs code ...

Outlook 2003 insert file dialog will not display as list
Hi I have a strange problem with some users on Outlook 2003 (SP3) on Windows XP (SP2). When clicking the paper clip icon to insert a file, the resulting dialog box will not allow you to display the files as the 'list' or 'details' view. If you select either of these, the files are displayed as icons, despite the drop down box confirming that the files should be displayed in list form. This is not a problem for every user, but for those that have this issue, it is not apparent on any other Office product installed on their systems. Has anyone seen this before and have or su...

Cool Keystroke
Hi, I stumbled accross a cool keystroke today that coudl be very helpful for me but I can't replicate it. Here's what I did. I was pasting a row of data into excel and I somehow pasted in negative signs in front of all of the data at the same time. What is the key stroke to do this? Is there a way to enter in /1000 for a large chunck of data? This is something I deal with all the time and would be super helpful. Thanks for your help. Lisa This one is quite simple. When you paste the row of numbers, just choose "Paste Special" and under Operation, choose Subtract. Voi...

MFC API
hi, can anyone suggest a link to where i can find an extensive MFC API? For example, i spent about 20 minutes trying to find exactly what arguments AfxMessageBox function took. I found it on somebody's page embedded in an example, but there's got to be some place online that has got it all laid out & easy to find. thanks, grant h. "Grant H." <grant_holler@yahoo.com> wrote in message news:7dedb20a.0401190906.67467fd0@posting.google.com... > hi, > > can anyone suggest a link to where i can find an extensive MFC API? > For example, i spent about 20 min...

see the Memory management of MFC program
hi , i have declare: char *sectorBuffer = (char *)malloc(SectorNumber_for_each_read * 512); and i have put value on this memory : sectorBuffer = ReadSector(3,i,SectorNumber_for_each_read); i am working in visual studio 2008 in Vista, My question is how can i see the memory map in the address the of "sectorBuffer " (512 bytes)? zack "Zack" <zackm@infinite-memories.com> wrote in message news:CA01A62D-78EB-438D-9176-F60EE50A2097@microsoft.com... > hi , > i have declare: > char *sectorBuffer = (char *)malloc(SectorNumber_for_each_read * 512); > and i ...

[VC 7.1/MFC] UI update in modal CDialog
Hello I'm desigining a dialog with a number of controls. And I'm wondering how to implement UI update. So far I've been using 'static' update: when some event occured I called my method which updated UI of all controls. Right now I'm thinking about something more sophisticated - timers. The only thing that bothers me is how often my timer should trigger UI update ? si Do not use timer. Handle WM_KICKIDLE message. WM_KICKIDLE is sent when modal dialog is idle so you can update whatever you need. "si" wrote: > Hello > > I'm desigining a d...

Getting class name(MFC)
Hi All, In InitInstance I need a class name but before assigning to m_pMainWnd. InitInstance() { .. .. .. //Here i need a classname to check the instance of the application is not already running // FindWindow(,,) .. .. .. CFileWriteDlg dlg; m_pMainWnd = &dlg; .. .. .. } How should i get the Class name? Thanks and regards Amar See here: http://flounder.com/nomultiples.htm Amar wrote: > //Here i need a classname to check the instance of the application is > not already running > // FindWindow(,,) I like this class for this sort of thing. It's really easy to implem...

importing VC6 dlls into VC.net (using MFC)
Hi, I'm using VS.NET 2003 on Win2000 (SP3). I am trying to import a dll developed in VC++6.0 into my VC.net project. I keep getting linker errors complaining about GetThisClass and GetThisMessageMap functions called from RUNTIME_CLASS and BEGIN_MESSAGE_MAP respectively. The problem I found was in the redefinition of these macros. The old versions, used in VC6.0 didn't have these functions. Does anybody know how can I import the dlls without re- writing them in .Net. I have too many dlls that I would like to re-use. Thanks in advance. Anna. ...

Dialog or SDI
Newbie question guys but when is it best to use a dialog app and when is it best to use a SDI app, Thanks in advance Macca "Macca" <andymacinnes@dsl.pipex.com> wrote in message news:<40843b75$0$277$cc9e4d1f@news.dial.pipex.com>... > Newbie question guys but when is it best to use a dialog app and when is it > best to use a SDI app, > When it's the best solution for the problem (obvious answer..) The major question would be "how do you want to interract with the user?" closely followed by "what information do you wish to return?" ...

"Recent Documents" keystroke?
So I'm trying to get used to the "new" start menu. With the old start menu I could hit [WIN] [D] and BAM - "recent documents." In Vista the only way I can figure out so far is [WIN] [DOWN] [DOWN] [DOWN] [RIGHT] [DOWN] [DOWN] [DOWN] [RIGHT] which is much less convenient. Is there a faster way? Thanks! Jim My previous post on this subject finally appeared. "JaimeZX" wrote: > So I'm trying to get used to the "new" start menu. > > With the old start menu I could hit [WIN] [D] and BAM - "recent documents.&qu...

Projects Open Dialog Window
When I go to open a project I have a list of projects which look to be the ones I recently opened. Well we have deleted a few and they are still in this list. Not until I retrieve do I get a new list. How can I clear this out so it only shows real projects? thx in adv. Hi, You need to delete them from your project server cache. Within Project click on Tools | Local Project Cache | Clean up cache. -- Thanks, Ben. Microsoft Most Valuable Professional http://appleparkltd.spaces.live.com/ "projectserverdragon" wrote: > When I go to open a projec...

Printing problems in MFC ..
Hello all, A quick question to the gurus on this NG .. I have an application under development that produces some interesting scattergraphs, and I want to be able to print these scattergraphs as desired. The app is an MDI type app. The scattergraphs are implemented as a custom control, derrived from CDialog, and are "painted" onto the CView instance of a document within the MDI applicaiton framework. The graph is produced exactly as anticiapted, so the graphics commands work. I can't seem to get the graph to print. I created a routine that I call "DrawIntoDeviceCont...

Outlook security settings block third party apps to send email
Hi A customer has a third party app that sends emails thhru e local install of Outlook on a Win 2003 server. We recently updated the server with patches, both for OS but also for Outlook. i this case we applied Sp2 and got problems with the security settings that now promts to allow or not allow this third party app to connect to send emails. Is there a way to get around this "by design issue" or Is the only solution to reinstall? TIA -- Henrik Arenblad, MCP SBS, http://support.microsoft.com/kb/q555375 http://www.google.com/ Sry, forgott to mention, Outlook Is version 2...

recording keystrokes
How do I record keystrokes and then evoke a command to repeat those keystrokes? For instances; I want to change the first word in a numbered list in the document all the way through the document. You cannot record loops with the macro recorder. The following will replace the first word in each paragraph in the selected text with the word(s) defines in sText Sub ReplaceFirstWord() Dim oPara As Paragraph Dim sText As String sText = "Replacement Text" For Each oPara In Selection.Range.Paragraphs oPara.Range.Words(1).Text = sText & Chr(32) Next oPara End ...

dll modeless dialogs
hi group:) i'm working on a project, and trying to implement a plugin system for my app. i think there is a way to do it simply, but i'm having problems with some "small" things. first, how to run the plugins "separately" from the exe, so they could "trace" each other and work separately. (multithreading? how?) second, how to run a modeless dialog from a dll? searhing through MSDN only brought confusion to my head. everything is "explained" pretty much stupid and incomplete. ...

Programming a keystroke assignment
Hi, Is there a way to "Reset" the keystroke assignments in the Normal template using a macro stored in a global template? I'm using Word 2003. I have 800 users and don't want to roll out a new normal just because I have a few keystrokes that aren't assigned properly. Thanks You should not be changing users' Normal templates at all. If you want to alienate your users, or have already alienated them and are trying to save face, then, yes, you can precede your key (un-)assignment code with: CustomizationContext = NormalTemplate and the changes...

My VB6 Apps Crash
Hope this does not double post. I waited and saw nothing post. I had trouble getting into the MS website and loggin in. THis time it was easy. Fortunately I made a Notepad copy before hitting Post. Anyway ... I installed camera software from Trendnet that did not work so after an hour on the phoine with their tech support i uninstalled it from my Vista PC. Now many of my VB6 apps crash on startup. Question has two parts. (1) i opend the IDE to find that one of the apps loaded fine but crashed on a line using FSO. So I looked at the References and found that the Microsoft S...

What version of MFC ships with what version of Windows OS?
Hi! I am been trying to find out which version of MFC ships with which Windows operating system but can't locate that information. I need to know when did Microsoft start shipping MFC 7.0 and 7.1 in their OS. Note: I already know which MFC version ships with which Visual Studio version. Sanj Try searching that information ( search for files MFC42.DLL,MFC70.DLL & MFC71.DLL ) in the DLL database. http://support.microsoft.com/default.aspx?scid=/servicedesks/fileversion/dll info.asp&SD=MSDN&FR=0 -- Cheers Check Abdoul [ VC++ MVP ] ----------------------------------- "...

AFX & MFC
Can someone explain me the difference between the functions in AFX and MFC? For example using AfxMessageBox what differs with simple MessageBox? the functions with AFX prefix what rellay means and differs? I've read that MFC and AFX are the same thing, but AFX was the previous name for MFC library that wrap the API win32...i need a clarification thanks a lot for help To my understanding, AFX are the global functions for MFC framework. "MarcoMB" <MarcoMB@discussions.microsoft.com> wrote in message news:4E5AAABA-934B-493B-A365-E30DABB2BD50@microsoft.com... > Can som...