Wrox Programmer Forums
|
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 15th, 2007, 03:57 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

well.. not really.. filecopy is sync, but the OS no, so sometimes filecopy issues the command, the OS return ok, but the file is not really copied, it takes some time...

what if you run it manually.. you see the correct path?? (of the copied version?)

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========
 
Old November 15th, 2007, 04:11 PM
Authorized User
 
Join Date: Nov 2007
Posts: 54
Thanks: 1
Thanked 0 Times in 0 Posts
Default

yes, it shows me the right path if I run it manually.
Good point, for file copy. Hm, should I create a loop to waste some time after file copy or something like that ?
I will get back on that, once I am done.

 
Old November 15th, 2007, 04:50 PM
Authorized User
 
Join Date: Nov 2007
Posts: 54
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Nope, the same problem. I have added a loop to check for file existance and then run another loop that waste some time. Shell function still runs the executable, but from the same old location and not from the location where it has been copied and asked to run.

 
Old November 15th, 2007, 04:51 PM
Authorized User
 
Join Date: Nov 2007
Posts: 54
Thanks: 1
Thanked 0 Times in 0 Posts
Default

i tested with this code now:
Code:
Private Sub Command3_Click()

    Dim src As String
    Dim des As String
    Dim count As Integer
    Dim resDes As String
    Dim Result As String
    Dim i As Integer
    Dim runExe As Double
    Dim finPath As String


    src = seiengFile
    des = SDRSFile

    'NM: finding the folder that contains the sdrs files. The path is parced to locate
    'the last back slash. The location is used as a second argument for Left function to get to the folder.

    For i = 0 To Len(des)
        resDes = Mid(des, Len(des) - i, 1)
        If (resDes = "\") Then
            count = Len(des) - i
            Exit For
        End If
    Next i

    Result = Left(des, count)

    finPath = Result & "SEIENG.exe"

    FileCopy src, finPath


    Dim objFileSystem As Object
    Dim FileToCheck As String
    Dim ct As Integer

    Set objFileSystem = CreateObject("Scripting.FileSystemObject")


    FileToCheck = finPath
    Do Until objFileSystem.FileExists(FileToCheck)

        For ct = 1 To 2000
        Next ct
    Loop

    Set objFileSystem = Nothing


    Debug.Print "finPath = " & finPath
    Debug.Print "Result + executable = " & Result & "SEIENG.exe"
    runExe = Shell(finPath, vbMaximizedFocus)

    frmSeieng.Hide

End Sub
 
Old November 16th, 2007, 08:18 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

if you do it manually, it's show the rigth path???

if you are shelling to a fortram program, then you are running it by some kind of compiler (it's not an exe, isn't it??) maybe it's showing the path from the compiler???

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========
 
Old November 16th, 2007, 09:37 AM
Authorized User
 
Join Date: Nov 2007
Posts: 54
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Yes, when I run it manually it shows the right path.
I am positive it is an .exe file and does not require a compiler.

 
Old November 16th, 2007, 09:42 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

then you got me atonish.. since I can't see your enviroment, I can't help you any further.. if I come up with any idea I will post it.. but rigth now, it should work ok... unless you are executing the wrong one...

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========
 
Old November 16th, 2007, 11:17 AM
Authorized User
 
Join Date: Nov 2007
Posts: 54
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Please let me know if you come up with anything.
Thanks for all your help you have rendered so far.

 
Old November 16th, 2007, 11:24 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

ok.. another idea..

you want to see if the code on VB run?? well.. let's forget about the copy and everything.. what happend if you just shell to the exe you want??

I mean.. delete all the copies of the program from your HD, just leave the one on the exe folder, and add a button that just do the shell.. and check the path it appear...

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========
 
Old November 16th, 2007, 02:04 PM
Authorized User
 
Join Date: Nov 2007
Posts: 54
Thanks: 1
Thanked 0 Times in 0 Posts
Default

this is simply beyond me, I am banging my head with the computer monitor.
I hard coded the destination, to my utter surprise and dismay it is still showing me the original path from where I copied the exe file. Help me or I will die of curiosity. I got rid of file copy, and path parcing part of the code. Now just left with the function name and have used the following shell command.
Code:
runExe = Shell("C:\Documents and Settings\hianxm\Desktop\QCM - testing\SEIENG.exe", vbMaximizedFocus)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Running executable file Promod333 Visual Basic 2005 Basics 1 September 7th, 2007 10:15 AM
Timed Executable KennethMungwira Beginning VB 6 1 July 28th, 2006 10:55 AM
Executable - From Server KennethMungwira VB.NET 0 July 20th, 2006 02:33 PM
Tracing via executable bmains VB.NET 1 April 29th, 2004 02:41 PM
Running a VB6 app as a service adman Pro VB 6 3 April 6th, 2004 02:21 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.