By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,466 Members | 2,171 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,466 IT Pros & Developers. It's quick & easy.

fHandleFile() Function in Terminal Server

P: n/a
Is anyone using the fHandleFile() from "The Access Web" site in a Terminal
Server environment? I just discovered today that it doesn't work for me.
Even though I can double-click a PDF file and Acrobat is automatically
launched, the function is returning the "File Not Found" error from my app.

I was using this instead of FollowHyperlink because I don't like the way
that the Access app is minimized when using that.

TIA
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Can you elaborate on that a bit? Did you have to modify the fHandleFile()
function?
--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
"Chuck Grimsby" <c.*******@worldnet.att.net.invalid> wrote in message
news:7p********************************@4ax.com...

Works for me... Although as I recall, I had to use the
"GetShortPathName" API call due to spaces in the application's path.
On Mon, 26 Apr 2004 11:19:52 -0500, "Rick Brandt"
<ri*********@hotmail.com> wrote:
Is anyone using the fHandleFile() from "The Access Web" site in a TerminalServer environment? I just discovered today that it doesn't work for me.Even though I can double-click a PDF file and Acrobat is automatically
launched, the function is returning the "File Not Found" error from my app.I was using this instead of FollowHyperlink because I don't like the way
that the Access app is minimized when using that.

Nov 12 '05 #2

P: n/a
Thanks; a preliminary test seems to indicate that this will solve the
problem.
--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
"Chuck Grimsby" <c.*******@worldnet.att.net.invalid> wrote in message
news:ll********************************@4ax.com...

Opps. Sorry... My bad.. The version I have of fHandleFile is a bit
different then what's posted at the Access Web. I've no idea why...

The code I have uses the FindExecutable API call to determine which
program to use, then Shells that:

Private Const MAX_PATH = 260
Private Const ERROR_NOASSOC = 31
Private Const ERROR_FILE_NOT_FOUND = 2&
Private Const ERROR_PATH_NOT_FOUND = 3&
Private Const ERROR_BAD_FORMAT = 11&
Private Const ERROR_OUT_OF_MEM = 0

Private Declare Function FindExecutable _
Lib "shell32.dll" _
Alias "FindExecutableA" _
(ByVal lpFile As String, _
ByVal lpDirectory As String, _
ByVal lpResult As String) _
As Long

Private Declare Function GetShortPathName _
Lib "kernel32" _
Alias "GetShortPathNameA" _
(ByVal lpszLongPath As String, _
ByVal lpszShortPath As String, _
ByVal cchBuffer As Long) _
As Long

Private Function FindEXE(strFile As String, _
strDir As String) _
As String

Dim lpResult As String
Dim lngRet As Long
lpResult = Space$(MAX_PATH)
lngRet = FindExecutable(strFile, strDir, lpResult)

If lngRet > 32 Then
FindEXE = lpResult
If InStr(FindEXE, Chr$(0)) > 0 Then
FindEXE = Left$(FindEXE, InStr(FindEXE, Chr$(0)) - 1)
End If
Else
Select Case lngRet:
Case ERROR_NOASSOC
FindEXE = "Error: No Association"
Case ERROR_FILE_NOT_FOUND
FindEXE = "Error: File Not Found"
Case ERROR_PATH_NOT_FOUND
FindEXE = "Error: Path Not Found"
Case ERROR_BAD_FORMAT
FindEXE = "Error: Bad File Format"
Case ERROR_OUT_OF_MEM
FindEXE = "Error: Out of Memory"
End Select
End If
End Function

Private Function GetShortName(ByVal strFileName As String) As String
Dim strShortPath As String
Dim lngBuffer As Long, lngRet As Long
strShortPath = String$(MAX_PATH, 0)
lngBuffer = Len(strShortPath)
lngRet = GetShortPathName(strFileName, strShortPath, lngBuffer)
GetShortName = Left(strShortPath, lngRet)
End Function
'----------------------------------------------------------------------

Then in the function to "run" the file, I use:

strEXEName = FindEXE(strFileToRunWithoutPath, strPathToFileToRun)
strEXEShort = GetShortName(strEXEName)
lngTaskID = Shell(strEXEShort & " " & strFileToRun, vbMaximizedFocus)

Note that you need to split off the path to the file you want to "run"
to use the above. I'll leave how you want to do that up to you.
<grin>
On Tue, 27 Apr 2004 12:30:52 -0500, "Rick Brandt"
<ri*********@hotmail.com> wrote:
Can you elaborate on that a bit? Did you have to modify the fHandleFile()
function?

"Chuck Grimsby" <c.*******@worldnet.att.net.invalid> wrote in message
news:7p********************************@4ax.com.. .
Works for me... Although as I recall, I had to use the
"GetShortPathName" API call due to spaces in the application's path.

On Mon, 26 Apr 2004 11:19:52 -0500, "Rick Brandt"
<ri*********@hotmail.com> wrote:
>Is anyone using the fHandleFile() from "The Access Web" site in a
>Terminal
>Server environment? I just discovered today that it doesn't work for
>me.
>Even though I can double-click a PDF file and Acrobat is automatically >launched, the function is returning the "File Not Found" error from my >app.
>I was using this instead of FollowHyperlink because I don't like the way >that the Access app is minimized when using that.

Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.