Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8360631
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T11:30:58+00:00 2026-06-09T11:30:58+00:00

I want to create a dynamic MessageBox using a char array, but i have

  • 0

I want to create a dynamic MessageBox using a char array, but i have some problem with the uType (UINT)..

If you watch my code, i first have a char string with | delimiters and it’s parsed into the array “a”. Then i convert my char into UINT but i cant get it work, it just doesnt show any messagebox.
Thanks for helping 🙂

char str[] ="Testing message|Title Message|MB_OK|MB_ICONINFORMATION";
char * pch;
char * a[4];
int i = 0;
pch = strtok (str,"|");
while (pch != NULL)
{
    a[i] = pch;
    pch = strtok (NULL, "|");
    //cout << a[i];
    i++;
}
char test[1000] = "";
strcat_s (test,a[2]);
strcat_s (test,"|");
strcat_s (test,a[3]);

UINT y;
stringstream s;
s << test;
s >> y;


MessageBox(0,a[0],a[1],y);
Sleep(10000);

Solution :

                        UINT x;
                            if(!strcmp(a[3],"MB_ICONERROR")){
                                x = 0x10;
                            }else if(!strcmp(a[3],"MB_ICONEXCLAMATION")){
                                x = 0x30;
                            }else if(!strcmp(a[3],"MB_ICONINFORMATION")){
                                x = 0x40;
                            }else if(!strcmp(a[3],"MB_ICONQUESTION")){
                                x = 0x20;
                            }
                            if(!strcmp(a[2],"MB_OK")){
                                x = x + 0;
                            }else if(!strcmp(a[2],"MB_OKCANCEL")){
                                x = x + 1;
                            }else if(!strcmp(a[2],"MB_YESNO")){
                                x = x + 4;
                            }else if(!strcmp(a[2],"MB_YESNOCANCEL")){
                                x = x + 3;
                            }else if(!strcmp(a[2],"MB_RETRYCANCEL")){
                                x = x + 5;
                            }else if(!strcmp(a[2],"MB_ABORTRETRYIGNORE")){
                                x = x + 2;
                            }
                            MessageBox(0, a[0], a[1], x);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T11:30:59+00:00Added an answer on June 9, 2026 at 11:30 am
    MB_OK|MB_ICONINFORMATION
    

    Those are ‘enumerations’ and not actual strings.
    In your program (outside of the string), they would get replaced by numbers.
    What you’re doing, is trying to convert a plain string into a number, which obviously doesn’t yield the expected result, since the system doesn’t recognize the enumerations any more then.

    I suggest using some sort of mask, or inputting the ‘plain’ value into the string.
    For your example, that’s 0x40, as can be seen here.

    So, try to use a string like this:

    char str[] ="Testing message|Title Message|0x40";
    

    And make sure, that the last element is treated as Integer, and not as ‘string’.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some data and want to create some dynamic charts. I have looked
I have issue where i want to create Dynamic function which will do some
I have an .NET 4.0 application using Caliburn.Micro. I want to create a dynamic
I want to create a dynamic 2d array by function but it seems that
Let's say I want to create a dynamic library dynamic.so , but my code
I have a global JavaScript array that contains some strings. I want to create
I want to create dynamic UITextField with different object name.I have shown the code
i want create Dynamic Slideshow in Jquery i'm Write this code var ctx =
Here is the problem details: 1) I want to create dynamic (ip based) download
I want to create a Dynamic aspx Page in current solution through code-behind..forexample i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.