View Single Post
  #5  
Old 10-02-2004, 12:09
ddonnahoe's Avatar
ddonnahoe ddonnahoe is offline
Senior Member
 
Join Date: Jan 2004
Location: Louisville, KY
Posts: 552
Send a message via ICQ to ddonnahoe Send a message via AIM to ddonnahoe Send a message via MSN to ddonnahoe Send a message via Yahoo to ddonnahoe
Default

OK for some reason it still doesn't work. I have tried numerous things, but I think I am losing the battle. I think for some reason the code isn't really reading the .ai. If I choose any other file that isn't an AI the code works fine and returns the image to the image box, but when I choose an AI the invalid image error occurs. It's still reading that portion of the code that puts the browsed image in the image box, instead of the "preview not avialable" image.

Here is the newest code
Code:
Sub ShowOpenFile()
Dim OFName As OPENFILENAME
Dim sPath As String

    OFName.lStructSize = Len(OFName)
    OFName.hwndOwner = 0&
    OFName.hInstance = 0&
    OFName.lpstrFilter = "Image Files" + Chr$(0) + "*.jpg;*.bmp;*.gif;*.jpeg;*.ai"
    OFName.lpstrFile = Space$(254)
    OFName.nMaxFile = 255
    OFName.lpstrFileTitle = Space$(254)
    OFName.nMaxFileTitle = 255
    sPath = GetBackEnd
    If sPath = vbNullString Then
        OFName.lpstrInitialDir = "c:\"
    Else
        sPath = Left(sPath, InStrRev(sPath, "\") - 1)
        If Len(Dir(sPath, vbDirectory)) > 0 Then
            OFName.lpstrInitialDir = sPath
        Else
            OFName.lpstrInitialDir = "c:\"
        End If
    End If
    OFName.lpstrTitle = "Select an image File (*.jpg), (*.bmp), (*.gif), (*.ai)"
    OFName.flags = 0

    If GetOpenFileName(OFName) Then
        BrowseOpenFile = OFName.lpstrFile
        txbImagePath.Text = BrowseOpenFile
        If LCase$(Right$(BrowseOpenFile, 3)) = ".ai" Then
            PictureNotAvail
        Else
            PreviewAvail
        End If
    Else
        BrowseOpenFile = vbNullString
        MsgBox "No file Selected."
    End If

End Sub
Sub PictureNotAvail()
    With Image1
    .Picture = LoadPicture("c:\pna.bmp")
    .PictureAlignment = fmPictureAlignmentCenter
    .PictureSizeMode = fmPictureSizeModeZoom
    End With
End Sub
Sub PreviewAvail()
    With Image1
    .Picture = LoadPicture(txbImagePath.Text)
    .PictureAlignment = fmPictureAlignmentCenter
    .PictureSizeMode = fmPictureSizeModeZoom
    End With
End Sub
__________________
Sean
Waiting for a ride in the T.A.R.D.I.S.
Reply With Quote