
flashlab
Active Members-
Posts
29 -
Joined
-
Last visited
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
flashlab's Achievements

Seeker (1/7)
1
Reputation
-
flashlab reacted to a post in a topic: The Shell Context Menu
-
JScript reacted to a post in a topic: explorer shell context menu for autoit
-
Now it's possible to display shell context menu in a control(treeview,listview,list...) just like you right click on a file/folder in windows explorer. Hope you will like it The idea and original code come from http://www.codeproject.com/KB/cs/shellContextMenu.aspx, And the dll file was compiled by sd007 ONE PROBLEM : the program works fine on XP, but several items won't show on win7-x64, such as unlocker, foobar2000...Anyone can fix this? Here is an simple apply based on Yashied‘’s TVExplorer UDF #Include <GUIConstantsEx.au3> #Include <GUITreeView.au3> #Include <TVExplorer.au3> #Include <TreeViewConstants.au3> #Include <WindowsConstants.au3> #Include <WinAPIEx.au3> Opt('GUIOnEventMode', 1) Global $hForm, $hTV, $Input, $hFocus = 0, $Dummy, $Style Global $__RegAsmPath, $ShellContextMenu ;COM Handle _NETFramework_Load(@ScriptDir & "ExplorerShellContextMenu.dll") If Not @error Then $ShellContextMenu = ObjCreate("ExplorerShellContextMenu.ShowContextMenu") Else MsgBox(0,'',"error=" & @error &@CRLF&@CRLF& _ "1=ExplorerShellContextMenu.dll has been registered"&@CRLF& _ "2=DLL file does not exist"&@CRLF& _ "3=.NET Framework 2.0 required!"&@CRLF& _ "4=can't register the .net DLL") EndIf If Not _WinAPI_DwmIsCompositionEnabled() Then $Style = $WS_EX_COMPOSITED Else $Style = -1 EndIf $hForm = GUICreate('TVExplorer UDF Example', 700, 406, -1, -1, -1, $Style) GUISetOnEvent($GUI_EVENT_CLOSE, '_GUIEvent') GUISetIcon(@WindowsDir & 'explorer.exe') $Input = GUICtrlCreateInput('', 20, 20, 660, 19) GUICtrlSetState(-1, $GUI_DISABLE) $hTV = _GUICtrlTVExplorer_Create('', 20, 48, 660, 310, -1, $WS_EX_CLIENTEDGE, -1, '_TVEvent') _TVSetPath($Input, _GUICtrlTVExplorer_GetSelected($hTV)) _GUICtrlTVExplorer_SetExplorerStyle($hTV) $Dummy = GUICtrlCreateDummy() GUICtrlSetOnEvent(-1, '_GUIEvent') HotKeySet('{F5}', '_TVRefresh') GUISetState() While 1 Sleep(1000) WEnd Func _GUIEvent() Local $Path Switch @GUI_CtrlId Case $GUI_EVENT_CLOSE GUIDelete() _GUICtrlTVExplorer_DestroyAll() Exit Case $Dummy $Path = _GUICtrlTVExplorer_GetSelected($hFocus) _GUICtrlTVExplorer_AttachFolder($hFocus) _GUICtrlTVExplorer_Expand($hFocus, $Path, 0) $hFocus = 0 EndSwitch EndFunc ;==>_GUIEvent Func _TVEvent($hWnd, $iMsg, $sPath, $hItem) Switch $iMsg Case $TV_NOTIFY_BEGINUPDATE GUISetCursor(1, 1) Case $TV_NOTIFY_ENDUPDATE GUISetCursor(2) Case $TV_NOTIFY_SELCHANGED If $hTV = $hWnd Then _TVSetPath($Input, $sPath) EndIf Case $TV_NOTIFY_DBLCLK ; Nothing Case $TV_NOTIFY_RCLICK Local $asCurInfo = GUIGetCursorInfo() ClientToScreen($hForm, $asCurInfo[0], $asCurInfo[1]) $ShellContextMenu.Show($sPath,$asCurInfo[0],$asCurInfo[1]) Case $TV_NOTIFY_DELETINGITEM ; Nothing Case $TV_NOTIFY_DISKMOUNTED ; Nothing Case $TV_NOTIFY_DISKUNMOUNTED ; Nothing EndSwitch EndFunc ;==>_TVEvent Func _TVSetPath($iInput, $sPath) Local $Text = _WinAPI_PathCompactPath(GUICtrlGetHandle($iInput), $sPath, -2) If GUICtrlRead($iInput) <> $Text Then GUICtrlSetData($iInput, $Text) EndIf EndFunc ;==>_TVSetPath Func _TVRefresh() Local $hWnd = _WinAPI_GetFocus() If $hTV = $hWnd Then If Not $hFocus Then $hFocus = $hWnd GUICtrlSendToDummy($Dummy) EndIf Return EndIf HotKeySet('{F5}') Send('{F5}') HotKeySet('{F5}', '_TVRefresh') EndFunc ;==>_TVRefresh Func _NETFramework_Load($DLL_File) $ShellContextMenu = ObjCreate("ExplorerShellContextMenu.ShowContextMenu") If IsObj($ShellContextMenu) Then Return SetError(1,0,0) ; already registered If Not FileExists($DLL_File) Then Return SetError(2,0,0) ; == file does not exist Local $sRoot = RegRead("HKEY_LOCAL_MACHINESOFTWAREMicrosoft.NETFramework", "InstallRoot") If @error Then Return SetError(3,0,0) ; == .NET Framework 2.0 required! Local $aFolder = _FileListToArray($sRoot , "*", 2), $sNETFolder = '' For $i = $aFolder[0] To 1 Step -1 If StringRegExp($aFolder[$i], "v2.0.d+", 0) Then $sNETFolder = $aFolder[$i] ExitLoop EndIf Next If $sNETFolder = '' Then Return SetError(3,0,0) ; == NET Framework 2.0 required! $__RegAsmPath = $sRoot & $sNETFolder & "RegAsm.exe" If Not RunWait($__RegAsmPath & " /codebase " & $DLL_File, @ScriptDir, @SW_HIDE) Then Return SetError(4,0,0); can't register the .net DLL Return 1 EndFunc ;==>_NETFramework_Load Func __UnLoad_NET_Dll($DLL_File) RunWait($__RegAsmPath & " /unregister " & $DLL_File, @ScriptDir, @SW_HIDE) ; unregister the .net DLL EndFunc Func ClientToScreen($hWnd, ByRef $x, ByRef $y) Local $stPoint = DllStructCreate("int;int") DllStructSetData($stPoint, 1, $x) DllStructSetData($stPoint, 2, $y) DllCall("user32.dll", "int", "ClientToScreen", "hwnd", $hWnd, "ptr", DllStructGetPtr($stPoint)) $x = DllStructGetData($stPoint, 1) $y = DllStructGetData($stPoint, 2) ; release Struct not really needed as it is a local $stPoint = 0 EndFunc ;==>ClientToScreen ExplorerShellContextMenu.7z
-
sofa~great job! I'm reading the document here → http://www.pkware.com/documents/casestudies/APPNOTE.TXT
-
Humm... the udf works fine in my project. I have test it on hundreds of mp3 files. Since most mp3 files have Id3 2.3 or lower, it apply to common use. The author seems stop complete it, we can make it better
-
Hi!Flok3r Have you tried my modified version? It work for me to remove ID1 and ID2.2/2.3 tags though _ID3WriteTag($file_dir, 1) the author has designed the function, but didn't finish it. you can use text compare tool to check the difference. hope you like it~~
-
Is it possible to unzip binary stream without write it to a file? And the stream is a zipped folder. I've searched forum and think zlib may achieve it, But how...
-
Thanks to ProgAndy's udf it's really amazing. But here is the problem. When I drag an item from a listview and release the left mouse button within the listview control(or within the app's main window), a message says 'Copy'. Now I would like the progress cancel the dragdrop action if the drop location is the app itself,or just shield the COPY message since it's obviously wrong. I've tried to add a function ,which make sure the window under the cursor is not the app itself, before the message shows. Func _WindowGetHovered() Local $h_Struct = DllStructCreate($tagPoint) DllStructSetData($h_Struct, "x", MouseGetPos(0)) DllStructSetData($h_Struct, "y", MouseGetPos(1)) Local $h_wnd = _WinAPI_WindowFromPoint($h_Struct) Local $res=_WinAPI_GetParent($h_wnd) Return $res EndFunc But it doesn't work fine I even don't know why I can't get the right handle of currect cursor location. Anyone can help me
-
I've look though all your post, it seems you've spent lots of time on this UDF. So do I. And all the trouble you've met also puzzled me. It's really a complex project, what I can do is just hoping crash .etc not occured this one is what I used currently, wish to help some what → ID3_flashlab.au3
-
Is there any good idea to fetch changed data after $LVN_ENDLABELEDITW notify? #include <GuiConstantsEx.au3> #include <GuiListView.au3> #include <GuiImageList.au3> #include <WindowsConstants.au3> Global $ord_name, $Changed = -1 $GUI = GUICreate("(UDF Created) ListView Create", 400, 300) $hListView = _GUICtrlListView_Create($GUI, "1|2|3", 2, 2, 394, 268, BitOR($LVS_EDITLABELS, $LVS_REPORT)) _GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES)) GUISetState() GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") _GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0) _GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1) _GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2) _GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1) _GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1) _GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2) Do If $Changed <> -1 Then Local $pre_name = _GUICtrlListView_GetItemText($hListView, $Changed) If $pre_name = $ord_name Then $Changed = -1 ContinueLoop EndIf MsgBox(0,$ord_name, $pre_name) $Changed = -1 EndIf Sleep(100) Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo ;~ Local $tBuffer $hWndListView = $hListView If Not IsHWnd($hListView) Then $hWndListView = GUICtrlGetHandle($hListView) $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndListView Switch $iCode Case $LVN_BEGINLABELEDITW ; Start of label editing for an item Return False Case $LVN_ENDLABELEDITW ; The end of label editing for an item Local $tInfo = DllStructCreate($tagNMLVDISPINFO, $ilParam) Local $tBuffer = DllStructCreate("char Text[" & DllStructGetData($tInfo, "TextMax") & "]", _ DllStructGetData($tInfo, "Text")) Local $sNewText = DllStructGetData($tBuffer, "Text") $Changed = DllStructGetData($tInfo, "Item") $ord_name = _GUICtrlListView_GetItemText($hWndListView, $Changed) If StringLen($sNewText) Then Return True EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY What I can do is just above. Is it possible to get changed data directly? I really want to fetch it though $LVN_ENDLABELEDITW.
-
I make a simple func to read SYLT. Enjoy~ Func _GetSynLyrics($hFile,$FrameLen) Local $LengthToRead = $FrameLen, $_head, $LyricsFilename = @ScriptDir & "\" & "SynLyrics.txt", $bReturn $ID3Filenames &= $LyricsFilename & "|" $s_head = FileRead($hFile,6) $s_Encoding = BinaryMid($s_head,1,1) $s_Language = BinaryMid($s_head,2,3) $s_Stamp = BinaryMid($s_head,5,1) $s_Type = BinaryMid($s_head,6,1) $LengthToRead -= 6 $s_Descriptor = '' $Byte = FileRead($hFile,1) $sb_Descriptor = $Byte $LengthToRead -= 1 While $Byte <> "0x00" $s_Descriptor &= BinaryToString($Byte) $Byte = FileRead($hFile,1) $sb_Descriptor &= $Byte $LengthToRead -= 1 WEnd $bLyrics_Bin = FileRead($hFile,$LengthToRead) $SynText=Binary('') $i=1 ;~ Do ;~ $i+=1 ;~ $nByte=BinaryMid($bLyrics_Bin,$i,1) ;~ Until $nByte <> "0x00" While $i<$LengthToRead $SynBin=Binary('') While 1 $nByte=BinaryMid($bLyrics_Bin,$i,1) $i+=1 If $nByte="0x00" Then ExitLoop $SynBin &= $nByte WEnd $SynText&=StringToBinary(Dec(Hex(BinaryMid($bLyrics_Bin,$i,4))),1) $SynText&=BinaryMid(0x7C7C,1,2) $SynText&=$SynBin $SynText&=BinaryMid(0x0A0D,1,2) $i+=4 WEnd $hLyricFile = FileOpen($LyricsFilename, 2) ;Open for write and erase existing FileWrite($hLyricFile,$SynText) FileClose($hLyricFile) ;~ Switch $bText_Encoding ;~ Case 0x00 ;~ $Lyrics_Text = BinaryToString($bLyrics_Text) ;~ Case 0x01 ;~ $Lyrics_Text = BinaryToString($bLyrics_Text,2) ;~ EndSwitch $bReturn = $s_Encoding & $s_Language & $SynText $bReturn &= "|" & $LyricsFilename Return $bReturn EndFunccall the func in _ReadID3v2 Switch $FrameID Case "APIC" ;Picture (Write to File) $FrameData = _GetAlbumArt($hFile,$FrameSize) Case "USLT" ;Lyrics (Write to File) $FrameData = _GetSongLyrics($hFile,$FrameSize) Case "SYLT" $FrameData = _GetSynLyrics($hFile,$FrameSize) Case Else $FrameData = FileRead($hFile,$FrameSize) EndSwitch
-
embed graphic control in status bar
flashlab replied to flashlab's topic in AutoIt GUI Help and Support
THANK YOU! martin. I have figured out the 'EMBED' is though '_WinAPI_MoveWindow' Function. And the graphic control can't be moved. THANKS again. -
Is it possible to embed a graphic control in a status bar? The help document says we can embed ANY control in status bar,so what about graphic control? #include <GuiConstantsEx.au3> #include <GuiStatusBar.au3> Local $hGUI, $hStatus, $Graphic, $hGraphic Local $aParts[4] = [80, 160, 300, -1] $hGUI = GUICreate("StatusBar Embed Control", 400, 300) $hStatus = _GUICtrlStatusBar_Create ($hGUI) _GUICtrlStatusBar_SetMinHeight ($hStatus, 20) ;~ $Graphic = GUICtrlCreateGraphic(300, 270, 100, 20, -1) ; I can't cover the StatusBar Control ;~ GUICtrlSetBkColor(-1, 0xa0ffa0) ;~ GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0xff0000, 0xff0000) ;~ For $i = 0 To 4 ;~ GUICtrlSetGraphic(-1, $GUI_GR_RECT, 10+$i*20, 5, 10, 10) ;~ Next GUISetState() _GUICtrlStatusBar_SetParts ($hStatus, $aParts) _GUICtrlStatusBar_SetText ($hStatus, "Part 1") _GUICtrlStatusBar_SetText ($hStatus, "Part 2", 1) $Graphic = GUICtrlCreateGraphic(0, 0, -1, -1, -1) ; Embed Graphic?? GUICtrlSetBkColor(-1, 0xa0ffa0) GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0xff0000, 0xff0000) For $i = 0 To 4 GUICtrlSetGraphic(-1, $GUI_GR_RECT, 10+$i*20, 5, 10, 10) Next $hGraphic = GUICtrlGetHandle($Graphic) _GUICtrlStatusBar_EmbedControl ($hStatus, 3, $hGraphic, 3) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete()
-
OK Let's see something intuitive testwrite.au3 If nothing was wrong, a normal zip file will be created,whose size is half of the scriptfile. But I get twice the size than as expect. If i cut the binary into less than 8000b, I will get a part of zip file.SO, , , ----------------------------------------------------- Thanks! I've got the point!
-
Sorry for my poor English I've update the code. It now can be debuged directly. you will understand what I mean~ #include <WinHttp.au3> Local $jpg = _load('img3.douban.com','/lpic/s3292023.jpg',2) $jptg = StringMid($jpg,1,16386) $temp_JPG=FileOpen(@ScriptDir&'\img\s3292023.jpg',26) ;~ MsgBox(0,BinaryLen(Binary($jptg))&' '&BinaryMid(Binary($jptg),1,2),IsBinary(Binary($jptg))) FileWrite($temp_JPG,Binary($jptg)) FileClose($temp_JPG) $jptg2 = StringMid($jpg,1,16388) $temp_JPG=FileOpen(@ScriptDir&'\img\s3292024.jpg',26) ;~ MsgBox(0,BinaryLen(Binary($jptg2))&' '&BinaryMid(Binary($jptg2),1,2),IsBinary(Binary($jptg2))) FileWrite($temp_JPG,Binary($jptg2)) FileClose($temp_JPG) Func _load($hos,$req, $fo, $agent='',$fl='GET',$adata='') Local $hOpen, $hConnect, $hRequest, $sReturned If $agent='' Then $hOpen = _WinHttpOpen() Else $hOpen = _WinHttpOpen($agent) EndIf $hConnect = _WinHttpConnect($hOpen, $hos) $hRequest = _WinHttpOpenRequest($hConnect, $fl, $req) _WinHttpSendRequest($hRequest,'',$adata) _WinHttpReceiveResponse($hRequest) If _WinHttpQueryDataAvailable($hRequest) Then ; if there is data Do $sReturned &= _WinHttpReadData($hRequest,$fo) Until @error EndIf _WinHttpCloseHandle($hRequest) _WinHttpCloseHandle($hConnect) _WinHttpCloseHandle($hOpen) Return $sReturned EndFunc
-
I wanna to download a jpg file via winhttp. First I receive the binary data as string. Just like '0xFFD8FFE000104A...'. Then write it to file like↓ #include <WinHttp.au3> Local $jpg = _load('img3.douban.com','/lpic/s3292023.jpg',2) $jptg = StringMid($jpg,1,16386) $temp_JPG=FileOpen(@ScriptDir&'\img\s3292023.jpg',26) ;~ MsgBox(0,BinaryLen(Binary($jptg))&' '&BinaryMid(Binary($jptg),1,2),IsBinary(Binary($jptg))) FileWrite($temp_JPG,Binary($jptg)) FileClose($temp_JPG) $jptg2 = StringMid($jpg,1,16388) $temp_JPG=FileOpen(@ScriptDir&'\img\s3292024.jpg',26) ;~ MsgBox(0,BinaryLen(Binary($jptg2))&' '&BinaryMid(Binary($jptg2),1,2),IsBinary(Binary($jptg2))) FileWrite($temp_JPG,Binary($jptg2)) FileClose($temp_JPG) Func _load($hos,$req, $fo, $agent='',$fl='GET',$adata='') Local $hOpen, $hConnect, $hRequest, $sReturned If $agent='' Then $hOpen = _WinHttpOpen() Else $hOpen = _WinHttpOpen($agent) EndIf $hConnect = _WinHttpConnect($hOpen, $hos) $hRequest = _WinHttpOpenRequest($hConnect, $fl, $req) _WinHttpSendRequest($hRequest,'',$adata) _WinHttpReceiveResponse($hRequest) If _WinHttpQueryDataAvailable($hRequest) Then ; if there is data Do $sReturned &= _WinHttpReadData($hRequest,$fo) Until @error EndIf _WinHttpCloseHandle($hRequest) _WinHttpCloseHandle($hConnect) _WinHttpCloseHandle($hOpen) Return $sReturned EndFunc the strange thing is ,when I pick up 8192 bytes, it can't normal save, else it will save as string... Is Binary() has this number limitation?
-
I've solved already. Just some mistake~ Sorry for my post