Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

open with dialog box

Status
Not open for further replies.

poeijer

Programmer
May 29, 2002
69
NL
Is there any way to display the open with dialog box??

i found some on the internet how to do it with VB but i need it in vfp ofcourse :)

any ideas? thanks.

 
poeijer

Can you post the VB code, someone might be able to translate it.
But doesn't the "open with" dialog only appear when you right-mouse on a file in Windows explorer? Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Normally the open with dialog appears when u try to open a file and there cant be a programme found to open the file with. (unknown file extension) i been looking for quite some time. but i just found it.

ill post the code below here so more of us can enjoy from it.

-----------------------

LOCAL lnRetval, lcFile, lcOperation
lcFile = "c:\just_for_test.unkown"
lcOperation = "Open"
DECLARE INTEGER ShellExecute IN SHELL32.DLL ;
INTEGER handle,;
STRING @sFile,;
STRING @lp,;
STRING @dir,;
STRING @dir1,;
INTEGER ncmd
lnRetval = ShellExecute(0, lcOperation, lcFile, "", "", 1)
IF lnRetval=31
DECLARE INTEGER GetDesktopWindow IN user32.dll
DECLARE INTEGER GetSystemDirectory IN kernel32.dll ;
STRING @lsBuffer, ;
INTEGER liSize

lsSysDir = SPACE(260) && MAX_PATH, the maximum path length
liRet = GetSystemDirectory(@lsSysDir, LEN(lsSysDir))
lsSysDir = SUBSTR(lsSysDir, 1, liRet)
lsRun = "RUNDLL32.EXE"
lsParameters = "shell32.dll,OpenAs_RunDLL "
liRet = ShellExecute(GetDesktopWindow(), "open", lsRun,;
lsParameters + lCFile, lsSysDir, 1)

ENDIF
------------------

this tries to open the file just_for_test.unknow.
the shellexecute returns a 31 value, that is the return value when there is no programme found to open the file with.
 
Hej !
May be you want something like this (from Help):
Displays the Open dialog box and returns the name of the file you chose.
GETFILE([cFileExtensions] [, cText] [, cOpenButtonCaption]
[, nButtonType] [, cTitleBarCaption])

Kind regards from Warsaw !!!!!
Monika (monikai@yahoo.com)
 
poeijer

I tested your code, but a strange things lnRetval for me (Win98, VFP7.0 and VFP6.0) returns a "2" not "31". Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
If u get errorcode 2 it means the file cant be found.
it the value is 3 the path cant be found.

u can check out here for the different return values shellexecute can generate


Thank you for the link, and I guess that solves your own problem.

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top