Creating a Round Dialog | CodeGuru

Creating a Round Dialog

Environment: The code in this article was developed using Visual C++ 4.0 This code is used to make a round dialog for various Apps. This could be good for use with an MP3 or CDPLAYER or any other. Surprisingly it’s not that hard! [I looked but nobody had written anything for a round dialog. I […]

Written By
CodeGuru Staff
CodeGuru Staff
Apr 18, 1999
1 minute read
CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More

Environment: The code in this article was developed using Visual C++ 4.0

This code is used to make a round dialog for various Apps.
This could be good for use with an MP3 or CDPLAYER or any other.

Surprisingly it’s not that hard!

[I looked but nobody had written anything for a round dialog. I had
been trying to shape a dialog for some time. Then after playing
with the Microsoft CD for a SetWindowRgn() for a window I tried to
use it for a dialog. Viola! After Jumping around a few times after
it compiled I sent it to the Code Guru.

[CRgn m_rgn;  // This is for the dialog area: It goes in your h. file
// This Gets the size of the Dialog: This goes under the OnInitDialog Function
Crect rcDialog
GetClientRect(rcDialog);
// This Creates area assigned to Dialog: This goes directly below the above in OnInitDialog
m_rgn.CreateEllipticRgn(0, 0, rcDialog.Width(), rcDialogHeight());
SetWindowRgn(GetSafeHwnd(), (HRGN) m_rgn, TRUE);]

Download demo project – 17 KB

Download source – 3 KB

Date Last Updated: April 18, 1999

CodeGuru Logo

CodeGuru covers topics related to Microsoft-related software development, mobile development, database management, and web application programming. In addition to tutorials and how-tos that teach programmers how to code in Microsoft-related languages and frameworks like C# and .Net, we also publish articles on software development tools, the latest in developer news, and advice for project managers. Cloud services such as Microsoft Azure and database options including SQL Server and MSSQL are also frequently covered.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.