Wednesday, 17 August 2011

Message Box with custom commit buttons

Windows API and MFC framework offer ready to use Message Box dialog which can display, depending on a provided flag, one or group of more commit buttons with captions from a predefined set: OK, Yes, No, Cancel, Abort, Retry and Ignore. If dialog contains a question, it is a good practice to make buttons displaying specific responses, e.g. "Run" - "Don't run", "Apply" - "Don't apply" etc. The easiest and quickest way to achieve this is to create a new, custom dialog and add onto it buttons with desired text. Resource editor in Visual Studio creates by default dialog with two buttons, OK and Cancel and you can rename them, providing that new captions will match OK and Cancel functionality. For other buttons, add BN_CLICKED handlers (ON_BN_CLICKED entry in message map). The purpose of this dialog is just to pick the user's answer on a question and not to do any hard work. Caller should read return value of (custom) Message Box and take further actions depending on it.

Return value of the standard message box (one from a predefined set IDOK, IDYES, ...) identifies user's choice and we can return these predefined values or our custom return codes, e.g. ID_RUN, ID_APPLY...We can also reuse resource ID values of our custom buttons for this purpose. Standard Message Box is a modal dialog so our dialog needs to be created as modal (CDialog::DoModal). DoModal returns value that was passed to CDialog::EndDialog. This function should be called in our custom button BN_CLICKED handlers.

In the following example, our custom Message Box has button "Apply". Its BN_CLICKED handler is OnBnClickedButtonApply. Caller identifies user's choice with DoModal return value:

Our Message Box which has "Apply" button:

Caller:

67 comments:

Jack Alexa said...

I'm very Glad to visit your informational Post. Custom Window Boxes Packaging boxes are really necessary for any kind of product. If you want to pack your products in a stylish way then use these Custom Window Boxes with customized designs, styles, colors, shapes, and stocks. We are also offering error-free design and free shipping services all over the USA.

Noah liam said...

Your article has really good reading, thought-provoking information. You make several sound points I find agreeable. Your article is a good example of superior writing from a writer that cares. Thanks for sharing this information. Custom Window Boxes

thomasjack said...

I appreciate your post thanks for sharing the information.
Cake boxes Kentucky
Candle boxes Kentucky

thomasjack said...

Amazing product thanks for sharing with us It is very informative.
custom boxes Kansas
apparel box manufacturer

thomasjack said...

Amazing product thanks for sharing with us It is very informative.
custom boxes Kansas
apparel box manufacturer

markthomson said...

I felt exceptionally cheerful while perusing this site. This was truly extremely instructive site for me. I truly enjoyed it. This was truly a sincere post. Much obliged!. Custom Boxes with logo

Teresa D Dolan said...

Thank you for sharing this article. It's really informative article. I really enjoy your site I am waiting for a new article.
cigarette boxes
vape cartridge packaging

Serina johson said...

Good blog thanks for sharing the information.
Photography Packaging packaging USA
cheap custom Perfume Boxes

Chris Michael said...

All details you describe in your blog post about cigarette boxes is very informative for me. Cigarette boxes provides with suitable price.

Custom Packaging Boxes said...

Our service has been very supportive to our customers and especially in solving their problems and providing them with the best boxes which are fully credible and worthy of their trust.
reverse tuck end boxes
straight tuck end boxes
custom pen boxes

Custom Printing Solution USA said...

I am very glad to read your blog. Packaging is important for any kind of product but for candle boxes it's very important. CustomBoxesU provide every kind of boxes in different sizes, shapes and layout.

micheal pan said...

BE SMART AND BECOME RICH IN LESS THAN 3DAYS....It all depends on how fast 
you can be to get the new PROGRAMMED blank ATM card that is capable of
hacking into any ATM machine,anywhere in the world. I got to know about 
this BLANK ATM CARD when I was searching for job online about a month 
ago..It has really changed my life for good and now I can say I'm rich and 
I can never be poor again. The least money I get in a day with it is about 
$50,000.(fifty thousand USD) Every now and then I keeping pumping money 
into my account. Though is illegal,there is no risk of being caught 
,because it has been programmed in such a way that it is not traceable,it 
also has a technique that makes it impossible for the CCTVs to detect 
you..For details on how to get yours today, email the hackers on : (
atmmachinehackers1@gmail.com ). Tell your 
loved once too, and start to live large. That's the simple testimony of how 
my life changed for good...Love you all ...the email address again is ;
atmmachinehackers1@gmail.com

David Luke said...

Hi, I hope You are fine. Your work is very good. I read all your published blogs. Your blogs are very informative for me and hope so for everyone. I should be very thankful to you and Your Team. I offered all of You my business which is related to Custom Lotion Boxes. My company name is Rush Packaging. We offered You Custom Boxes all over the World with Free Shipping and Wholesale Rate. We delivered our service on time.
Custom Hairspray Boxes
Hair Extension Boxes
Custom Nail Polish Boxes
Custom Eyeliner Boxes
Custom Boxes

Marketing Expert said...

Well-manufactured cigarette boxesgives numerous benefits to your tobacco business. Marketing conditions are getting tough so, you can’t sell cigarettes without packaging boxes.

Jack Alexa said...

I'm very Glad to visit your informational Post. Cannabis Cigarette Boxes Packaging boxes are really necessary for any kind of product. If you want to pack your products in a stylish way then use these Cannabis Cigarette Boxes with customized designs, styles, colors, shapes, and stocks. We are also offering error-free design and free shipping services all over the USA.

manahilafzal123 said...

bespoke packaging boxes At Bespoke Packaging UK we strongly believe in the interests of bespoke packaging, which has multiple benefits.

manahilafzal123 said...

birthday blessings

Olaf Ae said...

We are specialized in providing express transportation (Heathrow Taxi), services for to and from all London, UK Cruise Ports, to and from anywhere in the UK.heathrow executive taxi

Olaf Ae said...

London Chauffeurs have been successfully delivering exceptional risk-based, protective driver services for vips and those with specialist requirements since our inception. If you are looking for the best stress-free service look no further.Heathrow chauffeur service

Olaf Ae said...

can cater for clients all around Kent and Builders South East London. We are specialists in building services such as new builds, loft conversions, extensions and renovations of existing properties.Plumbers in South East London

Olaf Ae said...

Make the most of your time, increase productivity while you travel London Chauffeurs or relax and unwind. Whether you’re an executive or travelling, our service is perfect for those who want a great, stress free, safe, travel experience.Heathrow chauffeur service

Olaf Ae said...

Understanding that many of you also have very different budgets to work with, we have evaluated best crossbow and carefully prepared a list of the best in each of five price points.best crossbow under 500

Olaf Ae said...

Once you purchase this Power Tools Report, we will deliver the Hand Power Tool Manufacturing in the UK report to you within 5 business days. Our team of in house analysts will immediately start work gathering data and industry insights. Purchase this report to get started. Best Single Stage Snow Blower
best 2 stage snow blower

Olaf Ae said...

We work with your best local Dry cleaners Norwich to provide the service directly to your door.Laundry service Norwich

UNKNOWN said...

Positive site, where did u come up with the information on this posting?I have read a few of the articles on your website now, and I really like your style. Thanks a million and please keep up the effective work. good choice of stash jars at Cannaline

Chris Michael said...


I am very glad to read your blog. Packaging is necessary for any kind of product but for pre roll boxes is very necessary. CustomBoxesU provide best quality packaging suitable price.

James Anderson said...
This comment has been removed by the author.
Custom Packaging Solution said...

CustomBoxesU provide you the best CBD Boxes, which will protect your product as well as give it a perfect look.

James William said...

The Cigarette Boxes is a platform where you will get the best cigarette boxes to suit your business needs. We provide unique, eye-catching, and heart-throwing Cigarette Packaging Boxes.

Sarah Sadie said...

I'd like to offer some feedback on this excellent article. I can tell you've done a lot of research and thought about this issue. We are a producer and designer of smoking boxes.

Anonymous said...

Nice Post. We as packagingxpert Provide the best packaging solutions, designs, and customization options for all products  like cosmetic packaging, food packaging, and other packaging boxes 

James William said...

we provide the best Wholesale E-Cigarette Boxes at the most affordable prices. With over 100 designs and 250 color options, you can easily find a box that matches your brand's design theme.

Stampa Prints said...

Interesting Article

Here informed you the best box packaging company in the USA is: Stampa Prints

OBT Packaging said...
This comment has been removed by the author.
Admissiongyan said...

Excellent goods from you, man. I have understand your stuff previous to and you are simply extremely fantastic. I actually like what you’ve obtained right here, really like what you are saying and the way in which by which you are saying it. You are making it enjoyable and you still care to stay sensible. I can’t wait to read much more from you. This is really a wonderful site. Masters in Mechanical Engineering in Germany

Ideal Custom Boxes said...

Here you will find the best and attractive personalized boxes. And yes you can purchase these Personalized Boxes in Bulk at affordable rates ever. Ideal Custom Boxes are always available for you, you can contact us whenever you want these Custom Printed Boxes.

Remer Mirror said...

I'm extremely inspired along with your writing skills as neatly as with the format in your blog. Is that a paid subject or did you customize it yourself? Anyway stay up the excellent quality writing, it's rare to look at a great blog like this one today.. Round LED Mirror

Jack Leo said...

Nice sharing, I want to describe my article here. Ife you are search for cigarette and it's packing theory. You are in read right comment. So, after reading this information, you have been understand how All You Need To Know Empty Cigarette Boxes? and it’s selling procedure. If you are any questions or concerns related this topic then place a comment below. Also, if you are looking for packaging articles then you should visit here.

Ann said...

Get excellent quality Custom vape cartridge boxes with a variety of colors, shades & designs plus free delivery in US..

joneson said...

Custom Window Boxes is meant to display what’s exactly inside the box. When a customer sees the product, the first thing that is determined by the brain, whether the product is pleasant or unpleasant. The touch and see factor allows the customers to observe the product ideally.

Tax Accountant said...

Nice information you should try Custom Boxes Market their boxes are very good

joneson said...

Packaging Display Boxes increase the sales of the products. Because attractive display boxes attract the buyer towards and automatically increase the sales of the product. The customers will never get attracted towards the product. That is why instead of building brown colorful packaging boxes for each product. The color of the customized packaging display boxes is entirely depended on the nature of the product.

Custom Packaging Pro said...

The design and style of the Packaging with Logo is very important for your success. You can produce an appealing layout that actually attracts attention on racks. It will guarantee your success.

Tax Accountant said...

Good information but in today's world you can use a web developer and he and do anything for you for your website

Jhon Harris said...

I read your blog and it is relevant to me. The one thing i was waiting from last few days is: I want to read more articles about the Best Packaging Boxes Provider Company In USA.

Unknown said...

Thanks for sharing with us great information. You should get some recommendations from the Top Ranking Company to add some more valuable things. It will also urge your viewers as well.

Rajan Mhatre said...

Thanks a lot for sharing this amazing knowledge with us. This site is fantastic. I always find great knowledge from it.
Visit us for customised polo t-shirt printing online.

The Custom Box Packaging said...

I appreciate your post thanks for the information. Some products require special packaging solutions that keep their worth and value intact. Custom Subscription Boxes Wholesale Packaging are the best example of it.

The Customized Boxes said...

Amazing Post Sir! Its very informative and all detail are awesome keep it up. You should try custom printed boxes for any kind of products.

Xperts Packaging said...

This material is informational without being boring and intimidating. Xperts Packaging provide any kind of customization in all products.

Cathy W. Culbreath said...

Great post. Thanks for sharing.
7 Benefits Of Burning Candles That Can Change Your Life

Aryarowan said...

I am very glad to read your blog. For whatever type of product, packaging is crucial. You have a wide variety of boxes in various sizes, shapes, and layouts.
packagingmines

James Mary said...

Thank you for writing this quality informational content.Your writing technique is impressive and enjoyable to read. I'll come back for more fantastic material.
Best wishes, and good luck.
cheap custom boxes

Irwin Kempton said...

Thank you so much for sharing your articles with us. Hopefully, you will be able to benefit us with more informative article.
-Cigarette Packaging Boxes

powerhouse express said...

We provide all kinds of electrical solutions you will need to grow and flourish. Powerhouse Express brings efficient, reliable and accessible solutions to your doorstep.


https://powerhouseexpress.com.pk/

Clipsal electric said...

Clipsal is now poised to be a major player in global markets and aims to be the number one electrical product brand name in the world.


https://clipsal.com.pk//

The Customized Boxes said...

Very Informative and useful blog. Very Appreciated. I suggest you to try the customized boxes for any kind of products because we have a large variety of products designing looks and awesome creation that surely will enhance the charming looks of your products to the highest peaks and also increase your branding drives.

mycustomboxes said...

Interesting post .My Custom Boxes provides Custom Designed Boxes For Packaging in different sizes and shapes for All your products like food ,cosmetic and other product

Unknown said...

nice post to share .Kitafotos Berlin is best photographic service provider with beautiful backgrounds at berlin .they are special in nursery ,daycare photography portfolio and many other photography with expert skills

Cathy W. Culbreath said...

Love this post. Thanks for sharing this post.
How to Provide the Top Packaging Services for CBD Products?

Cathy W. Culbreath said...

Love this post. Thanks foe sharing this post.
How to Provide the Top Packaging Services for CBD Products?

LIPOSUCTION said...

nice post .Schulfotos Berlin is best photographic service provider with beautiful backgrounds at berlin .they are special in nursery ,daycare photography portfolio and many other photography with expert skills

Alix Hills said...

Kraft Packaging Boxes are the most recognizable introduction of business just as legitimate jobs. Look over the huge assortment of Custom Printed Business Card Packaging Boxes to bundle business cards for your clients.

Cathy W. Culbreath said...

I appreciate your post. This post is really awesome. Thanks for sharing.
What is the Best Way to Choose CBD Oil Tincture and How to Use It?

James Mary said...


This is a fantastic article. Your essay is quite simple to comprehend. Thank you for sharing this informative information with us.
CBG Isolate Wholesale

Custom Popcorn Boxes said...

Thanks for Sharing this Interesting Post with us.we as custom popcorn boxes provides Food boxes  for all kinds of personal and professional requirements

Next Custom Boxes said...

Thanks for sharing such a informative post .we as the best food packaging supplier provide food packaging solution for all type of food items