How to make custom UI with VC++ 5?

Posted on 1998-06-30
Last Modified: 2013-11-20
   Is there a way (an easy one) to create custom User Interface for our application? For example, instead of using the standard Windows 95 application UI, I would like to create a fancy UI (kinda like WinAMP, or other Win32 MP3 players) with my own BMP file with the layout.
  I think I can achieve that by modifiying the .rc file, but I don't know where or how to begin.  Can anyone help me out?
Question by:eklee
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
LVL 23

Expert Comment

ID: 1318569
Create a frame window without a menu, title, border or whatever you want. Here is a very simple template.

#include <afxwin.h>

class CMyApp : public CWinApp
        virtual BOOL InitInstance();

class CMyWnd : public CFrameWnd
        inline BOOL CreateWnd();
        afx_msg void OnPaint();
        afx_msg void OnLButtonDown(UINT nFlags, CPoint point);

inline BOOL CMyWnd::CreateWnd()
    RECT rcWnd; = rcWnd.left = 0;
    rcWnd.right = 100;
    rcWnd.bottom = 100;
    return this->Create(NULL,      // use default class name
                        _T("My Window"),

CMyApp theApp;

BOOL CMyApp::InitInstance()
    // Create an instance of our own frame window class
    CMyWnd *pWnd = new CMyWnd;
    if (!pWnd->CreateWnd())
        return FALSE;
    m_pMainWnd = pWnd;
    return TRUE;

afx_msg void CMyWnd::OnPaint()
    CPaintDC dc(this);    // device context for painting

    // draw your window here    
afx_msg void CMyWnd::OnLButtonDown(UINT nFlags, CPoint point)
    // action here


Author Comment

ID: 1318570
Yes, but how could I associate the "Close Window", "Maximize Window", "Minimize Window" buttons to what they should do?  For example, let's say my application has a circle shape, all the "Close/Max/Min Windows" buttons are at distributed in the bottom of the circle.  Let's say I have already drawn up the layout of this circle in a bmp file.

Now, how could I make my application to use my bmp file as its 'skin'? In addition to that, how can i tell my program that the "Close/Max/Min Windows" button are located at some other places, instead of at the top right (standard) position?
LVL 15

Expert Comment

by:Tommy Hui
ID: 1318571
You can always catch the mouse messages yourself and respond to them as needed. For example, if the user clicks on your X bitmap and you want to interpret that as a close message, then all need is to PostMessage(WM_CLOSE). To minimize, you would use ShowWindow(SW_MINIMIZE), and ShowWindow(SW_MAXIMIZE) to maximize the window.
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Expert Comment

ID: 1318572
Your question is a not a hard question but is a long one and deals with many issues based on your design say if you make a custom button that say Maximizes a window....In all these cases you need to overide these messages and in some cases override them completely and deal with them yourself. You have to handle all button interactions including states of your buttons..drawing them yourself and produce messages when they are pressed.  But to answer your question one would need a clear idea of what you want to do.

Author Comment

ID: 1318573
    I guess what I want to know is how could we use a custom BMP image as the appearance of our application.  For example, if we create a custom Dialog-based application, it will still be the traditional rectangle-shaped application.  Instead of this, I would like to make the application looks like whatever BMP image we use.  
    As another example, let's say I want to write a CD-jukebox application.  It is ugly if we use standard/traditional Windows' rectangle-shaped layout.  I want to make my application looks like a jukebox (I will draw it in a BMP file) and let the user interact with it (custom buttons).  How can I do this thru VC++? I know I can do this quite easily thru Delphi 3, but I don't have it, and I prefer to work with VC++ for now.

Expert Comment

ID: 1318574
It is very easy with ActiveX controls.

In the ActiveX Control Wizard(App Wizard), check the box Window less activation and you can build your control in customized shape.

Accepted Solution

chabaud earned 100 total points
ID: 1318575
You can intercept the WM_NCHITTEST message for your window and return HTCLOSE / HTMAXBUTTON / HTMINBUTTON or  DefWindowProc() result, depending on xPos and yPos parameters.

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
In an interesting question ( here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

740 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