Has anyone had this function to work properly in Visual Basic.Net?
I realize that this Function may become archaic in the future, but still...
Looking to extract the 1282px and 2562px icons from a path to an executable file... This looks like the right function, but I've messed with it too long, and my brain is all scrambled now, and I'm pretty well lost.
The arguments I have working (as far as i know) have been bolded;
green, I vaugley understand;
I have no idea what the red arguments serve...:
I will try to summarize what I know beside the argument
(I also realize that we don't use "UINT" as the actual value in VB.Net... Int32 right?)
LPCTSTR lpszFile - The path to the object (string)
int nIconIndex, - The first icon to extract? Maybe, the icon closest to the requested dimensions?
int cxIcon, - Width of the requested Icon.
int cyIcon, - Height of the requested Icon.
HICON *phicon, - Handle (s ?) of the requested icon of which are to be returned? I thought the closest 1 would be returned...
UINT *piconid, - Display device? If the requested format of icon isn't available (existant), then it returns 0xFFFFFFFF, and 0 if somthing else denies the icon, right?...
UINT nIcons, - Perhaps related to "int nIconIndex"... are the different icons extracted through this argument actually the same icon in a number of different sizes? Such as... if i were to use 3 in this argument, would I get the same icon in 3 different size versions?.... I'm lost on this one too i think.
UINT flags - Would I want to only use LR_DefaultColor?
Thanks!!! I know this isn't very easy on the eye...Sunday, March 02, 2008 5:27 AM
The PrivateExtractIcons function is depreciated I would not use it. Use ExtractIcon insteadSunday, March 02, 2008 11:03 AM
What file type uses such large icon? Do you programming in Vista? If you program in vista, you can post your issues to this forum. One alternative is that we extract icons from file and magnify it in the image object.
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Private imageList1 As ImageList
Public Sub ExtractAssociatedIconEx()
imageList1 = New ImageList()
imageList1.ImageSize = New Size(128, 128)
ListView1.Location = New Point(37, 12)
ListView1.Size = New Size(450, 400)
ListView1.SmallImageList = imageList1
ListView1.View = View.SmallIcon
Me.ClientSize = New System.Drawing.Size(592, 566)
Me.Text = "Form1"
Dim dir As New System.IO.DirectoryInfo("d:\temp")
Dim item As ListViewItem
For Each file As FileInfo In dir.GetFiles()
Dim iconForFile As Icon = SystemIcons.WinLogo
item = New ListViewItem(file.Name, 1)
iconForFile = Icon.ExtractAssociatedIcon(file.FullName)
Dim i As Integer = 0
If Not imageList1.Images.ContainsKey(file.Extension) Then
i = i + 1
iconForFile = System.Drawing.Icon.ExtractAssociatedIcon(file.FullName)
Dim fs As Stream = New FileStream("d:\temp\" & i.ToString & ".ico", FileMode.Create, FileAccess.Write)
item.ImageKey = file.Extension
RiquelWednesday, March 05, 2008 1:03 PM
We are changing the issue type to “Comment” because you have not followed up with the necessary information. If you have more time to look at the issue and provide more information, please feel free to change the issue type back to “Question” by editing your initial post and changing the radio button at the top of the post editor window. If the issue is resolved, we will appreciate it if you can share the solution so that the answer can be found and used by other community members having similar questions. Thank you!Monday, March 10, 2008 2:57 AM