Re: Shell Execute Associations...
- From: "Howard Henry Schlunder" <howard_hs@xxxxxxxxx>
- Date: Thu, 27 Oct 2005 17:46:30 -0700
Your problem probably stems from the the name of your text file,
"TextData.dat". Why would people associate .dat with a text editor? By
default, Notepad will open .txt files, but I don't think .dat is bound to
anything. Dat implies data, which is almost always binary (otherwise the
programmer should have used the .txt extension to imply that it is not
binary). In your case, the .log file extension may be appropriate.
<stevegdula@xxxxxxxxx> wrote in message
news:1130454877.841338.75320@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Does anyone have any insight why my VBapp will
> not auto-launch a text file consistently from
> one computer to another.
>
> I am utilizing the Shellexecute API call to open
> a text file in whatever application is associated
> with the file extension type.
>
> Here is an example of my code:
>
> --------------Declared In Module-------------------
> Public Declare Function ShellExecute Lib "shell32.dll" Alias
> "ShellExecuteA" _
> (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As
> String, _
> ByVal lpParameters As String, ByVal lpDirectory As String, ByVal
> nShowCmd As Long) As Long
> ---------------------------------------------------
>
> Private Sub ViewLog_Click()
>
> intReturn = ShellExecute(Me.hwnd, "OPEN", App.Path & "\TextData.dat",
> "", "", 1)
> If intReturn <= 32 Then
> MsgBox "Image Text-List Failed to Open", vbCritical +
> vbApplicationModal + _
> vbOKOnly,"File Open Error #" & CStr(intReturn)
> End If
>
> End Sub
> ---------------------------------------------------
> On the machine I compiled the sourcecode on, the auto app association
> works fine
> and a text viewer opens the log file desired. On other machines that I
> installed
> the app onto I get mixed results. All of these machines are WinXp.
>
> Some of the machines return a value of (31) which I researched to be a
> SE_ERR_NOASSOC = 31 (No associated app for this file type). This is not
> true, as
> double clicking on the same text file will auto-launch the appropriate
> text
> editor for viewing.
> - - - - - - - - - - - - - - -
> I even went as far as to modify the code to this example, which will
> launch the
> file association dialog window in the event of a returned value of 31.
> Although
> the user clicks the 'Always use for this filetype' that association is
> NEVER
> retained:
>
> Private Sub ViewLog_Click()
>
> intReturn = ShellExecute(Me.hwnd, "OPEN", App.Path & "\TextData.dat",
> "", "", 1)
> If intReturn <= 32 Then
> intReturn = Shell("rundll32.exe shell32.dll,OpenAs_RunDLL " & _
> App.Path & "\TextData.dat", 1)
> End If
>
> Does anyone have any insight on why I would get this inconsistent
> behavior
> from one computer to another??
>
> Thanks in advance,
>
> -Steve.
>
.
- References:
- Shell Execute Associations...
- From: stevegdula
- Shell Execute Associations...
- Prev by Date: Shell Execute Associations...
- Next by Date: Re: Shell Execute Associations...
- Previous by thread: Shell Execute Associations...
- Next by thread: Re: Shell Execute Associations...
- Index(es):
Relevant Pages
|
Loading