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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Browsing Using API - Need Thumbnails

Status
Not open for further replies.

icupat

Technical User
Aug 6, 2002
25
CA
Hi,
I know there's numerous other articles on this topic (although I have yet to find an FAQ despite the fact it's a common question). I've got an API to create a windows explorer to search my hard drive when I click on a browse button, unfortunately it doesn't allow me to use the thumbnails view. Any help would be great, I'm using the following code and need the tags to enable thumbnail previewing:

<code>
Private Declare Function GetOpenFileName Lib &quot;comdlg32.dll&quot; Alias &quot;GetOpenFileNameA&quot; (pOpenfilename As OPENFILENAME) As Long
Private Type OPENFILENAME
lStructSize As Long
hWndOwner As Long
hInstance As Long
lpstrFilter As String
lpstrCustomFilter As String
nMaxCustFilter As Long
nFilterIndex As Long
lpstrFile As String
nMaxFile As Long
lpstrFileTitle As String
nMaxFileTitle As Long
lpstrInitialDir As String
lpstrTitle As String
flags As Long
nFileOffset As Integer
nFileExtension As Integer
lpstrDefExt As String
lCustData As Long
lpfnHook As Long
lpTemplateName As String
End Type

Private Sub browsefile_Click()

Dim OFName As OPENFILENAME
OFName.lStructSize = Len(OFName)
'Set the parent window
OFName.hWndOwner = Me.Hwnd
'Set the application's instance
'OFName.hInstance = App.hInstance
'Select a filter
OFName.lpstrFilter = &quot;Jpegs (*.jpg)&quot; + Chr$(0) + &quot;*.jpg&quot; + Chr$(0) + &quot;All Files (*.*)&quot; + Chr$(0) + &quot;*.*&quot; + Chr$(0)
'create a buffer for the file
OFName.lpstrFile = Space$(254)
'set the maximum length of a returned file
OFName.nMaxFile = 255
'Create a buffer for the file title
OFName.lpstrFileTitle = Space$(254)
'Set the maximum length of a returned file title
OFName.nMaxFileTitle = 255
'Set the initial directory
OFName.lpstrInitialDir = &quot;\\Dataserver\&quot;
'Set the title
OFName.lpstrTitle = &quot;Open File&quot;
'No flags
OFName.flags = 0

'Show the 'Open File'-dialog
If GetOpenFileName(OFName) Then
'MsgBox &quot;File to Open: &quot; + Trim$(OFName.lpstrFile)
Me![filenames] = Left(Trim$(OFName.lpstrFile), (Len(Trim$(OFName.lpstrFile)) - 1))
Else
MsgBox &quot;You Have Canceled Your Browsing&quot;
End If

End Sub

</code>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top