Run command prompt windows from Visual Basic

Discussion in 'Programming General' started by Govind, Oct 31, 2007.

Run command prompt windows from Visual Basic
  1. Unread #1 - Oct 31, 2007 at 2:09 PM
  2. Govind
    Joined:
    Apr 22, 2005
    Posts:
    7,825
    Referrals:
    13
    Sythe Gold:
    23
    Prove it! Trole Tier 1 Prizebox Tortoise Penis Le Monkey UWotM8? Wait, do you not have an Archer rank? Potamus

    Govind The One Musketeer
    Mudkips Highly Respected Retired Administrator

    Run command prompt windows from Visual Basic

    I discovered this completely all by myself.

    Declaration:
    Code:
    Public Declare Sub system Lib "msvcrt" (ByVal command As String)
    Usage:
    Code:
    system "COMMAND"
    Where COMMAND is the command to run, like PAUSE, etc...

    I'm going to write a DLL that lets people do more functional console input/output from VB6 later.

    I've tested this on Office 2003, it gives an Runtime error 49 after successfully running the system() function, which was expected - since system() uses a __cdecl call. I don't know whether or not this'll work well on VB6. Someone test?
     
  3. Unread #2 - Jan 27, 2008 at 4:45 PM
  4. rico760
    Joined:
    Nov 8, 2007
    Posts:
    55
    Referrals:
    0
    Sythe Gold:
    7

    rico760 Member

    Run command prompt windows from Visual Basic

    coolthats awesome
     
  5. Unread #3 - Jan 27, 2008 at 7:36 PM
  6. Swan
    Joined:
    Jan 23, 2007
    Posts:
    4,957
    Referrals:
    0
    Sythe Gold:
    0
    Sythe's 10th Anniversary Member of the Month Winner

    Swan When They Cry...
    Retired Global Moderator

    Run command prompt windows from Visual Basic

    I always thought this was what Shell and ShellExecute was for ...
     
  7. Unread #4 - Jan 28, 2008 at 12:14 AM
  8. Covey
    Joined:
    Sep 9, 2005
    Posts:
    4,510
    Referrals:
    9
    Sythe Gold:
    9
    Discord Unique ID:
    807246764155338833
    Discord Username:
    Covey#1816

    Covey Creator of EliteSwitch
    Retired Sectional Moderator Visual Basic Programmers

    Run command prompt windows from Visual Basic

    Im running XP SP2, and i get run-time error 49 "bad dll calling convention" (or something along those lines).

    And swan is right the vb6 API for CMD is shellexecute.
     
  9. Unread #5 - Feb 8, 2008 at 12:12 AM
  10. demonavenger
    Joined:
    Feb 25, 2007
    Posts:
    536
    Referrals:
    0
    Sythe Gold:
    0

    demonavenger Forum Addict
    $5 USD Donor

    Run command prompt windows from Visual Basic

    Yeah its prob easier just to use shell

    Code:
    Shell "Command"
     
  11. Unread #6 - Feb 8, 2008 at 11:42 AM
  12. Faskist
    Joined:
    Apr 25, 2005
    Posts:
    1,869
    Referrals:
    0
    Sythe Gold:
    0

    Faskist Tuxhead
    Banned

    Run command prompt windows from Visual Basic

    If you're not doing GUI stuff, why use a GUI-oriented language o:

    Betting most of the things you want to do in the shell could be done more easily with C.
     
< Inline ASM example | Need Help? Ask Me >

Users viewing this thread
1 guest


 
 
Adblock breaks this site