CreateWindow problem in MFC

Posted on 2003-03-14
Medium Priority
Last Modified: 2013-11-20
  I have .cpp file derived fron CDialog.
Iam creation buttons ate run time using CreateWindow.
I want to display some messages when any button is pressed.
Can one help how to do it?

Question by:Jayalakshmi
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

suganthkumar1 earned 100 total points
ID: 8141945
You can override the funtion OnCmdMsg in your derived class. in that function nID will give the ID of the Window, nCode gives the Notification code.

typically for buttons if you have button IDs, you can go for using a swicth statement and process different buttons.


Assisted Solution

Priyesh earned 100 total points
ID: 8144572
BN_CLICKED notification is send using WM_COMMAND.

Expert Comment

ID: 8161335
If the id's you assign the controls are consecutive, you can use ON_COMMAND_RANGE to create a common handler and just check the id for what message to display.

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question