Fetstil Fetstil Kursiv Understrykning linje färgläggning tabellverk Punktlista Nummerlista Vänster Centrerat högerställt Utfyllt Länk Bild htmlmode
  • Forum & Blog
    • Forum - översikt
      • .Net
        • asp.net generellt
        • c#
        • vb.net
        • f#
        • silverlight
        • microsoft surface
        • visual studio .net
      • databaser
        • sql-server
        • databaser
        • access
        • mysql
      • mjukvara klient
        • datorer och komponenter
        • nätverk, lan/wan
        • operativsystem
        • programvaror
        • säkerhet, inställningar
        • windows server
        • allmänt
        • crystal reports
        • exchange/outlook
        • microsoft office
      • mjukvara server
        • active directory
        • biztalk
        • exchange
        • linux
        • sharepoint
        • webbservers
        • sql server
      • appar (win/mobil)
      • programspråk
        • c++
        • delphi
        • java
        • quick basic
        • visual basic
      • scripting
        • asp 3.0
        • flash actionscript
        • html css
        • javascript
        • php
        • regular expresssion
        • xml
      • spel och grafik
        • DirectX
        • Spel och grafik
      • ledning
        • Arkitektur
        • Systemutveckling
        • krav och test
        • projektledning
        • ledningsfrågor
      • vb-sektioner
        • activeX
        • windows api
        • elektronik
        • internet
        • komponenter
        • nätverk
        • operativsystem
      • övriga forum
        • arbete karriär
        • erbjuda uppdrag och tjänster
        • juridiska frågor
        • köp och sälj
        • matematik och fysik
        • intern information
        • skrivklåda
        • webb-operatörer
    • Posta inlägg i forumet
    • Chatta med andra
  • Konto
    • Medlemssida
    • Byta lösenord
    • Bli bonsumedlem
    • iMail
  • Material
    • Tips & tricks
    • Artiklar
    • Programarkiv
  • JOBB
  • Student
    • Studentlicenser
  • KONTAKT
    • Om pellesoft
    • Grundare
    • Kontakta oss
    • Annonsering
    • Partners
    • Felanmälan
  • Logga in

Hem / Tips & tricks

#245 - Bläddra efter katalog

Postat 2000-12-22 15:45:43 av Joel i Kategori Programmering, C#, Kommandon med 0 Kommentarer

Private Sub Command1_Click()

Dim BI As BROWSEINFO
Dim nFolder As Long
Dim IDL As ITEMIDLIST
Dim pIdl As Long
Dim sPath As String
Dim SHFI As SHFILEINFO

With BI
' The dialog's owner window...
.hOwner = Me.hWnd

' Set the Browse dialog root folder
nFolder = GetFolderValue(m_wCurOptIdx)

' Fill the item id list with the pointer of the selected folder item, rtns 0 on success
' ==================================================
' If this function fails because the selected folder doesn't exist,
' .pidlRoot will be uninitialized & will equal 0 (CSIDL_DESKTOP)
' and the root will be the Desktop.
' DO NOT specify the CSIDL_ constants for .pidlRoot !!!!
' The SHBrowseForFolder() call below will generate a fatal exception
' (GPF) if the folder indicated by the CSIDL_ constant does not exist!!
' ==================================================
If SHGetSpecialFolderLocation(ByVal Me.hWnd, ByVal nFolder, IDL) = NOERROR Then
.pidlRoot = IDL.mkid.cb
End If

' Initialize the buffer that rtns the display name of the selected folder
.pszDisplayName = String$(MAX_PATH, 0)

' Set the dialog's banner text
.lpszTitle = "Browsing is limited to: " & optFolder(m_wCurOptIdx).Caption

' Set the type of folders to display & return
' -play with these option constants to see what can be returned
.ulFlags = GetReturnType()

End With

' Clear previous return vals before the
' dialog is shown (it might be cancelled)
txtPath = ""
txtDisplayName = ""
pic16Icon.Picture = LoadPicture() ' clears prev icon
pic32Icon.Picture = LoadPicture()

' Show the Browse dialog
pIdl = SHBrowseForFolder(BI)

' If the dialog was cancelled...
If pIdl = 0 Then Exit Sub

' Fill sPath w/ the selected path from the id list
' (will rtn False if the id list can't be converted)
sPath = String$(MAX_PATH, 0)
SHGetPathFromIDList ByVal pIdl, ByVal sPath

' Display the path and the name of the selected folder
txtPath = Left(sPath, InStr(sPath, vbNullChar) - 1)
txtDisplayName = Left$(BI.pszDisplayName, _
InStr(BI.pszDisplayName, vbNullChar) - 1)

' Get the 16x16 icon info from the id list using the pidl
SHGetFileInfo ByVal pIdl, 0&, SHFI, Len(SHFI), _
SHGFI_PIDL Or SHGFI_ICON Or SHGFI_SMALLICON
' The 16x16 icon handle rtnd in SHFI.hIcon is stretched to 32x32.
' DrawIconEx() will shrink (or stretch) the icon per it's cxWidth & cyWidth params
DrawIconEx pic16Icon.hdc, 0, 0, SHFI.hIcon, 16, 16, 0, 0, DI_NORMAL
pic16Icon.Refresh

' Get the 32x32 icon info from the id list
SHGetFileInfo ByVal pIdl, 0&, SHFI, Len(SHFI), _
SHGFI_PIDL Or SHGFI_ICON
' SHFI.hIcon is OK here so DrawIcon() can be used
DrawIcon pic32Icon.hdc, 0, 0, SHFI.hIcon
pic32Icon.Refresh

' Frees the memory SHBrowseForFolder()
' allocated for the pointer to the item id list
CoTaskMemFree pIdl

'End of Code------------------------------------------------------------------------------------



End Sub

Sample:
Size:

Nyligen

  • 09:09 Vill du köpa medicinska tester?
  • 12:47 Vem beviljar assistansen – kommune
  • 14:17 Någon med erfarenhet av hemstädnin
  • 14:14 Bör man använda sig av en båtförme
  • 14:12 Finns det någon intressant hundblo
  • 14:25 Tips på verktyg för att skapa QR-k
  • 14:23 Tips på verktyg för att skapa QR-k
  • 20:52 Fungerer innskuddsbonuser egentlig

Sidor

  • Hem
  • Bli bonusmedlem
  • Läs artiklar
  • Chatta med andra
  • Sök och erbjud jobb
  • Kontakta oss
  • Studentlicenser
  • Skriv en artikel

Statistik

Antal besökare:
Antal medlemmar:
Antal inlägg:
Online:
På chatten:
4 569 159
27 952
271 704
857
0

Kontakta oss

Frågor runt konsultation, rådgivning, uppdrag, rekrytering, annonsering och övriga ärenden. Ring: 0730-88 22 24 | pelle@pellesoft.se

© 1986-2013 PelleSoft AB. Last Build 4.1.7169.18070 (2019-08-18 10:02:21) 4.0.30319.42000
  • Om
  • Kontakta
  • Regler
  • Cookies