CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8

Threaded View

  1. #1
    Join Date
    Mar 2017
    Posts
    1

    C++ Create Simple Window

    //The first box appears, but then it stops after that. Please help, and thanks in advanced!

    Code:
    #include <iostream>
    #include <windows.h>
    using namespace std;
    
    const string title = "Diplomacy :: Version 0.01 :: Created by onlineone22";
    
    int WINAPI WinMain(HINSTANCE hInstance,
                       HINSTANCE hPrevInstance,
                       LPSTR lpCmdLine,
                       int nCmdShow)
    {
        int launch = MessageBox(NULL, "Would you like to launch Diplomacy?", title.c_str(), MB_YESNO);
    
        if(launch == IDYES)
        {
            CreateWindowEx
            (
                0,
                NULL,
                title.c_str(),
                WS_SYSMENU,
                CW_USEDEFAULT,
                CW_USEDEFAULT,
                445,
                445,
                HWND_DESKTOP,
                NULL,
                hInstance,
                NULL
            );
        }
    
        return 0;
    }
    Last edited by 2kaud; March 23rd, 2017 at 03:46 AM. Reason: Added code tags

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured