Hi All,
So progressing onto my next challenge.
Now that I have the document selection working nicely, and stored in a table, I would like to enable users to select document records from a grid, and when "double-click" the record, it launches the file.
My thought was ShellExecute would work well for this, and I have one that I wrote many years ago, but have since forgotten really what this is, and VFP doesn't seem to document it, since it's really a call to the OS (if I understand it correctly.
The one I currently have is limited to PDF files. I was hoping to find a way to make this work so that whatever file I shove at it, it will launch it automatically... My current Procedure is called LAUNCHPDF, but I'd like something more like "LAUNCHFILE"
The code looks like this:
This works great for launching a dynamic list of PDFS that I create on my top line menu bar (but this was intended to launch "PDF Books" as part of a set of standards (not related to development, but to my application industry).
How would I change this so that if I throw a .XLSX or a .DOC or a .DWG or... an anything at it, that it would launch it?
Or is that the wrong approach?
Do I need some series of CASE statement and identify the file types ahead of time?
I find this one particularly confusing because I just don't know much about the "Shell32" dll.
Best Regards,
Scott
ATS, CDCE, CTIA, CTDC
"Everything should be made as simple as possible, and no simpler."![[hammer] [hammer] [hammer]](/data/assets/smilies/hammer.gif)
So progressing onto my next challenge.
Now that I have the document selection working nicely, and stored in a table, I would like to enable users to select document records from a grid, and when "double-click" the record, it launches the file.
My thought was ShellExecute would work well for this, and I have one that I wrote many years ago, but have since forgotten really what this is, and VFP doesn't seem to document it, since it's really a call to the OS (if I understand it correctly.
The one I currently have is limited to PDF files. I was hoping to find a way to make this work so that whatever file I shove at it, it will launch it automatically... My current Procedure is called LAUNCHPDF, but I'd like something more like "LAUNCHFILE"
The code looks like this:
Code:
PROCEDURE LAUNCHPDF
PARAMETERS ACROFILE, txtType
declare INTEGER ShellExecute in shell32 ;
INTEGER handle, STRING @ oper, STRING @ ifile,;
STRING @ iparam, STRING @ ipath, INTEGER showcmd
=SHELLEXECUTE(0,"open",'"'+txtType+ACROFILE+'.PDF'+'"',"","",1)
This works great for launching a dynamic list of PDFS that I create on my top line menu bar (but this was intended to launch "PDF Books" as part of a set of standards (not related to development, but to my application industry).
How would I change this so that if I throw a .XLSX or a .DOC or a .DWG or... an anything at it, that it would launch it?
Or is that the wrong approach?
Do I need some series of CASE statement and identify the file types ahead of time?
I find this one particularly confusing because I just don't know much about the "Shell32" dll.
Best Regards,
Scott
ATS, CDCE, CTIA, CTDC
"Everything should be made as simple as possible, and no simpler."
![[hammer] [hammer] [hammer]](/data/assets/smilies/hammer.gif)