Click here to Skip to main content
16,005,734 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: printf - Messagebox [MOD] Pin
Programm3r28-Feb-07 3:38
Programm3r28-Feb-07 3:38 
AnswerRe: printf - Messagebox Pin
The NULL Developer27-Feb-07 23:14
professionalThe NULL Developer27-Feb-07 23:14 
GeneralRe: printf - Messagebox Pin
Programm3r27-Feb-07 23:20
Programm3r27-Feb-07 23:20 
AnswerRe: printf - Messagebox Pin
ThatsAlok27-Feb-07 23:17
ThatsAlok27-Feb-07 23:17 
GeneralRe: printf - Messagebox Pin
Programm3r27-Feb-07 23:23
Programm3r27-Feb-07 23:23 
AnswerRe: printf - Messagebox Pin
prasad_som27-Feb-07 23:18
prasad_som27-Feb-07 23:18 
GeneralRe: printf - Messagebox Pin
Programm3r27-Feb-07 23:22
Programm3r27-Feb-07 23:22 
AnswerRe: printf - Messagebox Pin
Nibu babu thomas28-Feb-07 0:31
Nibu babu thomas28-Feb-07 0:31 
Programm3r wrote:
Lets say you use printf and you want to display a message with a counter, but the message must not repeat itself but the counter must.


Why don't you write a dedicated message box function that does this...

For eg:

// Shows error dialog
void __cdecl ShowMsg( LPCTSTR lpctszTitle_i, const DWORD dwIconType_i, LPCTSTR lpctszMessage_i, ... )
{
    va_list vaArgList;
    va_start( vaArgList, lpctszMessage_i );

    CString csMsg;
    csMsg.FormatV( lpctszMessage_i, vaArgList );

    MessageBox( AfxGetMainWnd()->GetSafeHwnd(),
                csMsg,
                lpctszTitle_i,
                dwIconType_i );

    va_end( vaArgList );

}// End ShowMsg


And call this function like wise
ShowMsg( _T( "Title" ), 
              MB_OK|MB_ICONINFORMATION, 
              _T( "My name is %s, my age is %d" ), 
              _T( "Nibu babu thomas" ), 27 );
You can customize this function for your need.


Nibu thomas
A Developer

Programming tips[^]  My site[^]

GeneralRe: printf - Messagebox Pin
Programm3r28-Feb-07 1:59
Programm3r28-Feb-07 1:59 
QuestionFile in vc++ Pin
deeps_cute27-Feb-07 22:26
deeps_cute27-Feb-07 22:26 
AnswerRe: File in vc++ Pin
toxcct27-Feb-07 22:29
toxcct27-Feb-07 22:29 
AnswerRe: File in vc++ Pin
Cedric Moonen27-Feb-07 22:31
Cedric Moonen27-Feb-07 22:31 
QuestionNetwork simulator's tcp code......... Pin
chandni chi27-Feb-07 22:26
chandni chi27-Feb-07 22:26 
AnswerRe: Network simulator's tcp code......... Pin
ThatsAlok27-Feb-07 23:19
ThatsAlok27-Feb-07 23:19 
QuestionThreads and graceful exit Pin
vikramlinux27-Feb-07 22:21
vikramlinux27-Feb-07 22:21 
AnswerRe: Threads and graceful exit Pin
Roger Stoltz27-Feb-07 22:37
Roger Stoltz27-Feb-07 22:37 
GeneralRe: Threads and graceful exit Pin
vikramlinux27-Feb-07 22:42
vikramlinux27-Feb-07 22:42 
GeneralRe: Threads and graceful exit Pin
Roger Stoltz27-Feb-07 23:00
Roger Stoltz27-Feb-07 23:00 
GeneralRe: Threads and graceful exit Pin
vikramlinux27-Feb-07 23:05
vikramlinux27-Feb-07 23:05 
GeneralRe: Threads and graceful exit Pin
jhwurmbach28-Feb-07 2:10
jhwurmbach28-Feb-07 2:10 
QuestionDisplay String Message.. Pin
Shah Satish27-Feb-07 22:17
Shah Satish27-Feb-07 22:17 
AnswerRe: Display String Message.. Pin
toxcct27-Feb-07 22:20
toxcct27-Feb-07 22:20 
GeneralRe: Display String Message.. Pin
Shah Satish27-Feb-07 22:30
Shah Satish27-Feb-07 22:30 
GeneralRe: Display String Message.. Pin
toxcct27-Feb-07 22:34
toxcct27-Feb-07 22:34 
QuestionIndenting the first line in Graphics::DrawString Pin
Bartosz Bien27-Feb-07 21:57
Bartosz Bien27-Feb-07 21:57 

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.