We help IT Professionals succeed at work.

Display a message box using C++

cemplukcute2003
on
839 Views
Last Modified: 2012-06-27
Hi, can anyone help me to figure out display a message box using C++ code.
I need the code to b compatible with Linux and Mac.
I have this code but it only can run in Windows.

#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <fstream>
#include <unistd.h>
#include <windows.h>
using namespace std;

int main()  {
      const char *filePath = "C:\\WINDOWS\\system32\\spool\\drivers32\\ss.mf";
      
      char *msg;

      if(remove(filePath) != 0) {
            msg = "Uninstallation Unsuccessful, Please Contact Admin";
            MessageBox(NULL, msg, "Msg", MB_OK | MB_ICONERROR);
      }
      else {
            msg = "Uninstallation Successful";
            MessageBox(NULL, msg, "Msg", MB_OK | MB_ICONINFORMATION);
      }

      return 0;
}

Can someone help me, pls?
Thanks in advance
Comment
Watch Question

CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
Hi, thx for all the replies.
But do you know which GUI library that i can use to pop up a message box in Linux and Mac platform?
I know that i'll need a different GUI library for them, but i can't find it.
I'm doing my final year project and i hope i can achieve this for the interface :)
Can you help me, pls? Thanks again
>>>> i'll need a different GUI library for them, but i can't find it.

pepr told you the wxwidget library and gave a link.

But it will be not a simple job to do. You need to convert your console project by using an appropriate (project) template for either platform.

Why not simply use a cout?  
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.