Click here to Skip to main content
15,920,111 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Can I create a toolbar without framewnd? Pin
wormeye8-Dec-01 17:21
wormeye8-Dec-01 17:21 
GeneralProblem with Popup Window ( Open in new window...OnNewWindow2 function ) Pin
7-Dec-01 19:24
suss7-Dec-01 19:24 
GeneralJust a couple of questions Pin
7-Dec-01 17:55
suss7-Dec-01 17:55 
GeneralRe: Just a couple of questions Pin
Nish Nishant7-Dec-01 18:36
sitebuilderNish Nishant7-Dec-01 18:36 
GeneralRe: Just a couple of questions Pin
Rick York7-Dec-01 19:44
mveRick York7-Dec-01 19:44 
GeneralRe: Just a couple of questions Pin
Nish Nishant7-Dec-01 19:55
sitebuilderNish Nishant7-Dec-01 19:55 
GeneralRe: CP script is messin up my code :-) Pin
Nish Nishant7-Dec-01 18:39
sitebuilderNish Nishant7-Dec-01 18:39 
GeneralRe: Just a couple of questions Pin
Christian Graus8-Dec-01 0:48
protectorChristian Graus8-Dec-01 0:48 
Start with a dialog based app, there is a lot less to follow. Make the OnPain function in the dialog look like this:

if (IsIconic())
{
    CPaintDC dc(this); // device context for painting

    SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

    // Center icon in client rectangle
    int cxIcon = GetSystemMetrics(SM_CXICON);
    int cyIcon = GetSystemMetrics(SM_CYICON);
    CRect rect;
    GetClientRect(&rect);
    int x = (rect.Width() - cxIcon + 1) / 2;
    int y = (rect.Height() - cyIcon + 1) / 2;

    // Draw the icon
    dc.DrawIcon(x, y, m_hIcon);
}
else
{
    CPaintDC dc(this); // device context for painting

    dc.TextOut(10, 10, "Hello World");

    CDialog::OnPaint();
}


I'm not sure if you need the call to the base class, so I left it in, although removing it appears to do no harm. There's your hello world, and the simplest MFC app you'll get outside of using MFC in a console app.


Christian

After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001

Sonork ID 100.10002:MeanManOz
I live in Bob's HungOut now

GeneralRe: Just a couple of questions Pin
Alvaro Mendez11-Dec-01 6:17
Alvaro Mendez11-Dec-01 6:17 
Generala question or 2 Pin
Cnoob7-Dec-01 16:34
Cnoob7-Dec-01 16:34 
GeneralRe: a question or 2 Pin
Nish Nishant7-Dec-01 17:08
sitebuilderNish Nishant7-Dec-01 17:08 
GeneralRe: a question or 2 Pin
Not Active7-Dec-01 17:16
mentorNot Active7-Dec-01 17:16 
GeneralRe: a question or 2 Pin
Christian Graus8-Dec-01 0:52
protectorChristian Graus8-Dec-01 0:52 
GeneralRe: a question or 2 Pin
Michael P Butler8-Dec-01 7:37
Michael P Butler8-Dec-01 7:37 
GeneralRe: a question or 2 Pin
Matt Newman8-Dec-01 9:06
Matt Newman8-Dec-01 9:06 
GeneralWM_CLOSE or WM_DESTROY Pin
Steve L.7-Dec-01 16:15
Steve L.7-Dec-01 16:15 
GeneralRe: WM_CLOSE or WM_DESTROY Pin
Nish Nishant7-Dec-01 17:10
sitebuilderNish Nishant7-Dec-01 17:10 
GeneralRe: WM_CLOSE or WM_DESTROY Pin
Henry Jacobs8-Dec-01 10:38
Henry Jacobs8-Dec-01 10:38 
QuestionHow can you make a dialog show up in the taskbar? Pin
Cathy7-Dec-01 14:14
Cathy7-Dec-01 14:14 
AnswerRe: How can you make a dialog show up in the taskbar? Pin
Michael Dunn7-Dec-01 16:50
sitebuilderMichael Dunn7-Dec-01 16:50 
GeneralRe: How can you make a dialog show up in the taskbar? Pin
Cathy10-Dec-01 7:59
Cathy10-Dec-01 7:59 
GeneralGetWindowText wont work! Pin
Rickard Andersson207-Dec-01 11:33
Rickard Andersson207-Dec-01 11:33 
GeneralRe: GetWindowText wont work! Pin
Erik Thompson7-Dec-01 12:08
sitebuilderErik Thompson7-Dec-01 12:08 
GeneralRe: GetWindowText wont work! Pin
User 66588-Dec-01 3:26
User 66588-Dec-01 3:26 
GeneralRe: GetWindowText wont work! Pin
Masaaki Onishi8-Dec-01 4:52
Masaaki Onishi8-Dec-01 4:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.