What do you mean by "call mspaint.exe in VFP application "? If you are just trying to run it then you could use the RUN command or an API call to ShellExecute, but if you mean automate it in some fashion then please post back and explain what you are trying to do in a little more detail. Thanks.
Slighthaze = NULL
[ul][li]FAQ184-2483 An excellent guide to getting a fast and accurate response to your questions in this forum.[/li][/ul]
Here's the code from _shellexecute modified and tersely explained:
[tt]
CLEAR
* Open the document with mspaint
ShellExecuteVFP("MsPaint","1000.jpg","C:\Documents and Settings\default user\My Documents\My Pictures\","open"
* Open the document with its default application
ShellExecuteVFP("C:\Documents and Settings\default user\My Documents\My Pictures\1000.jpg",,,)
* Open windows explorer
ShellExecuteVFP("c:\\Program Files",,,"open"
* Open the windows search dialog
ShellExecuteVFP("c:\\Program Files",,,"find"
CLEAR DLLS
FUNCTION ShellExecuteVFP(lcFileName, lcParams, lcWorkDir, lcOperation)
* WinApi :: ShellExecute
** Function: Opens a file in the application that it's
** associated with.
** Pass: lcFileName - Name of the file to open or an executable
** lcParams - If lcFileName is an executable, lcParams
** is/are the parameters to the executable
** lcWorkDir - The default directory to use
** lcOperation - The operation/verb to perform on lcFileName
** edit - Launches an editor and opens the document for editing.
** find - Initiates a search starting from the specified directory.
** open - Launches an application. If this file is not an executable file,
** its associated application is launched.
** print - Prints the document file.
** properties - !Displays the file or folder's properties!
** Included here for completeness, you won't be able to
** use this verb in VFP
**
** Return: 2 - Bad Association (e.g., invalid URL)
** 31 - No application association
** 29 - Failure to load application
** 30 - Application is busy
**
** Values over 32 indicate success
** and return an instance handle for
** the application started
LOCAL lcWorkDir,lcOperation
I've run your API code and it works well. But can I get all the programmes installed in my computer available for open and edit the file I specified ? for example, I want to edit a bitmap file. In which way can I get the list of the available programmes installed in my computer ? So I can choose one to do it. I think maybe API can do it, right ? Thanks.
If you want mspaint.exe to open a .bmp through a ShellExecute() WinAPI call, you need to ensure that .bmp files are associated with mspaint.exe.
That is a Windows issue - ShellExecute() will always open and print a file with the windows associated application.
Some graphics applications require user intervention before printing and some will print size for size as opposed to an isometric image which would match the paper size selected.
There are freeware graphics applications such as IrfanView which offer far more scope than mspaint.exe.
IrfanView, for example, will allow you select which image file type to associated with it, and saves the hassle of doing through the Windows interface.
You can look at faq184-3839 to see how to associate a certain program with the .BMP extension...
However, I think you're asking how you can get windows to bring up all the programs on your system that are capable of working with BMP files...and that I am sorry to say I don't know how to do. Windows must have a way of figuring out some of the apps that can work with a certain file since it will sometimes give me a short list when I right-click on a file and go to "open with".
Slighthaze = NULL
[ul][li]FAQ184-2483 An excellent guide to getting a fast and accurate response to your questions in this forum.[/li][/ul]
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.