Jump to content

Need help to Create a ListView Icon.


Recommended Posts

Heres the script, but i cant create a icon :whistle:, file is there. i dont know why, please help^^

#include <IE.au3>
#include <GuiConstants.au3>
#include <String.au3>
#include <GuiTreeView.au3>

Global $PictureFolder =  @ScriptDir & "\tmp"
GuiCreate("* finder", 392, 312,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$aSearch = GuiCtrlCreateInput("", 4, 5, 301, 17)
$gSearch = GuiCtrlCreateButton("Search", 307, 5, 82, 17)
$aList = GUICtrlCreateListView("", 6, 28, 381, 279)
GUICtrlSetStyle( $aList , ($LVS_ICON) )
;GUICtrlSetStyle with the styles $LVS_ICON, $LVS_LIST or $LVS_SMALLICON.
GuiSetState(@SW_SHOW)
;GUICtrlCreateListViewItem( $PictureFolder & "tmp1.JPG" , $aList )
;GUICtrlCreateListViewItem( $PictureFolder & "tmp1.JPG" , $aList )
$test=GUICtrlCreateListViewItem( $PictureFolder & "\tmp1.JPG" , $aList )
GUICtrlSetImage( $test , $PictureFolder & "\tmp1.JPG" )
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    EndSelect
WEnd
Exit
My UDF's : Startet on : 06.06.2006_CaseSearchOrReplaceStr();~> Searches OR Replaces a String,;~> With or Without Casesensivity
Link to comment
Share on other sites

#include <IE.au3>
#include <GuiConstants.au3>
#include <String.au3>
#include <GuiTreeView.au3>

Global $PictureFolder =  @ScriptDir & "\tmp"
GuiCreate("foo finder", 392, 312,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$aSearch = GuiCtrlCreateInput("", 4, 5, 301, 17)
$gSearch = GuiCtrlCreateButton("Search", 307, 5, 82, 17)
$aList = GUICtrlCreateListView("test", 6, 28, 381, 279)
GUICtrlSetStyle( $aList , ($LVS_ICON) )
;GUICtrlSetStyle with the styles $LVS_ICON, $LVS_LIST or $LVS_SMALLICON.
GuiSetState(@SW_SHOW)
;GUICtrlCreateListViewItem( $PictureFolder & "tmp1.JPG" , $aList )
;GUICtrlCreateListViewItem( $PictureFolder & "tmp1.JPG" , $aList )
$test=GUICtrlCreateListViewItem( $PictureFolder & "\tmp1.JPG" , $aList )
GUICtrlSetImage( $test , $PictureFolder & "\tmp1.JPG" )
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    EndSelect
WEnd
Exit

doesnt work.. :whistle:

My UDF's : Startet on : 06.06.2006_CaseSearchOrReplaceStr();~> Searches OR Replaces a String,;~> With or Without Casesensivity
Link to comment
Share on other sites

What is your problem exactly? Bumping a thread where you haven't explained yourself clearly is pretty silly.

IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
Link to comment
Share on other sites

I'm feeling a lack of effort here....

#include <GuiConstants.au3>

Opt("GUIOnEventMode", 1)

$myGUI = GUICreate("Example", 400, 250)
GUISetOnEvent($GUI_EVENT_CLOSE, "Quit")
$listView = GUICtrlCreateListView("", 10, 10, 300, 200, BitOR($LVS_SHOWSELALWAYS, $LVS_SINGLESEL, $LVS_SMALLICON))
$listViewItem = GUICtrlCreateListViewItem("Hurrah", $listView)
GUICtrlSetImage($listView, "shell32.dll", 22)


GuiSetState()

While 1
    Sleep(10)
WEnd



Func Quit()
    Exit 0
EndFunc
IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
Link to comment
Share on other sites

ok,this is what i want :

#include <GuiConstants.au3>

Opt("GUIOnEventMode", 1)

$myGUI = GUICreate("Example", 400, 250)
GUISetOnEvent($GUI_EVENT_CLOSE, "Quit")
$listView = GUICtrlCreateListView("erg", 10, 10, 300, 200)
GUICtrlSetStyle( $listView , ($LVS_ICON) )
$listViewItem = GUICtrlCreateListViewItem("Hurrah", $listView)
GUICtrlSetImage($listView, "shell32.dll", 22)


GuiSetState()

While 1
    Sleep(10)
WEnd



Func Quit()
    Exit 0
EndFunc

thx 2 mikeyhunt.

How can i extract a Icon from a File ?

My UDF's : Startet on : 06.06.2006_CaseSearchOrReplaceStr();~> Searches OR Replaces a String,;~> With or Without Casesensivity
Link to comment
Share on other sites

Busti, are you trying to get a icon of a file in a directory and or a icon of a running file?

It's all possible, just if you can be a bit more specific. You can search and find some info on it.

I've made a UDF for both of the above if thats what your interested in.

[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Link to comment
Share on other sites

Still not sure about what you want, hope this is along the lines. Give it a run.

I get the icon from a .exe in the windows folder, and then use string/array's to modify it to get a name to go after the Icon.

If you want to check another file just change the path at the top of the file.

What I did to create a list view of a file is.

;Includes
#include <GUIConstants.au3>
#include <GuiListView.au3>
#include <Array.au3>

;Path to the file, in which you want the icon to be displayed.
$Path = "C:\WINDOWS\setdebug.exe"

;GUI creation
$hGUI = GUICreate("Picture Icon", 300, 300, 100, 200, -1)
;ListView creation
$PictureList = GUICtrlCreateListView("Picture name(s)", -1, -1, 300, 300, $LVS_ICON)

;GUI State
GUISetState(@SW_SHOW)


;STRING MODIFICATION;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Removes the strings last three letters for name sake.
$Removed = StringTrimRight($Path, 4)

;Splits the given path '\'
$Name = StringSplit($Removed, '\', 1)

;Gets the max array vaule, the last '\' and what proceeds after it.
$Var = _ArrayMax($Name, 0)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; $Name[$Var]

;Create item for the listView
$Item = GUICtrlCreateListViewItem($Name[$Var], $PictureList)
        GUICtrlSetImage($Item, $Path, 0, 1); Sets Icon, for a specific file in the listview.
        

Do
  $Msg = GUIGetMsg ()

Until $Msg = $GUI_EVENT_CLOSE

[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Link to comment
Share on other sites

Yeah I understand what your looking for now. I'll look in to it; I have my doubts but we'll see.

Edited by Sardith

[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...