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. command line

command line

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorial
4 Posts 3 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.
  • U Offline
    U Offline
    udayGovekar
    wrote on last edited by
    #1

    Hi All, consider Test.exe which is GUI based, now in command line \\directory\test.exe it invokes Test.exe, if user types \\directory\test.exe help ,particular help should be displayed simillar to c:\help a list of commands with description is displayed can anyone explain me on how to do this Thanks Uday

    A 1 Reply Last reply
    0
    • U udayGovekar

      Hi All, consider Test.exe which is GUI based, now in command line \\directory\test.exe it invokes Test.exe, if user types \\directory\test.exe help ,particular help should be displayed simillar to c:\help a list of commands with description is displayed can anyone explain me on how to do this Thanks Uday

      A Offline
      A Offline
      alex barylski
      wrote on last edited by
      #2

      Parse the command line parameter of WinMain(), determine if the commandline included help, then print the stuff to screen. console apps I guess use main() so you have to work with argv and argc argv is an array (if i remember correctly) of each paramter and argc is a count of the number of array elements... so argv[0] = test.exe (module name) and argv[1] would contain the text string help simple as that really "An expert is someone who has made all the mistakes in his or her field" - Niels Bohr

      U 1 Reply Last reply
      0
      • A alex barylski

        Parse the command line parameter of WinMain(), determine if the commandline included help, then print the stuff to screen. console apps I guess use main() so you have to work with argv and argc argv is an array (if i remember correctly) of each paramter and argc is a count of the number of array elements... so argv[0] = test.exe (module name) and argv[1] would contain the text string help simple as that really "An expert is someone who has made all the mistakes in his or her field" - Niels Bohr

        U Offline
        U Offline
        udayGovekar
        wrote on last edited by
        #3

        I need to use WriteConsole for that I have to get the Handle (Handle to the console screen buffer to be written to. The handle must have GENERIC_WRITE access. ) How to get this Handle?? I used , HANDLE hnd =GetStdHandle(STD_OUTPUT_HANDLE); buts its not working and also I used GetLastError() its returning 0 which means program executed correctly So ??

        D 1 Reply Last reply
        0
        • U udayGovekar

          I need to use WriteConsole for that I have to get the Handle (Handle to the console screen buffer to be written to. The handle must have GENERIC_WRITE access. ) How to get this Handle?? I used , HANDLE hnd =GetStdHandle(STD_OUTPUT_HANDLE); buts its not working and also I used GetLastError() its returning 0 which means program executed correctly So ??

          D Offline
          D Offline
          Dominik Reichl
          wrote on last edited by
          #4

          Are you using WinMain(...) or main(...). If you use WinMain, you have to call the function

          AllocConsole();

          before calling GetStdHandle(...); :-D -Dominik

          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