×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

exe run bat
2

exe run bat

exe run bat

(OP)

    
I would like to make test.exe vithe FoxPro 8 that will run extern test.bat
can you help
I am new at this
I thak you for any help  

RE: exe run bat

You should use the CreateProcess function. I'm not real familiar with FoxPro syntax, so I googled "CreateProcess FoxPro" and came up with a bunch of hits, this one was at (or near) the top.
http://support.microsoft.com/kb/q153904/
 

im in ur stakz, overflowin ur heapz!

RE: exe run bat

Don't forget that since it's a batch file, you'll need to really call the command-interpreter.

CODE

<COMSPEC> /C EXTERN.BAT

----------
Measurement is not management.

RE: exe run bat

(OP)
Thank you
So in the above link I have to change the line:
c:\\winnt351\\system32\\notepad.exe
?


and
<COMSPEC> /C EXTERN.BAT
what is '/C' for?
 

RE: exe run bat

(OP)
Thank you, but I have a problem. THis is wat I have:

CODE

DECLARE INTEGER ShellExecute ;
     IN SHELL32.DLL ;
     INTEGER nWinHandle,;
     STRING cOperation,;
     STRING cFileName,;
     STRING cParameters,;
     STRING cDirectory,;
     INTEGER nShowWindow

ShellExecute( 0, "Open", "WFTV.bat", "", "", 1 )

It works OK on comp that I have FoxPro, but I need it on second and that is whare I get that "MSVCR70.dll" is missing. When I  provide that I get "Cannot locate the Microsoft Visual FoxPro support library." How can I fix it. Please don't tell me to install there FoxPro. I is not an option.
For any help I would be thankful!

RE: exe run bat

I'm not sure which file it's looking for, but what I always recommend people to do when they run into this problem is fire up Process Monitor. It's a free utility from microsoft that will allow you to see what resources your application are calling at run time and where the application is expecting it to be.

In addition to this, Dependency Walker (installed with visual studio) will produce a tree of all files that are needed for your application to run. You just go down the list and find all of the ones that you need.

Now, as I stated previously, I'm not REAL familiar with FP...but is there an install package that you can set up so that it will automatically get all of the files you need? In other languages, the setup package will scan your app and pull in all files that are needed and include them in the package.

im in ur stakz, overflowin ur heapz!

RE: exe run bat

(OP)
ok, now it works . Thank you all.

But on my second comp (that doesn't have installed FoxPro) window that I run closes immediately. I have an idea that will fix it.

RE: exe run bat

(OP)
I give up.
I have don't have *.bat any more. All I have is a line:

CODE

RUN 'C:\WINDOWS\system32\cmd.exe /c start "Title" /AboveNormal C:\WINDOWS\notepad.exe'
When I run it I get a message:
No PARAMETER statement is found.

And three options:
Cancal    Ignore    Help

If I press Cancel it closes.
If I press Ignore starts the program (just what I want!) - can I make it go around this?
If I press Help nothing hepens. I assume because I don't have FoxPro on that comp.

If I go with:

CODE

DECLARE INTEGER ShellExecute IN SHELL32.DLL ;
     INTEGER nWinHandle, ;
     STRING cAction, ;    
     STRING cFileName, ;  
     STRING cParameters, ;
     STRING cDirectory, ;
     INTEGER nShowWindow  
     
cAction = "Open"
cFileName = "C:\Programs\WFTVFM\WFTV.bat"
ShellExecute( 0, cAction, cFileName, "", "", 2 )

WFTV.bat has:

CODE

start "title" /AboveNormal "C:\WINDOWS\notepad.exe"

Same thing hapens only that when I click Ignore another error occurs:
File 'shellexecute.prg' does not exist.
No matter what I click here (Cancel or Ignore) it closes.

All I would like to do is to make an *.exe that would start notepad in  'AboveNormal' priority.


Any ideas, PLEASE?

RE: exe run bat

What is start?

What happens if you put
start "title" /AboveNormal "C:\WINDOWS\notepad.exe"
in Run window of Start Menu?

Borislav Borissov
VFP9 SP2, SQL Server 2000/2005.
Microsoft MVP VFP

RE: exe run bat

(OP)

CODE

start
is a batch command

command:

CODE

start "title" /AboveNormal "C:\WINDOWS\notepad.exe"
starts notepad in AboveNormal priority

RE: exe run bat

Could you do this that way:
1. Press Start Button.
2. Press Run from Menu
3. type [start "title" /AboveNormal "C:\WINDOWS\notepad.exe"]
4. Press Enter
Just because I can't.

 

Borislav Borissov
VFP9 SP2, SQL Server 2000/2005.
Microsoft MVP VFP

RE: exe run bat

(OP)
doesn't work from run
I have to put it in to cmd

RE: exe run bat

OK...I did some research on the start command. I think you'll be better off running the notepad directly from the createprocess method. Essentially, what you're doing is wrapping the executable with a batch file, then wrapping the batch file with an executable. Just go from executable to executable.

im in ur stakz, overflowin ur heapz!

RE: exe run bat

(OP)
How do I run:

CODE

start "title" /AboveNormal "C:\WINDOWS\notepad.exe"

in createprocess

RE: exe run bat

(OP)
How do I run:

CODE

start "title" /AboveNormal "C:\WINDOWS\notepad.exe"
in ShellExecute

RE: exe run bat

(OP)
I have

CODE

DECLARE INTEGER CreateProcess IN kernel32;
    STRING   lpApplicationName,;
    STRING   lpCommandLine,;
    INTEGER  lpProcessAttributes,;
    INTEGER  lpThreadAttributes,;
    INTEGER  bInheritHandles,;
    INTEGER  dwCreationFlags,;
    INTEGER  lpEnvironment,;
    STRING   lpCurrentDirectory,;
    STRING   lpStartupInfo,;
    STRING @ lpProcessInformation
    
cApp = "C:\WINDOWS\notepad.exe"

cStartInfo = long2str(68) + REPLICATE(CHR(0), 64)
cProcInfo = REPLICATE(CHR(0), 16)

= CreateProcess( cApp, NULL, 0, 0, 0, 0, 0, SYS(5)+SYS(2003), @cStartInfo, @cProcInfo )

FUNCTION long2str
      PARAMETERS m.longval

      PRIVATE i, m.retstr

      m.retstr = ""
      FOR i = 24 TO 0 STEP -8
         m.retstr = CHR(INT(m.longval/(2^i))) + m.retstr
         m.longval = MOD(m.longval, (2^i))
      NEXT
      RETURN m.retstr

and

CODE

DECLARE INTEGER ShellExecute IN SHELL32.DLL ;
     INTEGER nWinHandle, ; && handle of the program's parent window, usually set this to 0
     STRING cAction, ;     && action to be performed
     STRING cFileName, ;   && file on which the action is to be performed
     STRING cParameters, ; && If the file is an executable program, these are the parameters (if any) that are passed to it in the command line
     STRING cDirectory, ;  && If the file is an executable program, this is the program's default or start-up directory
     INTEGER nShowWindow   && program's initial window state (1 = normal, 2 = minimized, 3 = maximized)
     
cAction = "Open"
cFileName = 'C:\WINDOWS\notepad.exe'

ShellExecute( 0, cAction, cFileName, "", "", 2 )
but how do I put

CODE

start "title" /AboveNormal
in

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close