Jump to content
Sign in to follow this  
E1M1

Need help with my desktop

Recommended Posts

E1M1

Ok I created listview, now how I add desttop icons? I tried to create listviewitem but nothing appeared in listview.

All I want is create my own desktop but I can't find out how to add icons.

Also how do i create that listview with out header at very top of control.

#include <ButtonConstants.au3>

#include <GUIConstantsEx.au3>

#include <WindowsConstants.au3>

if $cmdline[0] > 0 Then

    $data = ""

    for $i = 1 To $cmdline[0]

        $data &= $cmdline[$i] &" "

    Next

    MsgBox(0,0,$data)

EndIf

#Region ### START Koda GUI section ### Form=

$Form1 = GUICreate("Program Manager", @DesktopWidth, @DesktopHeight, 0, 0,0x96000000,0x00000080)

$icons = GUICtrlCreateListView ( "", 0, 0 ,@DesktopWidth, 994 ,0x56002A40 ,0x00000000 )

WinActivate("Program Manager")

ControlSetText ( "Program Manager","",  "[CLASS:SysListView32; INSTANCE:1]","FolderView")

ControlListView ( "Program Manager","FolderView",  "[CLASS:SysListView32; INSTANCE:1]", "ViewChange", "details" )

#Include <GuiListView.au3>

_GUICtrlListView_AddItem($icons, "lol")

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###



#Region ### START Koda GUI section ### Form=

$Form2 = GUICreate("", @DesktopWidth, 30, 0, @DesktopHeight-30,0x96000000,0x00000088)

$start = GUICtrlCreateButton("Start",0,0,99,30)

#Include <GuiToolBar.au3>

$TOOLBAR =  _GUICtrlToolbar_Create($Form2,0x52009345,0x00000000)

ControlMove($Form2,"","[CLASS:ToolbarWindow32; INSTANCE:1]",105,0)

WinSetOnTop($Form2,"",1)

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###



While 1

    $nMsg = GUIGetMsg()

    Switch $nMsg

        Case $GUI_EVENT_CLOSE

            Exit

        Case $start

            run(InputBox("",""))

    EndSwitch

WEnd

thanks.

Edited by E1M1

edited

Share this post


Link to post
Share on other sites
evilertoaster

Hummm, this maybe?

#include <GUIConstantsEx.au3>
#Include <GuiListView.au3>
#Include <GuiToolBar.au3>

if $cmdline[0] > 0 Then
    $data = ""
    for $i = 1 To $cmdline[0]
        $data &= $cmdline[$i] &" "
    Next
    MsgBox(0,0,$data)
EndIf

GUICreate("Program Manager", @DesktopWidth, @DesktopHeight, 0, 0,0x96000000,0x00000080)
$icons = GUICtrlCreateListView ("FolderView", 0, 0 ,@DesktopWidth, 994 ,0x0003)
ControlListView ("Program Manager","FolderView",  "[CLASS:SysListView32; INSTANCE:1]", "ViewChange", "details" )
_GUICtrlListView_AddItem($icons, "lol")
GUISetState()

GUICreate("", @DesktopWidth, 135, 0, @DesktopHeight-30,0x96000000,0x00000088)
WinSetOnTop(-1,"",1)
$TOOLBAR =  _GUICtrlToolbar_Create(-1,0x52009345,0x00000000)
$start = GUICtrlCreateButton("Start",0,0,99,30)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $start
            run(InputBox("",""))
    EndSwitch
WEnd

Share this post


Link to post
Share on other sites
E1M1

tnx, now I have items added, now how I add icons? How do I get right icons right file types?

I tried to add some images (look for ; Load images from comments) but it didn't work.

also how do I enable icon moving by dragging?

#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiToolBar.au3>
#include <GuiImageList.au3>
#include <file.au3>

If $cmdline[0] > 0 Then
    $data = ""
    For $i = 1 To $cmdline[0]
        $data &= $cmdline[$i] & " "
    Next
EndIf

GUICreate("Program Manager2", @DesktopWidth, @DesktopHeight, 0, 0, 0x96000000, 0x00000080)
$icons = GUICtrlCreateListView("FolderView", 0, 0, @DesktopWidth, 994, 0x0003)
ControlListView("Program Manager2", "FolderView", "[CLASS:SysListView32; INSTANCE:1]", "ViewChange", "largeicons")

AddIcons()

_GUICtrlListView_SetView($icons, 1)
GUISetState()

GUICreate("", @DesktopWidth, 135, 0, @DesktopHeight - 30, 0x96000000, 0x00000088)
WinSetOnTop(-1, "", 1)
$TOOLBAR = _GUICtrlToolbar_Create(-1, 0x52009345, 0x00000000)
$start = GUICtrlCreateButton("Start", 0, 0, 99, 30)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $start
            Run(InputBox("", ""))
    EndSwitch
WEnd

Func AddIcons()
    ; Load images
    $hImage = _GUIImageList_Create()
    _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($icons, 0xFF0000, 16, 16))
    _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($icons, 0x00FF00, 16, 16))
    _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($icons, 0x0000FF, 16, 16))
    _GUICtrlListView_SetImageList($icons, $hImage, 1)

    $filearray = _FileListToArray(@DesktopDir, "*", 1)
    If Not @error Then
        For $i = 1 To $filearray[0]
            _GUICtrlListView_AddItem($icons, "File " & $filearray[$i],1)
        Next
    EndIf
    $dirarray = _FileListToArray(@DesktopDir, "*", 2)
    If Not @error Then
        For $i = 1 To $dirarray[0]
            _GUICtrlListView_AddItem($icons, "Dir " & $dirarray[$i],2)
        Next
    EndIf
    $filearray = _FileListToArray(@DesktopCommonDir, "*", 1)
    If Not @error Then
        For $i = 1 To $filearray[0]
            _GUICtrlListView_AddItem($icons, "File " & $filearray[$i])
        Next
    EndIf
    $dirarray = _FileListToArray(@DesktopCommonDir, "*", 2)
    If Not @error Then
        For $i = 1 To $dirarray[0]
            _GUICtrlListView_AddItem($icons, "Dir " & $dirarray[$i])
        Next
    EndIf
EndFunc   ;==>_AddIcons

How to make that window stay behind other windows?


edited

Share this post


Link to post
Share on other sites
E1M1

I tried to make it transparent like real desktop window is but how do I code it so that gui hole won't cut icons?

#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiToolBar.au3>
#include <GuiImageList.au3>
#include <file.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>

Global $htit = _WinAPI_GetSystemMetrics($SM_CYCAPTION)
Global $frame = _WinAPI_GetSystemMetrics($SM_CXDLGFRAME)

If $cmdline[0] > 0 Then
    $data = ""
    For $i = 1 To $cmdline[0]
        $data &= $cmdline[$i] & " "
    Next
EndIf

$gui = GUICreate("Program Manager2", @DesktopWidth, @DesktopHeight, 0, 0, 0x96000000, 0x00000080)
$icons = GUICtrlCreateListView("FolderView", 0, 0, @DesktopWidth, 994, 0x0003)
ControlListView("Program Manager2", "FolderView", "[CLASS:SysListView32; INSTANCE:1]", "ViewChange", "largeicons")
$pos = WinGetPos($gui) ; get whole window size (no client size defined in GUICreate)
Global $width = $pos[2]
Global $height = $pos[3]
  _GuiHole($gui, 0, 0, 260, 170)
AddIcons()

_GUICtrlListView_SetView($icons, 1)
GUISetState()

GUICreate("", @DesktopWidth, 135, 0, @DesktopHeight - 30, 0x96000000, 0x00000088)
WinSetOnTop(-1, "", 1)
$TOOLBAR = _GUICtrlToolbar_Create(-1, 0x52009345, 0x00000000)
$start = GUICtrlCreateButton("Start", 0, 0, 99, 30)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $start
            Run(InputBox("", ""))
    EndSwitch
WEnd

Func AddIcons()
    ; Load images
    $hImage = _GUIImageList_Create()
    _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($icons, 0xFF0000, 16, 16))
    _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($icons, 0x00FF00, 16, 16))
    _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($icons, 0x0000FF, 16, 16))
    _GUICtrlListView_SetImageList($icons, $hImage, 1)

    $filearray = _FileListToArray(@DesktopDir, "*", 1)
    If Not @error Then
        For $i = 1 To $filearray[0]
            _GUICtrlListView_AddItem($icons, "File " & $filearray[$i],1)
        Next
    EndIf
    $dirarray = _FileListToArray(@DesktopDir, "*", 2)
    If Not @error Then
        For $i = 1 To $dirarray[0]
            _GUICtrlListView_AddItem($icons, "Dir " & $dirarray[$i],2)
        Next
    EndIf
    $filearray = _FileListToArray(@DesktopCommonDir, "*", 1)
    If Not @error Then
        For $i = 1 To $filearray[0]
            _GUICtrlListView_AddItem($icons, "File " & $filearray[$i])
        Next
    EndIf
    $dirarray = _FileListToArray(@DesktopCommonDir, "*", 2)
    If Not @error Then
        For $i = 1 To $dirarray[0]
            _GUICtrlListView_AddItem($icons, "Dir " & $dirarray[$i])
        Next
    EndIf
EndFunc   ;==>_AddIcons

; make inner transparent area but add controls
Func _GuiHole($h_win, $i_x, $i_y, $i_sizew, $i_sizeh)
    Local $outer_rgn, $inner_rgn, $combined_rgn

    $outer_rgn = _WinAPI_CreateRectRgn(0, 0, $width, $height)
    $inner_rgn = _WinAPI_CreateRectRgn($i_x, $i_y, $i_x + $i_sizew, $i_y + $i_sizeh)
    $combined_rgn = _WinAPI_CreateRectRgn(0, 0, 0, 0)
    _WinAPI_CombineRgn($combined_rgn, $outer_rgn, $inner_rgn, $RGN_DIFF)
    _WinAPI_DeleteObject($outer_rgn)
    _WinAPI_DeleteObject($inner_rgn)
;~     _AddCtrlRegion($combined_rgn, $btn_default)
;~     _AddCtrlRegion($combined_rgn, $btn_round)
;~     _AddCtrlRegion($combined_rgn, $btn_buble)
;~     _AddCtrlRegion($combined_rgn, $btn_transparent)
;~     _AddCtrlRegion($combined_rgn, $btn_exit)
    _WinAPI_SetWindowRgn($h_win, $combined_rgn)
EndFunc   ;==>_GuiHole

; add control's area to given region
; respecting also window title/frame sizes
Func _AddCtrlRegion($full_rgn, $ctrl_id)
    Local $ctrl_pos, $ctrl_rgn

    $ctrl_pos = ControlGetPos($gui, "", $ctrl_id)
    $ctrl_rgn = _WinAPI_CreateRectRgn($ctrl_pos[0] + $frame, $ctrl_pos[1] + $htit + $frame, _
            $ctrl_pos[0] + $ctrl_pos[2] + $frame, $ctrl_pos[1] + $ctrl_pos[3] + $htit + $frame)
    _WinAPI_CombineRgn($full_rgn, $full_rgn, $ctrl_rgn, $RGN_OR)
    _WinAPI_DeleteObject($ctrl_rgn)
EndFunc   ;==>_AddCtrlRegion

edited

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.