1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Display a message box using C++

Discussion in 'Programming' started by fr33d0m, Aug 20, 2007.

  1. #1
    Hi, i need help :)
    I want to create a code that will generate a message box.
    The code must also b compatible with Linux and Mac.
    I have a code but it only can work 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;
    }
    
    Code (markup):
    Can someone help me, pls? I really need this.
    Thanks in advance
    SEMrush
     
    fr33d0m, Aug 20, 2007 IP
    SEMrush
  2. TwistMyArm

    TwistMyArm Peon

    Messages:
    931
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #2
    OK, so the biggest problem here is that you are not using standard C++: you're using MS Visual C++.

    Without reverting to things like emulators for the other OS', you will need to use a cross-platform GUI library instead. Off the top of my head, there's one called wxWidgets you should be able to use...
     
    TwistMyArm, Aug 20, 2007 IP
  3. fr33d0m

    fr33d0m Peon

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks for the reply :)
    Ooo, so sorry. I'm a novice in C++ :)
    I found out that code from internet and i modified it accordingly.
    Can you tell me what's the standard C++ GUI library for displaying message box?
    Or i must use wxWidget to do it?
    Thanks
     
    fr33d0m, Aug 20, 2007 IP
  4. TwistMyArm

    TwistMyArm Peon

    Messages:
    931
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Standard C++ has no window GUI support: you need to use some form of GUI library to do it. wxWidgets is just one of those libraries, but it was the first one to come to mind.
     
    TwistMyArm, Aug 20, 2007 IP
  5. sea otter

    sea otter Peon

    Messages:
    250
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    0
    #5
    The Qt library from trolltech is also a major player in the cross-platform gui world.
     
    sea otter, Aug 20, 2007 IP
  6. Testing whiz

    Testing whiz Peon

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    As "sea otter" said you can use QT for development of GUI in cross platform environment. It provides best widgets and excellent library commands. And ya, it is now NOKIA subsidiary, not trolltech.
     
    Testing whiz, Feb 3, 2010 IP
  7. 420kking

    420kking Peon

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    There's always Windows API
     
    420kking, Feb 3, 2010 IP
  8. NeoCambell

    NeoCambell Peon

    Messages:
    456
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #8
    I also give my first preference to wxWidgets.

    Fast Light Toolkit is also a good and free option as it supports UNIX/Linux(X11), Windows and MacOS X.
     
    NeoCambell, Feb 4, 2010 IP