I am trying to add the asscociated file icon in the listview( lvwFileNodeList ). I successfully add the icon for the first found file, but for the rest it uses the same icon to display the associated icon. As the following, i am adding the file icon in the image list with the extension as a key and add this icon when adding this file to the list view. there must be the extra step i have to do does any know what 'm missing? my envrionment is vb6/xp pro Me.ImageList2.ListImages.Add , FindExtension(strFileName), GetIcon(strFilePath, SHGFI_SMALLICON) Set objListItem = Me.lvwFileNodeList.ListItems.Add objListItem.SubItems(3) = strFilePath objListItem.SmallIcon = FindExtension(strFileName) Public Function GetIcon(filename As String, icon_size As Long) As IPictureDisp Dim index As Integer Dim hIcon As Long Dim item_num As Long Dim icon_pic As IPictureDisp Dim sh_info As SHFILEINFO SHGetFileInfo filename, 0, sh_info, _ Len(sh_info), SHGFI_ICON + icon_size hIcon = sh_info.hIcon Set icon_pic = IconToPicture(hIcon) Set GetIcon = icon_pic 'GetIcon = sh_info.hIcon End Function ' Convert an icon handle into an IPictureDisp. Private Function IconToPicture(hIcon As Long) As IPictureDisp Dim cls_id As CLSID Dim hRes As Long Dim new_icon As TypeIcon Dim lpUnk As IUnknown With new_icon .cbSize = Len(new_icon) .picType = vbPicTypeIcon .hIcon = hIcon End With With cls_id .id(8) = &HC0 .id(15) = &H46 End With hRes = OleCreatePictureIndirect(new_icon, _ cls_id, 1, lpUnk) If hRes = 0 Then Set IconToPicture = lpUnk End Function
shinay
Posts
-
Add associated file icon to listview -
dotnet dll distributionHow can i distribute the dot net dll? We used to distribute active x dll for VB6 VC. At the installation with installer, we always reigster the dlls with regsvr32. However for dot net dlls this doesn't work. I have been going through the web and some told me to use regasa.exe. some says don't need to register and just ask custoemrs to provide dot dll files when developping with vb.net or c#. what is the real solution for this issue? SK
-
google like taskbar for my applicationThanks, I will have a look at it. Do you happen to know how to create some of application docked on the top of desktop and hide/show depending on how close the mouse pointer from the application? Shin
-
google like taskbar for my applicationI just googled and found out that i need to use band object. If some has seen the sample code let me know Thanks Shin
-
google like taskbar for my applicationDoes anyone know how to create a textbox in the toolbar like google search tool with VB6? I am also interested in the Shin
-
disable any input RichEditBoxIs there any way to just disable any input from user but not disable the control itsself. basically i want to display character in richedit box for read only Shin
-
VB Office Addins drag file to excel sheet to generate hyperlink in the ExcelIs there any event to catch when files are drop on the excel sheet for office com addin in VB? Shin
-
ShellExecute APITry to use Shell or ShellExecuteEx to run from VB.NET instead of ShellExecute Since I don't have it installed, i can't test.
-
ShellExecute APIVB6 or VB.net? I am with VB6.
-
ShellExecute APII meant at least you can launch notepad. If using Windows2000, you have to specified C:\WINNT\SYSTEM32\NOTEPAD.exe
-
ShellExecute APICan you just create a new project with VB and copy & paste the following code. In the form, you just add one button called "Command1"(by default). Compile and run. it should work. Private 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 Public Sub RunProgram(ByVal strProgram As String) Dim lRet As Long lRet = ShellExecute(vbNull, "Open", strProgram, "", "", 1) If lRet <= 32 Then MsgBox ("Error Running Program") End If End Sub Private Sub Command1_Click() RunProgram "c:\windows\system32\notepad.exe" End Sub
-
ShellExecute APIIt perfectly works in my pc. You might wanna check what is inside of the strProgram variable.( maybe there is a space in side?) try with the note pad like the following if it works. Private 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 Command1_Click() Dim lRet As Long lRet = ShellExecute(vbNull, "Open", "C:\WINDOWS\SYSTEM32\notepad.exe", "C:\mytext.txt", "", 1) If lRet <= 32 Then MsgBox ("Error Running Program") End If End Sub
-
Insert BLOB Field with ADOI am trying to put the binary file to Blob field in the oracle but when updating i have error saying [Oracle][ODBC]Function error what is the problem? I am using madac 2.6/VB6 Set rs = New ADODB.Recordset rs.Open "Select * from LOB_TABLE", cn, adOpenKeyset, adLockOptimistic ' Create the ADO Stream object Set mStream = New ADODB.Stream ' Make it a binary type mStream.Type = adTypeBinary ' Open the stream mStream.Open ' Read the binary file into the stream buffer mStream.LoadFromFile BlobSourcePath & BlobFileName ' Add the blob to the database With rs .AddNew '.Fields("BLOBFIELD").Value = mStream.Read rs!Field = BlobFileName rs!BLOBFIELD = mStream.Read '.Fields("FIELD").Value = BlobFileName .Update <<<<<
-
Blob fieldm using 2.8 but still doesn't work
-
Blob fieldDo you have any idea when i tried to select the table with Blob field i get the exception say -2147467259 - unspecified error? rs.Open "Select * from MYTEST", db, adOpenKeyset, adLockOptimistic I am using VB6
-
dynamically create picture control with tabHow to dynamically add tab and picture control as a pair? I tried something like the following. but it didn't show each picture control on each tab. For i = 1 To 5 Load Picture1(i) Load TabStrip1(i) Picture1(i).Visible = True Picture1(i).Left = Picture1(i).Left + 100 tab Next i how can i achieve this. I am using vb6
-
oracle blob fieldIs it possible to get the file name from binary data in the blob field( say in oracle) using VB or other programming language? I am new to this blob thing. I just want to clear this out.
-
specified User FolderHow can I specified the path so that my ini file can be saved into the current user folder(under Documents and Settings) in VB6?
-
Hide Checkbox in Checkbox VBThe thing is I want to display chinese, japanese, English on this control only the control can do this is checkbox otherwise i have to install Microsoft Form 2.0 ObjectLibrary. Since Microsoft won't allow you to distribute this library with your application, I don't want to do. It only works if you have office installed on your computer.
-
Hide Checkbox in Checkbox VBVB 6