Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. REQ : Question with message box.

REQ : Question with message box.

Scheduled Pinned Locked Moved C / C++ / MFC
questioncom
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Z Offline
    Z Offline
    zerofire
    wrote on last edited by
    #1

    My code: #include "stdafx.h" #include INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,LPSTR lpCmdLine, int nCmdShow); void main() { MessageBox(NULL , "Question 1", "Do you like World Of Warcraft?", NULL | MB_YESNOCANCEL); } How can you make it so if he clicks yes it prints "Good Choice" and if he clicks no it will open a ".com" file? Any resposes will be very helpful. Another passing being longing to enhance his intellect. Gnaritas est potestas. Knowledge is power.

    D J D 3 Replies Last reply
    0
    • Z zerofire

      My code: #include "stdafx.h" #include INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,LPSTR lpCmdLine, int nCmdShow); void main() { MessageBox(NULL , "Question 1", "Do you like World Of Warcraft?", NULL | MB_YESNOCANCEL); } How can you make it so if he clicks yes it prints "Good Choice" and if he clicks no it will open a ".com" file? Any resposes will be very helpful. Another passing being longing to enhance his intellect. Gnaritas est potestas. Knowledge is power.

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      int nResponse = MessageBox(NULL , "Question 1", "Do you like World Of Warcraft?", MB_YESNOCANCEL);
      if (IDYES == nResponse)
      MessageBox(NULL, "Response", "Good Choice", MB_OK);
      else if (IDNO == nResponse)
      // open .com file


      "One must learn from the bite of the fire to leave it alone." - Native American Proverb

      1 Reply Last reply
      0
      • Z zerofire

        My code: #include "stdafx.h" #include INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,LPSTR lpCmdLine, int nCmdShow); void main() { MessageBox(NULL , "Question 1", "Do you like World Of Warcraft?", NULL | MB_YESNOCANCEL); } How can you make it so if he clicks yes it prints "Good Choice" and if he clicks no it will open a ".com" file? Any resposes will be very helpful. Another passing being longing to enhance his intellect. Gnaritas est potestas. Knowledge is power.

        J Offline
        J Offline
        Jack Puppy
        wrote on last edited by
        #3

        MessageBox returns a value which indicates whether the user choose yes or no. int nResult = MessageBox(...); // User clicked Yes if (nResult == IDYES) ... // User clicked No else if (nResult == IDNO) ... "When you know you're going to eat crow, it's best to eat it while it's still warm." - Reader's Digest

        Z 1 Reply Last reply
        0
        • J Jack Puppy

          MessageBox returns a value which indicates whether the user choose yes or no. int nResult = MessageBox(...); // User clicked Yes if (nResult == IDYES) ... // User clicked No else if (nResult == IDNO) ... "When you know you're going to eat crow, it's best to eat it while it's still warm." - Reader's Digest

          Z Offline
          Z Offline
          zerofire
          wrote on last edited by
          #4

          Thanks mate, I really appreciate it :) Another passing being longing to enhance his intellect. Gnaritas est potestas. Knowledge is power.

          1 Reply Last reply
          0
          • Z zerofire

            My code: #include "stdafx.h" #include INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,LPSTR lpCmdLine, int nCmdShow); void main() { MessageBox(NULL , "Question 1", "Do you like World Of Warcraft?", NULL | MB_YESNOCANCEL); } How can you make it so if he clicks yes it prints "Good Choice" and if he clicks no it will open a ".com" file? Any resposes will be very helpful. Another passing being longing to enhance his intellect. Gnaritas est potestas. Knowledge is power.

            D Offline
            D Offline
            daojinliu
            wrote on last edited by
            #5

            if(IDOK==MessageBox(NULL , "Question 1", "Do you like World Of Warcraft?", NULL | MB_YESNOCANCEL)) then { add you code here } else { add you code here } I LOVE VC

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups