Results 1 to 10 of 10

Thread: Launching Application from VB6 by Shell

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2004
    Posts
    6

    Launching Application from VB6 by Shell

    Dear All
    I need to run a paging programmer application inside my Visual Basic 6, application,
    I am using Shell command as below;

    dim retVal
    retVal = Shell ( "C:\Programminh\...\Elf.exe",vbMaximizedFocus)
    AppActivate retVal

    The application runs perfect but the problem is, when the application lauch, it can not find parallel port. But when I run the application out of my VB6 application, It works fine,

    I know there is another command in VB6 to launch external application but I can not remember,

    Can anybody help me please,

    Regards

    Behnam

  2. #2
    Member
    Join Date
    Jul 2004
    Location
    The Netherlands
    Posts
    33
    VB Code:
    1. Private 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
    2.  
    3. Private Sub Form_Load()
    4.     ShellExecute Me.hwnd, vbNullString, "C:\Programminh\...\Elf.exe", vbNullString, "C:\", vbMaximizedFocus
    5. End Sub

  3. #3

    Thread Starter
    New Member
    Join Date
    Nov 2004
    Posts
    6
    There is no difference,
    Still it can not find Parallel port even I used ShellExecute

    Thanks
    Behnam

  4. #4

    Thread Starter
    New Member
    Join Date
    Nov 2004
    Posts
    6
    Can anybody let me know what is the other command for launching external application,
    I know there are other commands in VB apart from Shell and ShellExecute

    Regards
    Behnam

  5. #5
    Addicted Member Merlin's Avatar
    Join Date
    Dec 2000
    Location
    Eau Claire, WI
    Posts
    233
    It doesn't matter how you launch the application. An execute call is an execute call. Your application may run differently from design mode than in compiled mode. It may have to do with Windows permissions as well. If the program runs stand alone when compiled then it should execute the same from VB.
    poooof

    Wizard Since 1997
    SQL Server 7.0:2K, Oracle, VB 6.0 EE, VBScript, C/C++, COBOL, RPG ILE, HTML, XML, Perl

  6. #6

    Thread Starter
    New Member
    Join Date
    Nov 2004
    Posts
    6
    Hi
    Thanks for your email.
    my external application which is Elf.exe will run perfect if I run it from desktop. Or run it from explorer. But if I run it from my own executable appliction which I made exe by VB6, It still runs the Elf.exe but Elf.exe can not find parallel port when it runs from my application.

    I tried Shell and ShellExecute.
    I know there are other command for runing application from VB6 which I have not tried yet, can you please let me know what are they??


    Thanks

    Behnam

  7. #7
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    is the port being used by the OS?

  8. #8

    Thread Starter
    New Member
    Join Date
    Nov 2004
    Posts
    6
    I SOLVED THE PROBLEM

    I put the Elf.exe inside a .bat file and ran the .bat file from my application and it worked.

    Thanks all anyway

    Behnam

  9. #9
    PowerPoster jdc2000's Avatar
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    2,526
    Which Windows version are you using?

  10. #10

    Thread Starter
    New Member
    Join Date
    Nov 2004
    Posts
    6
    WINDOWS 98

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