Results 1 to 8 of 8

Thread: Can VB do it?

  1. #1
    Join Date
    Dec 2004
    Posts
    77
    Rep Power
    0

    Question Can VB do it?

    Does anyone know wat command is used in vb to other programs? I am writing a program that will activate other programs, everything is finish except for the "activation part" . I have tried everything I know and still can find the command that start an external application .

  2. #2
    Join Date
    Oct 2004
    Posts
    4,814
    Rep Power
    24

    Default Re: Can VB do it?

    uhmm, i don't know either. i am not really a vb person, but quick question. Why did you finish most of the program if you were not sure if VB could do something like that?

  3. #3
    Join Date
    Dec 2004
    Posts
    77
    Rep Power
    0

    Default Re: Can VB do it?

    VB was used to design C++, C++ was used to make windows. So VB should be able to do it.

  4. #4
    Join Date
    Oct 2004
    Posts
    4,814
    Rep Power
    24

    Default Re: Can VB do it?

    Quote Originally Posted by Eynestyne
    VB was used to design C++, C++ was used to make windows. So VB should be able to do it.
    no my friend, C++ was designed from C, and C existed long before VB you can read on the history of both langues from these links:

    History Of C++
    History Of C

    and finally some History on VB
    History Of VB

    But apart from the history lessons i did find this on the internet also:

    Question:
    I am currently working on a small programming project in VB6 and I can't remember this one :
    I am trying to run a command line (format : C:\sofware\myprog.exe 1234 ) from my VB6 software.

    I did some routines that if case A happens, run this command line ...

    how do I make VB6 run an external program without being linked or anything ..

    thanks !
    Answers:
    Accepted Answer from JohnBPrice Date: 01/06/2005 05:35AM PST

    shell "C:\sofware\myprog.exe 1234"

    Assisted Answer from Dhaest Date: 01/06/2005 05:36AM PST

    Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

    ShellExecute Me.hwnd, "Open", "c:\abc.pdf", 0&, 0&, SW_SHOWNORMAL

    Assisted Answer from Dhaest Date: 01/06/2005 05:37AM PST

    MyAppId = Shell( [path of the program], vbNormalFocus)
    AppActivate MyAppId
    I could not post the link becuase you would have to register to the site to see the solutions.

    Boy after that i will have to do a whole day of c, c++, java or c# to get the vb taste out of my head.
    Last edited by leoandru; Mar 27, 2005 at 10:09 AM.

  5. #5
    Join Date
    Oct 2004
    Posts
    4,814
    Rep Power
    24

    Default Re: Can VB do it?

    here is another thread discussing the same thing > http://www.techjamaica.com/forums/sh...ad.php?t=10210

  6. #6
    Join Date
    Mar 2004
    Posts
    774
    Rep Power
    0

    Default Re: Can VB do it?

    use the shell command to execute external programs with VB.

    shell "C:/program location/runme.exe"
    Nickname: Virus
    Occupation: Software Engineer
    Education: B.Sc. Computer Information Science, Asc. Mass Communication, MCSD, MCSE and CCNA

  7. #7
    Join Date
    Feb 2005
    Posts
    85
    Rep Power
    0

    Default Re: Can VB do it?

    try this
    AppActivate Statement Example
    This example illustrates various uses of the AppActivate statement to activate an application window. The Shell statements assume the applications are in the paths specified. On the Macintosh, the default drive name is "HD" and portions of the pathname are separated by colons instead of backslashes.

    Dim MyAppID, ReturnValue
    AppActivate "Microsoft Word" ' Activate Microsoft
    ' Word.

    ' AppActivate can also use the return value of the Shell function.
    MyAppID = Shell("C:\WORD\WINWORD.EXE", 1) ' Run Microsoft Word.
    AppActivate MyAppID ' Activate Microsoft
    ' Word.



    ' You can also use the return value of the Shell function.
    ReturnValue = Shell("c:\EXCEL\EXCEL.EXE",1) ' Run Microsoft Excel.
    AppActivate ReturnValue ' Activate Microsoft
    ' Excel.

  8. #8
    Join Date
    Feb 2005
    Posts
    85
    Rep Power
    0

    Default Re: Can VB do it?

    if that doesn't work try this
    Working Across Applications


    Visual Basic can create new objects and retrieve existing objects from many Microsoft applications. Other applications may also provide objects that you can create using Visual Basic. See the application's documentation for more information.

    To create an new object or get an existing object from another application, use the CreateObject function or GetObject function:

    ' Start Microsoft Excel and create a new Worksheet object.
    Set ExcelWorksheet = CreateObject("Excel.Sheet")

    ' Start Microsoft Excel and open an existing Worksheet object.
    Set ExcelWorksheet = GetObject("SHEET1.XLS")

    ' Start Microsoft Word.
    Set WordBasic = CreateObject("Word.Basic")

    Most applications provide an Exit or Quit method that closes the application whether or not it is visible. For more information on the objects, methods, and properties an application provides, see the application's documentation.

    Some applications allow you to use the New keyword to create an object of any class that exists in its type library. For example:

    Dim X As New Field

    In this case, Field is an example of a class in the data access type library. A new instance of a Field object is created using this syntax. Refer to the application's documentation for information about which object classes can be created in this way.

Posting Permissions

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