Re: Shell Execute Associations...



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.
>


.



Relevant Pages

  • Re: finding how much the file system is full, from a C program?
    ... If string is a null pointer, the system function determines whether the host ... The fopen function opens the file whose name is the string pointed to by filename, and associates a stream with it. ... wb truncate to zero length or create binary file for writing ...
    (comp.lang.c)
  • Re: Command button to open form and find record
    ... Opens the form if it is not already open. ... Public Function OpenFormTo(strForm As String, strWhere As String, Optional bGotoNewRecord As Boolean, _ ... Optional strOpenArgs As String) As Boolean ... Public Function HasProperty ...
    (microsoft.public.access.forms)
  • Re: Passing Form input to stored procedure to populate a report
    ... opens the form or report and pass them to an array vaiable, ... Public astrParamsAs String ... Dim stDocName As String ... The form/report opens ...
    (microsoft.public.access.adp.sqlserver)
  • Re: Passing Form input to stored procedure to populate a report
    ... opens the form or report and pass them to an array vaiable, ... Public astrParamsAs String ... Dim stDocName As String ... The form/report opens ...
    (microsoft.public.access.adp.sqlserver)
  • Re: Parameters from a form
    ... opens the form or report and pass them to an array vaiable, ... Public astrParamsAs String ... Dim stDocName As String ... The form/report opens ...
    (microsoft.public.access.adp.sqlserver)

Loading