Jump to content

OldCoder

Active Members
  • Posts

    72
  • Joined

  • Last visited

Everything posted by OldCoder

  1. Well, since there is already a thread, (and since this appears to others to be the wrong forum to place this), I'll keep my P's & Q's to myself. However, to answer Minikori's questions: I'd have to say that it's very much like Vista, (like Windows 98 looked a lot like Windows 95), though it has some nicer visual appeal. Boot screen is sweet, starting with some 3D balls, (red, yellow, blue and green), rotating around each other and forming a blazing windows flag that glows while you load, (as seen here: Windows 7 Boot Screen & Desktop). Many things, on the other hand, just look like Vista. If you've seen Vista, you've pretty much seen Windows 7. If you haven't, check out these links in Google, may give you an idea: Windows 7 Screenshots, (Google Search), (though I'd ignore the early, dream shots of Win7, since many never came to fruition). The real changes, (from Vista to Windows 7), are in the OS itself, not it's eye candy. As stated by Microsoft, their focus on this OS was first and foremost "Compatibility, Reliability, Performance and Stability". I'm thinking that they may be close. I installed and used Windows XP drivers and applications, all of which worked so far. I have had no crashes or BSOD, (which I don't think will be blue in this release). Performance and stability seem superior to Vista, though I haven't tested it for THAT long. Hope this answers your questions.
  2. I am now a Beta Tester for Microsoft's new OS, Windows 7. Originally, I had decided to just throw some benchmarks at it and some driver/application tests. However, I was so impressed, that I decided to try AutoIt from there as well. Though I had not expected much from it, I must say that I am quite pleased with the results. So far, 100% of my apps have run up, and I have found about a 90% compatibility. Honestly, right now, my only real problem is with the volume mixer interface. Other then that, Windows 7 Beta is running up AutoIt like it was Windows XP on happy juice. If there is any interest, I'll come back from time to time and update this. Hope this has proven helpful and maybe alleviated some pre-release OS anxiety. Cheers, OldCoder
  3. Awww, come on. Someone must know something about this? There are some purdy smart ppl on this board.
  4. *Bumpty Bump
  5. I am trying to export/import some hives from my registry, some of which are protected, (ie. HKLM\SECURITY), and have hit the proverbial "brick wall". I have tried using ENGINE's excellent UDFs REG.AU3 & PRIVILEGE.AU3 and it works nice for the unprotected parts, (I thought the PRIVILEGE.AU3 would make it possible to export/import protected keys/hive). I used _RegSaveHive() on HKLM\SECURITY and it returned an error. Other hives under HKLM worked, like SAM and SOFTWARE...am I doing something wrong? I figured, since REG.AU3 UDFs sets privileges, it should work saving and restoring, but this is not the case. I tried playing with the privileges a bit, but can't get it to work. My test script looks like this: #include "Reg.au3" #include "Privilege.au3" $key = StringSplit("HARDWARE|SAM|SECURITY|SOFTWARE|SYSTEM", "|") For $t = 1 To $key[0] FileDelete($key[$t]) _RegSaveHive($key[$t], "HKLM\" & $key[$t]) If @error Then MsgBox(0,"ERROR","ERROR trying to export " & $key[$t]) Next Using the DOS command AT, (in XP), I can bypass privileges and get to the HKLM\SECURITY hive and even save or restore it. Though this method is messy and I'd really prefer to use an API call. Can anyone help me out here? Am I being stupid, missing the obvious? Thanks, OldCoder
  6. First off, let me say that I think you've done a really nice job here. I've tried converting Visual BASIC examples of this into AUTOIT, but with extremely limited success. I did, however, try _RegSaveHive() on HKLM\SECURITY and it returned an error. Other hives under HKLM worked, like SAM and SOFTWARE...am I doing something wrong? I figured, since REG.AU3 UDFs sets privileges, it should work saving and restoring, but this is not the case. I tried playing with the privileges a bit, but can't get it to work. Using the DOS command AT, (in XP), I can bypass privileges and get to the HKLM\SECURITY hive and even save or restore it. Though this method is messy and I'd really prefer to use an API call. Again, nice work on this, and thanks for all your efforts. Hope someone can help me out here, I feel kinda stupid. Cheers, OldCoder
  7. I found a Visual BASIC code for extracting installed Microsoft products, (including Operating Systems), key from the registry. After hours of conversion, this is what I came up with: $a=RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "DigitalProductId") If $a<>"" Then $xpkey=MSDecode($a, "-") ClipPut($xpkey) InputBox("Windows OS Product Key", "The installed Windows Operating System Product Key has been copied to the clipboard and is:", $xpkey) Else MsgBox(0,"ERROR","No Product Key Found") EndIf ; Decodes The XP Key In The Registry ; *(May work for other installed Microsoft Products) Func MSDecode($msd_prodid, $msd_sep="") $msd_decoded ="" $msd_code="BCDFGHJKMPQRTVWXY2346789" Dim $msd_encoded[16] $msd_cnt=0 For $msd_t = 105 To 135 Step + 2 $msd_encoded[$msd_cnt]=Dec(StringMid($msd_prodid, $msd_t, 2)) $msd_cnt += 1 Next $msd_cnt=1 For $msd_t = 29 To 1 Step - 1 If $msd_cnt <> 6 Then $msd_mod = 0 For $msd_r = 14 To 0 Step -1 $msd_bit = BitOR(BitShift($msd_mod, -8), $msd_encoded[$msd_r]) $msd_encoded[$msd_r] = Int($msd_bit / 24) $msd_mod = Mod($msd_bit, 24) Next $msd_decoded = StringMid($msd_code, $msd_mod + 1, 1) & $msd_decoded $msd_cnt += 1 Else $msd_cnt=1 If $msd_sep<>"" Then $msd_decoded = $msd_sep & $msd_decoded EndIf Next Return $msd_decoded EndFunc Perhaps with some minor adjustments you could use this to extract your installed MS Office key or other MS Products. Not sure if this works on any other operating system, but it might. I wanted to add this to a setup.exe replacement in an unattended XP install I was creating. Hope this is found useful to someone. Cheers.
  8. Yeah, they weren't a lot of power, but they sure were fun. I think I've owned every model they ever had, like the portable one, which was really cool for its time. I had a regular C-64 up until about 2 years ago, now I have an emulator. It emulates the old VIC-20, C-64, 128 and the old CBM machines. So, I can still play my old favorites, like Impossible Mission, etc.
  9. Just a simple script that Minimizes and Restores all windows except the one you define. Of course, it would be easy enough to rewrite this to include a delimited list of exceptions, but I'll leave that to you. ; **** EXAMPLE **** ; MinimizeAllBut("Notepad") ; Sleep(1000) ; RestoreAllBut("Notepad") ; Exit ; Minimizes All Windows Except Defined Window ; ; $mab_title = Windows Title you wish not to Minimize ; *(This is compared using StringInStr, so ; use caution when defining title. A ; too general title may exempt other ; windows you want to be minimized) Func MinimizeAllBut($mab_title) $mab_var = WinList() Global $mab_winstate[$mab_var[0][0]+1][3] $mab_winstate[0][0]=$mab_var[0][0] For $mab_i = 1 to $mab_var[0][0] $mab_winstate[$mab_i][1]=$mab_var[$mab_i][0] $mab_winstate[$mab_i][2]=WinGetState($mab_var[$mab_i][1]) If $mab_var[$mab_i][0] <> "" AND BitAnd(WinGetState($mab_var[$mab_i][1]), 2) AND BitAnd(WinGetState($mab_var[$mab_i][1]), 16)=0 AND BitAnd(WinGetState($mab_var[$mab_i][1]), 8) AND StringInStr($mab_var[$mab_i][0], $mab_title)=0 Then WinSetState($mab_var[$mab_i][0], "", @SW_MINIMIZE) Next EndFunc Func RestoreAllBut($mab_title) For $mab_i = 1 to $mab_winstate[0][0] If $mab_winstate[$mab_i][1] <> "" AND BitAnd($mab_winstate[$mab_i][2], 16)=0 AND BitAnd($mab_winstate[$mab_i][2], 8) AND StringInStr($mab_winstate[$mab_i][1], $mab_title)=0 Then WinSetState($mab_winstate[$mab_i][1], "", @SW_RESTORE) Next EndFunc Hope this comes in handy for someone. Cheers.
  10. Thanx, weaponx. I appreciate it. I can use all the help I can get...lol.
  11. Thanks. Any help anyone can give me, resources, links, ideas...hell, maybe someone else has started the same thing. No sense reinventing the wheel. Give me a shout if you want to contribute. Thanks. Cheers
  12. LOL. I hear ya. I found where someone had started some API DLL conversions for VB and it wasn't bad, alittle buggy. I realized there was a real need for that here and decided it was time I contributed. Maybe it could become a joint effort. I know there are lot of gurus on here who know a crap more about this stuff then I do. Anywho, thanks for the reply. I hope to get this going sometime...one step at a time. Cheers
  13. I am currently trying to create a VB to AU3 converter and am not sure about some DLL handling in Visual BASIC, (for that matter, in AutoIt3). Here's an example: CODEPrivate Type Target ' for use in MIXERLINE and others (embedded structure) dwType As Long ' MIXERLINE_TARGETPrivate Type_xxxx dwDeviceID As Long ' target device ID of device Private Type wMid As Integer ' of target device wPid As Integer ' " vDriverVersion As Long ' " szPname As String * MAXPNAMELEN End Type I took that VB code and converted it like this: $Target = DllStructCreate("long dwType;long dwDeviceID;int wMid;int wPid;long vDriverVersion;long szPname") Am I way off here or is that just about right? If it is right, I'm not too sure how to implement it later, but I'm just kinda taking this one headache at a time. What does anyone think?
  14. Not a problem. I'm glad to be of service. Good luck. Cheers
  15. Func Type($text) If GUICtrlRead($Input)<>"" then _GUICtrlEdit_AppendText($Input, @CRLF) For $letter = 1 To StringLen($text) $string = StringMid($text, $letter, 1) _GUICtrlEdit_AppendText($Input, $string) Sleep($Delay) Next EndFunc ;==>Type Maybe try this.
  16. Try this. I am using GUIEdit.au3 to enhance this and make it smoother and to auto-scroll: #include <Misc.au3> #include <GUIConstants.au3> #include <GUIEdit.au3> Opt("SendKeyDelay", 100) Opt("GUICloseOnESC", 0) $Name = IniRead(@ScriptDir & "\Typer.ini", "Basic", "Name", "Error reading ini file") $Subject = IniRead(@ScriptDir & "\Typer.ini", "Basic", "Subject", "Error reading ini file") $Line = 1 $GuiTyper = GUICreate("[" & $Subject & "]" & " - " & "[" & $Name & "]", 300, 200) $Input = GUICtrlCreateEdit("", 10, 10, 280, 140, BitOR($ES_CENTER, $ES_AUTOHSCROLL, $ES_AUTOVSCROLL, $ES_MULTILINE, $ES_READONLY, $WS_VSCROLL)) GUICtrlSetFont(-1, 10, 400, 0, "Verdana") GUICtrlSetColor(-2, "0x880000") $Continue = GUICtrlCreateButton("Continue", 100, 160, 100, 30) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $Continue Type(IniRead(@ScriptDir & "\Typer.ini", "Text", $Line, "Unable to retrieve the next line.")) $Line = $Line + 1 Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func Type($text) If GUICtrlRead($Input)<>"" then _GUICtrlEdit_AppendText($Input, @CRLF) For $letter = 1 To StringLen($text) $string = StringMid($text, $letter, 1) _GUICtrlEdit_AppendText($Input, $string) Sleep(10) Next _GUICtrlEdit_LineScroll($Input, 0, _GUICtrlEdit_GetLineCount($Input)+1) MsgBox(0, "", "") EndFunc ;==>Type This should do it. Works nice on my computer. EDIT: Actually, the "_GUICtrlEdit_LineScroll($Input, 0, _GUICtrlEdit_GetLineCount($Input)+1)" line isn't necessary, but I put it in, in case you'd like to know how to do this in the future.
  17. Try using the $ES_AUTOVSCROLL style on your Edit control: $Input = GUICtrlCreateEdit("", 10, 10, 280, 140, BitOR($ES_CENTER, $ES_AUTOHSCROLL, $ES_AUTOVSCROLL, $ES_MULTILINE, $ES_READONLY, $WS_VSCROLL)) The help that people give you is usually based on the current version of AutoIt3. I was just trying to be thorough.
  18. Or you could put a @CRLF in the Default value of the INIRead. EDIT: BTW, did you ever update to the latest AutoIt3 version?
  19. The +1 was to get all parts of the $text string since the $count string was basically ahead when you do the Until. I think the For...Next example is better though. You are welcome. Glad to help. Happy coding. Cheers
  20. 1. I'm not sure why your font style doesn't change, (Arial), it's working fine on my computer. Perhaps you need the latest AutoIt3 update. Or the other font you're use isn't available or you have named it wrong. 2. The color is easy enough. You have disabled the input control which always grays it out. If you don't want someone to be able to type in the input area, use an Edit control with the readonly style on. 3. See the Type function below, ( ). Works fine with the Edit control. Here is the code that works on my computer: #include <Misc.au3> #include <GUIConstants.au3> Opt("SendKeyDelay", 100) Opt("GUICloseOnESC", 0) $Name = IniRead(@ScriptDir & "\Typer.ini", "Basic", "Name", "Error reading ini file") $Subject = IniRead(@ScriptDir & "\Typer.ini", "Basic", "Subject", "Error reading ini file") $Line = 1 $GuiTyper = GUICreate("[" & $Subject & "]" & " - " & "[" & $Name & "]", 300, 200) $Input = GUICtrlCreateEdit("", 10, 10, 280, 140, BitOR($ES_CENTER, $ES_AUTOHSCROLL, $ES_MULTILINE, $ES_READONLY, $WS_VSCROLL)) GUICtrlSetFont(-1, 16, Default, "Arial") ;GUICtrlSetFont(-1, 12, 400, 0, "Tahoma") GUICtrlSetColor(-2, "0x880000") ;GUICtrlSetState(-3, $GUI_DISABLE) $Continue = GUICtrlCreateButton("Continue", 100, 160, 100, 30) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $Continue Type(IniRead(@ScriptDir & "\Typer.ini", "Text", $Line, "Error reading ini file")) $Line = $Line + 1 Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func Type($text) GUICtrlSetData($Input, GUICtrlRead($Input) & $text & @CRLF) EndFunc ;==>Type Hope this helps you out. Cheers
  21. By the way, Larry, if you are looking for some structure info for the Windows Explorer sim, I've found this in the past, (http://www.autoitscript.com/forum/index.ph...st&p=105811), though you'd want to use a listview, I think, instead of treeview...that is if you want to multi-select items. I had to edit the AutoIt3Explorer.au3 listed there, if you want it, here it is: ; ---------------------------------------------------------------------------- ; ; AutoIt Version: 3.1.1.73 ; Author: Holger Kotsch ; Version: 1.1 ; ; Script Function: ; Unfinished Explorer-like sample (Preview) ; ; !!! Self-API-created items are not supported !!! ; ; ---------------------------------------------------------------------------- #include <GUIConstants.au3> #include <GUITreeView.au3> #include <Misc.au3> ; TV functions Global $TVM_INSERTITEM = $TV_FIRST + 0 Global $TVM_GETITEMRECT = $TV_FIRST + 4 Global $TVM_SETIMAGELIST = $TV_FIRST + 9 Global $TVM_SETITEM = $TV_FIRST + 13 Global $TVM_HITTEST = $TV_FIRST + 17 Global $TVI_FIRST = 0xFFFF0001 ; Masks Global $TVIF_IMAGE = 0x0002 Global $TVIF_HANDLE = 0x0010 Global $TVIF_SELECTEDIMAGE = 0x0020 Global $TVIF_CHILDREN = 0x0040 ; States Global $TVIS_CUT = 0x0004 Global $TVIS_DROPHILITED = 0x0008 Global $TVIS_BOLD = 0x0010 Global $TVIS_EXPANDED = 0x0020 ; Relationship/specific item Global $TVGN_ROOT = 0x0000 Global $TVGN_PREVIOUS = 0x0002 Global $TVGN_FIRSTVISIBLE = 0x0005 Global $TVGN_NEXTVISIBLE = 0x0006 Global $TVGN_PREVIOUSVISIBLE = 0x0007 Global $TVGN_DROPHILITE = 0x0008 ; Hittest infos Global $TVHT_NOWHERE = 0x0001 Global $TVHT_ONITEMICON = 0x0002 Global $TVHT_ONITEMLABEL = 0x0004 Global $TVHT_ONITEMINDENT = 0x0008 Global $TVHT_ONITEMBUTTON = 0x0010 Global $TVHT_ONITEMRIGHT = 0x0020 Global $TVHT_ONITEMSTATEICON = 0x0040 Global $TVHT_ONITEM = BitOr($TVHT_ONITEMICON, $TVHT_ONITEMLABEL, $TVHT_ONITEMSTATEICON) Global $TVHT_ABOVE = 0x0100 Global $TVHT_BELOW = 0x0200 Global $TVHT_TORIGHT = 0x0400 Global $TVHT_TOLEFT = 0x0800 If Not IsDeclared("LVM_SETEXTENDEDLISTVIEWSTYLE") Then Global $LVM_SETEXTENDEDLISTVIEWSTYLE = 0x1036 If Not IsDeclared("LVM_SETCOLUMN") Then Global $LVM_SETCOLUMN = 0x101A If Not IsDeclared("LVCF_FMT") Then Global $LVCF_FMT = 0x0001 If Not IsDeclared("LVCFMT_RIGHT") Then Global $LVCFMT_RIGHT = 0x0001 If Not IsDeclared("LVM_GETHEADER") Then Global $LVM_GETHEADER = 0x101F Global $nCtrls = 0 Global $hCurItem = 0 Global $hImageList = 0 Global $szDirType = RegRead("HKCR\Directory", "") If $szDirType = "" Then $szDirType = "Directory" $hGui = GUICreate("AutoIt3-Explorer V1.1 ;-)", 762, 578, -1, -1, BitOr($WS_SIZEBOX, $WS_MAXIMIZEBOX, $WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU)) $nFileMenu = GUICtrlCreateMenu("&File") $editMenu = GUICtrlCreateMenu("&Edit") $nViewMenu = GUICtrlCreateMenu("&View") $nViewItem1 = GUICtrlCreateMenuItem("Icons", $nViewMenu, -1, 1) $nViewItem2 = GUICtrlCreateMenuItem("Report", $nViewMenu, -1, 1) GUICtrlSetState(-1, $GUI_CHECKED) $nViewItem3 = GUICtrlCreateMenuItem("Small Icons", $nViewMenu, -1, 1) $nViewItem4 = GUICtrlCreateMenuItem("List", $nViewMenu, -1, 1) $nExtraMenu = GUICtrlCreateMenu("E&xtra") $nHelpMenu = GUICtrlCreateMenu("&?") $nExitItem = GUICtrlCreateMenuItem("Exit",$nFileMenu) $nAboutItem = GUICtrlCreateMenuItem("About",$nHelpMenu) GUICtrlCreateLabel("", 0, 0, 800, 2, BitOr($SS_SUNKEN, $SS_BLACKRECT)) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT) GUICtrlCreateLabel("Address", 5, 5, 50, 20) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) $nAddressbar = GUICtrlCreateCombo("C:\", 50, 3, 600, 20) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT) $arDrives = DriveGetDrive("ALL") $nTreeView = GUICtrlCreateTreeView(0, 25, 310, 513, -1, $WS_EX_CLIENTEDGE) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH) GUICtrlSetState(-1, $GUI_FOCUS) GUICtrlSetImage(-1, "shell32.dll", 3, 4) ; GUICtrlSetImage(-1, "shell32.dll", 4, 2) ; GUICtrlSetImage(-1, "shell32.dll", 7) ; Removable GUICtrlSetImage(-1, "shell32.dll", 8) ; Fixed GUICtrlSetImage(-1, "shell32.dll", 9) ; Network GUICtrlSetImage(-1, "shell32.dll", 11) ; CD-ROM $nListView = GUICtrlCreateListView("Name|Size|Type|Changed",314, 25, 447, 513) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM) GUICtrlSendMsg(-1, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES) GUICtrlListViewSetColumnFormat($nListView, 1, $LVCFMT_RIGHT) GUICtrlSetImage(-1, "shell32.dll", 0) $statusbarobj = GUICtrlCreateLabel(" Object(s)",0, 540, 150, 18, $SS_SUNKEN) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKBOTTOM + $GUI_DOCKHEIGHT + $GUI_DOCKWIDTH) $statusbarsize = GUICtrlCreateLabel(" MB (Free Space: 0 MB)", 152, 540, 610, 18, $SS_SUNKEN) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKBOTTOM + $GUI_DOCKHEIGHT) $nSplitter = GUICtrlCreateLabel("", 310, 29, 4, 509) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH) GUICtrlSetCursor(-1, 13) GUISetState() FillTreeRoot($arDrives) UpdateWindow($nTreeView) $nFirstItem = 0 $nLastItem = 0 $nOldItem = 0 DirToList("C:") $szCurrentPath = "C:" $szOldPath = "" $curx = 0 $curpressed = 0 $splitx1 = 48 $splitx2 = 52 $savex = 310 $pressed = 0 While 1 $nMsg = GUIGetMsg() $arInfo = GUIGetCursorInfo() If $pressed = 1 And $arInfo[2] = 0 Then $pressed = 0 If $pressed = 1 And $arInfo[2] = 1 Then $arPos = WinGetPos($hGui) If $arInfo[0] > 100 And $arInfo[0] < $arPos[2] - 100 Then If $arInfo[0] <> $savex Then ControlMove($hGui, "", $nSplitter, $arInfo[0] - 2, 29) ControlMove($hGui, "", $nTreeView, 0, 25, $arInfo[0] - 2) ControlMove($hGui, "", $nListView, $arInfo[0] + 2, 25, $arPos[2] - $arInfo[0] - 10) $savex = $arInfo[0] EndIf EndIf EndIf If IsArray($arInfo) AND $arInfo[4] = $nTreeView And $arInfo[2] And WinActive($hGui) Then $nFlag = 0 $hItem = TV_Hittest($nTreeView, $nFlag) If BitAnd($nFlag, $TVHT_ONITEMBUTTON) Or BitAnd($nFlag, $TVHT_ONITEM) Then GUISetState(@SW_LOCK) CheckTreeFill($nTreeView, $hItem) GUISetState(@SW_UNLOCK) GUICtrlSetData($nAddressbar, GetTreePath($nTreeView, $hItem, "\")) EndIf $hItem = GUICtrlSendMsg($nTreeView, $TVM_GETNEXTITEM, $TVGN_CARET, 0) $szCurrentPath = GetTreePath($nTreeView, $hItem, "\") If BitAnd($nFlag, $TVHT_ONITEM) Then GUICtrlSetData($nAddressbar, $szCurrentPath) If $szOldPath <> $szCurrentPath Then $szOldPath = $szCurrentPath GUISetState(@SW_LOCK) For $i = $nFirstItem To $nLastItem GUICtrlDelete($i) Next GUISetState(@SW_UNLOCK) ;UpdateCtrl($hGui, $nListView) $nFirstItem = 0 $nLastItem = 0 $nOldItem = 0 GUICtrlSetData($nAddressbar, $szCurrentPath) GUICtrlSetCursor($nListView,1) GUICtrlSetCursor($nTreeView,1) DirToList($szCurrentPath) GUICtrlSetCursor($nListView,2) GUICtrlSetCursor($nTreeView,2) EndIf ElseIf _IsPressed("6B") And ControlGetFocus($hGui) = "SysTreeView321" Then $hItem = GUICtrlSendMsg($nTreeView, $TVM_GETNEXTITEM, $TVGN_CARET, 0) CheckTreeFill($nTreeView, $hItem) EndIf Switch $nMsg Case $GUI_EVENT_CLOSE, $nExitItem ExitLoop Case $nAboutItem Msgbox(64,"About","Demo by Holger") Case $nSplitter $cinfo = GUIGetCursorInfo() If $cinfo[2] = 1 Then $pressed = 1 Case $nViewItem1 To $nViewItem4 GUICtrlSetStyle($nListView, BitOr($LVS_SHOWSELALWAYS, $LVS_SINGLESEL, $nMsg - $nViewItem1)) EndSwitch WEnd Exit Func CheckTreeFill($nCtrl, $hItem) If $hItem > 0 Then $hChild = GUICtrlSendMsg($nTreeView, $TVM_GETNEXTITEM, $TVGN_CHILD, $hItem) If $hChild > 0 Then $szText = GetItemText($nTreeView, $hChild) If $szText = "" Then $szPath = GetTreePath($nTreeView, $hItem, "\") If StringRight($szPath, 1) = "\" Then $szPath = StringTrimRight($szPath, 1) GUICtrlSetCursor($nTreeView, 1) FillTree($szPath, $hItem, $hChild) GUICtrlSetCursor($nTreeView, 2) EndIF EndIf EndIf EndFunc Func FillTreeRoot($arDrives) Local $hSearch, $szFile, $nChildren, $szDriveLabel $hParent = 0 For $i = 1 To $arDrives[0] $nChildren = 0 If GetSubFolder($arDrives[$i]) Then $nChildren = 1 $szType = DriveGetType($arDrives[$i]) Switch $szType Case "Removable" $iImage = 2 $iSelectedImage = 2 Case "Fixed" $iImage = 3 $iSelectedImage = 3 Case "Network" $iImage = 4 $iSelectedImage = 4 Case "CDROM" $iImage = 5 $iSelectedImage = 5 Case Else $iImage = 0 $iSelectedImage = 0 EndSwitch If $szType = "Removable" Then $szText = "Removable" ElseIf $szType = "Network" Then $szLabel = DriveMapGet($arDrives[$i]) $nPos = StringInStr($szLabel, "\", 0, -1) $szText = StringRight($szLabel, StringLen($szLabel) - $nPos) & " on """ & StringTrimLeft(StringLeft($szLabel, $nPos - 1), 2) & """" Else $szText = DriveGetLabel($arDrives[$i]) EndIf $szDriveLabel = $szText & " (" & StringUpper($arDrives[$i]) & ")" $hItem = InsertItem($szDriveLabel, $hParent, $hCurItem, $nChildren, $iImage, $iSelectedImage) If $nChildren = 1 Then InsertDummyItem($nTreeView, $hItem) Next $hItem = GUICtrlSendMsg($nTreeView, $TVM_GETNEXTITEM, $TVGN_ROOT, 0) GUICtrlSendMsg($nTreeView, $TVM_SELECTITEM, $TVGN_CARET, $hItem) EndFunc Func FillTree($szPath, $hParent = 0, $hDelete = 0) Local $hSearch, $szFile, $nChildren If $hDelete > 0 Then GUICtrlSendMsg($nTreeView, $TVM_DELETEITEM, 0, $hDelete) SetItemChildren($hParent) EndIf $hSearch = FileFindFirstFile($szPath & "\*.*") If $hSearch = -1 Then Return While 1 $szFile = FileFindNextFile($hSearch) If @error Then ExitLoop If StringInStr(FileGetAttrib($szPath & "\" & $szFile), "D") Then $nChildren = 0 If GetSubFolder($szPath & "\" & $szFile) Then $nChildren = 1 $hItem = InsertItem($szFile, $hParent, $hCurItem, $nChildren) If $nChildren = 1 Then InsertDummyItem($nTreeView, $hItem) $nCtrls = $nCtrls + 1 EndIf WEnd FileClose($hSearch) EndFunc Func GetSubFolder($szPath) Local $hSearch, $szFile, $nChildren = 0 $hSearch = FileFindFirstFile($szPath & "\*.*") If $hSearch = -1 Then Return While 1 $szFile = FileFindNextFile($hSearch) If @error Then ExitLoop If StringInStr(FileGetAttrib($szPath & "\" & $szFile), "D") Then $nChildren = 1 ExitLoop EndIf WEnd FileClose($hSearch) Return $nChildren EndFunc Func InsertItem($szText, $hParent, $hInsertAfter, $nChildren, $iImage = 0, $iSelectedImage = 1) $pszText = DllStructCreate("char[260]") DllStructSetData($pszText, 1, $szText) $tvItem = TVITEM() $tvInsertStruct = DllStructCreate("int;int;int[10]") If $hCurItem = 0 Then $hInsertAfter = $TVI_FIRST Else $hInsertAfter = $hCurItem EndIf DllStructSetData($tvInsertStruct, 1, $hParent) DllStructSetData($tvInsertStruct, 2, $hInsertAfter) DllStructSetData($tvInsertStruct, 3, $tvItem) $hItem = GUICtrlSendMsg($nTreeView, $TVM_INSERTITEM, 0, DllStructGetPtr($tvInsertStruct)) If $hItem > 0 Then $hCurItem = $hItem DllStructSetData($tvItem, 1, BitOr($TVIF_TEXT, $TVIF_IMAGE, $TVIF_SELECTEDIMAGE)) DllStructSetData($tvItem, 2, $hItem) DllStructSetData($tvItem, 5, DllStructGetPtr($pszText)) DllStructSetData($tvItem, 7, $iImage) DllStructSetData($tvItem, 8, $iSelectedImage) GUICtrlSendMsg($nTreeView, $TVM_SETITEM, 0, DllStructGetPtr($tvItem)) EndIf $tvInsertStruct="" $tvItem="" $pszText="" ; DllStructDelete($tvInsertStruct) ; DllStructDelete($tvItem) ; DllStructDelete($pszText) Return $hItem EndFunc Func InsertDummyItem($nCtrl, $hItem) InsertItem("", $hItem, $hCurItem, 0) EndFunc Func TV_Hittest($nCtrl, ByRef $nFlag) $hItem = 0 $point = DllStructCreate("int;int") DllCall("user32.dll", "int", "GetCursorPos", "ptr", DllStructGetPtr($point)) $hWnd = ControlGetHandle("", "", $nCtrl) DllCall("user32.dll", "int", "ScreenToClient", "hwnd", $hWnd, "ptr", DllStructGetPtr($point)) $tvHit = DllStructCreate("int[2];uint;int") DllStructSetData($tvHit, 1, DllStructGetData($point, 1), 1) DllStructSetData($tvHit, 1, DllStructGetData($point, 2), 2) If GUICtrlSendMsg($nCtrl, $TVM_HITTEST, 0, DllStructGetPtr($tvHit)) Then $nFlag = DllStructGetData($tvHit, 2) $hItem = DllStructGetData($tvHit, 3) EndIf $tvHit="" $point="" ; DllStructDelete($tvHit) ; DllStructDelete($point) Return $hItem EndFunc Func ItemHasChildren($nCtrl, $hItem) $nChildren = 0 If GUICtrlSendMsg($nCtrl, $TVM_GETNEXTITEM, $TVGN_CHILD, $hItem) > 0 Then $nChildren = 1 Return $nChildren EndFunc Func ExpandTree($nCtrl, $hItem) $result = GUICtrlSendMsg($nCtrl, $TVM_EXPAND, 0x0002, $hItem) EndFunc Func GetTreePath($nCtrl, $hItem, $szSepChar) Local $szPath = "", $hParent, $hWnd, $szText While $hItem > 0 $szText = GetItemText($nCtrl, $hItem) $hParent = GUICtrlSendMsg($nCtrl, $TVM_GETNEXTITEM, $TVGN_PARENT, $hItem) If $hParent = 0 Then $szText = StringRight(StringTrimRight($szText, 1), 2) $szPath = $szText & $szSepChar & $szPath $hItem = $hParent WEnd Return $szPath EndFunc Func GetItemText($nCtrl, $hItem) Local $szText = "", $pszText, $tvItem $pszText = DllStructCreate("char[260]") $tvItem = TVITEM() DllStructSetData($tvItem, 1, $TVIF_TEXT) DllStructSetData($tvItem, 2, $hItem) DllStructSetData($tvItem, 5, DllStructGetPtr($pszText)) DllStructSetData($tvItem, 6, 260) GUICtrlSendMsg($nTreeView, $TVM_GETITEM, 0, DllStructGetPtr($tvItem)) $szText = DllStructGetData($pszText, 1) $tvItem="" $pszText="" ; DllStructDelete($tvItem) ; DllStructDelete($pszText) Return $szText EndFunc Func GetItemState($nCtrl, $hItem) Local $nState = 0, $tvItem $tvItem = TVITEM() DllStructSetData($tvItem, 1, $TVIF_STATE) DllStructSetData($tvItem, 2, $hItem) DllStructSetData($tvItem, 4, $TVIS_STATEIMAGEMASK) GUICtrlSendMsg($nTreeView, $TVM_GETITEM, 0, DllStructGetPtr($tvItem)) $nState = DllStructGetData($tvItem, 3) $tvItem="" ; DllStructDelete($tvItem) Return $nState EndFunc Func TVITEM() Return DllStructCreate("uint;int;uint;uint;ptr;int;int;int;int;int") EndFunc Func UpdateWindow($nCtrl) $hWnd = ControlGetHandle("", "", $nCtrl) $rect = DllStructCreate("int;int;int;int") DllCall("user32.dll", "int", "InvalidateRect", "hwnd", $hWnd, "int", 0, "int", 0) EndFunc Func SetItemChildren($hItem, $nFlag = 1) Local $tvItem $tvItem = TVITEM() DllStructSetData($tvItem, 1, $TVIF_CHILDREN) DllStructSetData($tvItem, 2, $hItem) DllStructSetData($tvItem, 9, $nFlag) GUICtrlSendMsg($nTreeView, $TVM_SETITEM, 0, DllStructGetPtr($tvItem)) $tvItem="" ; DllStructDelete ($tvItem) EndFunc Func FileGetIconCount($szFile) Dim $szFile, $nCount = 0 $LPCTSTR = DllStructCreate("char[260]") DllStructSetData($LPCTSTR, 1, $szFile) $nCount = DllCall("shell32.dll", "int", "ExtractIconEx", "ptr", DllStructGetPtr($LPCTSTR), "int", -1, "int", 0, "int", 0, "int", 0) $nCount = $nCount[0] $LPCTSTR="" ; DllStructDelete($LPCTSTR) Return $nCount EndFunc Func DirToList($szPath) Dim $hSearch, $szFile, $szDate, $szType, $nItem If StringRight($szPath, 1) = "\" Then $szPath = StringTrimRight($szPath, 1) $hSearch = FileFindFirstFile($szPath & "\*.*") If $hSearch <> -1 Then $nItem = -1 While 1 $szFile = FileFindNextFile($hSearch) If @error Then ExitLoop $nIcon = 0 $szIconFile = $szPath & "\" & $szFile FileGetIcon($szIconFile, $nIcon, $szFile) $IsDir = StringInStr(FileGetAttrib($szPath & "\" & $szFile),"D") $szSize = "" If $IsDir Then $szType = $szDirType Else $szSize = Round(FileGetSize($szPath & "\" & $szFile) / 1000) & " KB" $szType = FileGetType($szFile) EndIf $arDate = FileGetTime($szPath & "\" & $szFile) If IsArray($arDate) Then $szDate = $arDate[2] & "." & $arDate[1] & "." & $arDate[0] & " " & $arDate[3] & ":" & $arDate[4] $nItem = GUICtrlCreateListViewItem($szFile & "|" & $szSize & "|" & $szType & "|" & $szDate, $nListView) If $IsDir Then GUICtrlSetImage(-1,$szIconFile, 3) Else GUICtrlSetImage(-1,$szIconFile,$nIcon) EndIf If $nFirstItem = 0 Then $nFirstItem = $nItem WEnd FileClose($hSearch) $nLastItem = $nItem If $nLastItem > 0 Then GUICtrlSetData($statusbarobj, $nLastItem - $nFirstItem & " Objects") Else GUICtrlSetData($statusbarobj, "Ready") EndIf EndIf EndFunc Func FileGetType($szFile) Dim $szFile, $szRegDefault = "", $szRegType = "" $szExt = StringRight($szFile,4) $szRegDefault = RegRead("HKCR\" & $szExt,"") If $szRegDefault <> "" Then $szRegType = RegRead("HKCR\" & $szRegDefault,"") If $szRegType = "" Then $szRegType = $szExt & "-File" Return $szRegType EndFunc Func FileGetIcon(ByRef $szIconFile, ByRef $nIcon, $szFile) Dim $szFile, $szRegDefault = "", $szDefIcon = "" $nIcon = 0 $szExt = StringRight($szFile,4) $szRegDefault = RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\" & $szExt,"ProgID") If $szRegDefault = "" Then $szRegDefault = RegRead("HKCR\" & $szExt,"") If $szRegDefault <> "" Then $szDefIcon = RegRead("HKCR\" & $szRegDefault & "\DefaultIcon","") If $szDefIcon = "" Then $szIconFile = "shell32.dll" ElseIf $szDefIcon <> "%1" Then $arSplit = StringSplit($szDefIcon,",") If IsArray($arSplit) Then $szIconFile = $arSplit[1] If $arSplit[0] > 1 Then $nIcon = $arSplit[2] Else Return 0 EndIf EndIf Return 1 EndFunc Func GUICtrlListViewSetColumnFormat($hListView, $nCol, $nFormat) $hListViewHeader = GUICtrlSendMsg($hListView, $LVM_GETHEADER, 0, 0) $LVCOLUMN = DllStructCreate("uint;int;int;ptr;int;int;int;int") DllStructSetData($LVCOLUMN, 1, $LVCF_FMT) DllStructSetData($LVCOLUMN, 2, $nFormat) GUICtrlSendMsg($hListView, $LVM_SETCOLUMN, $nCol, DllStructGetPtr($LVCOLUMN)) $LVCOLUMN="" ; DllStructDelete($LVCOLUMN) EndFunc Func UpdateCtrl($hWnd, $nCtrl) $hCtrl = ControlGetHandle($hWnd, "", $nCtrl) $point = DllStructCreate("int;int") $rect = DllStructCreate("int;int;int;int") DllCall("user32.dll", "int", "GetWindowRect", "hwnd", $hCtrl, "ptr", DllStructGetPtr($rect)) DllStructSetData($point, 1, DllStructGetData($rect, 1)) DllStructSetData($point, 2, DllStructGetData($rect, 2)) DllCall("user32.dll", "int", "ScreenToClient", "hwnd", $hCtrl, "ptr", DllStructGetPtr($point)) DllStructSetData($rect, 1, DllStructGetData($point, 1)) DllStructSetData($rect, 2, DllStructGetData($point, 2)) DllStructSetData($point, 1, DllStructGetData($rect, 3)) DllStructSetData($point, 2, DllStructGetData($rect, 4)) DllCall("user32.dll", "int", "ScreenToClient", "hwnd", $hCtrl, "ptr", DllStructGetPtr($point)) DllStructSetData($rect, 3, DllStructGetData($point, 1)) DllStructSetData($rect, 4, DllStructGetData($point, 2)) DllCall("user32.dll", "int", "InvalidateRect", "hwnd", $hWnd, "ptr", DllStructGetPtr($rect), "int", 1); $point="" $rect="" ; DllStructDelete($point) ; DllStructDelete($rect) EndFunc Hope this helps. Cheers
  22. Cool, Larry. Yeah, I got the whole simulation thing purdy licked, but it isn't as fast or good as an actual SysListView321 pane from Windows Explorer. I've also tried using the GUIListView.au3 and GUIImageList.au3 commands to create an image list to see if that might speed things up. It may have been a fraction faster, maybe, but I couldn't use negative icon references and most of my icons had a black border around them. Seemed like lots of work with piss pour results. Oh well. I guess I'll have to stick to simulation. It works, and not too badly, though it would be much easier, better and cleaner to use something like what I started this thread for. Thanks for your reply. Cheers
×
×
  • Create New...