Leaderboard
Popular Content
Showing content with the highest reputation on 07/10/2012 in all areas
-
These command strings can be retrieved from the registry easily enough. Assuming this is an exe it will be under: HKEY_CLASSES_ROOTexefileshell<conext menu string>Command, (Default) <conext menu string> string is the text you see in the context menu. The value of (Default) is the command or program run when you click that menu. The %1 at the end gets replaced by the path of the file you right clicked. You can get these values using RegRead(), but if you should know the path of a hex editor, so even bothering to look in the registry should be pointless.2 points
-
Function Reference _GUIResourcePic.au3 Functions related to the image control in the GUI. Sintax: _GUICtrlPic_Create( FileName, Left, Top [, Width [, Height [, Style [, ExStyle ]]]]]] ) _GUICtrlPic_SetImage( controlID, FileName [, FixSize ]]) _GUICtrlPic_Delete( controlID ) _GUICtrlPic_Release( controlID ) _GUICtrlPic_SetState( controlID, state ) _GUICtrlPic_GetInfo( FileName or Control ID ) Supports: ; Images in the format: .bmp, .jpg, .png, .gif {animated} and other formats of files for resources (.exe, .dll, .ocx, .cpl...). ; For the "resources", use the "FileName" in this format: "MyFile.ext|RessourceName|ResourceType". ; It can be a URL path as well! Download: Version: 1.8.2012.2600b _GUIResourcePic_(RedirectLink).html 17.0k (Previous downloads: 140) Example_Include_HD_GIF_(RedirectLink).html 36.08k (Previous downloads: 135) Note: Added new function! I've made significant changes in the code, including the syntax of some functions! Now uses GDI+ to render the images. Example of use is included! Sample: CPU in 0,60%. http://www.youtube.com/watch?v=NZZB-G9C1Kg Direct download: _GUIResourcePic.mp4 Fixes: $GUI_GIFSTART ; If image is GIF animated, start/resume animation! $GUI_GIFSTOP ; If image is GIF animated, stop/pause animation! ;----> Style (GIS = Gif Image Styles) $GIS_ASPECTRATIOFIX ; Fix the image size based on aspect ratio. $GIS_HALFTRANSPARENCY ; The images are rendered with the window background color. This Style is default. $GIS_FULLTRANSPARENCY ; The frames are rendered in full transparency independent of the background color of the window! Note: This Style consumes more CPU because the exstyle $WS_EX_TRANSPARENT is added to each frame in real time! Not valid if the image does not have transparency! ;----> Default Style to _GUICtrlPic_Create()! $GIS_SS_DEFAULT_PIC = BitOR($GIS_HALFTRANSPARENCY, $SS_NOTIFY) ;----> ExStyle (GIS_EX = Gif Image Extended Styles) $GIS_EX_DEFAULTRENDER ; To use _GUIImageList_Draw in rendering of images, use less CPU. This ExStyle is default! $GIS_EX_CTRLSNDRENDER ; The frames is render using GUICtrlSendMsg, but consumes much more CPU!!! Note: If you use this ExStyle, only $GRP_FULLTRANSPARENCY is used for rendering images! 1.02b 09/05/2012 -> After updating the code, the images with transparency were not being shown as they should, changed code again!09/05/2012 -> Fixes in the _GUICtrlPic_SetImage() function, the measures were not being updated according to the parameter FixSiz , identified by @Belini, thank you!Regards, João Carlos.1 point
-
#RequireAdmin #include <GuiListView.au3> #include <GuiTab.au3> #include <Array.au3> Global $arrTabs[1][4] ;Hostname|Tab#|ListView|WindDir $gui = GUICreate("SchTasksGUI", @DesktopWidth * .525, @DesktopHeight * .3725, -1, -1, 0x00070000) $tabs = GUICtrlCreateTab(2, 0, (@DesktopWidth * .525) - 6, (@DesktopHeight * .3725) - 22) GUICtrlSetResizing(-1, 102) $blanktab = GUICtrlCreateTabItem("Connect to ...") _NewConnection() GUIRegisterMsg(0x004E, "WM_NOTIFY") GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case -3 _GUIExit() Case -7 If _GUICtrlTab_GetCurSel($tabs) = _GUICtrlTab_GetItemCount($tabs)-1 Then _NewConnection() _GUICtrlTab_SetCurFocus($tabs,_GUICtrlTab_GetItemCount($tabs)-2) EndIf EndSwitch WEnd Func _AddTasksToGUI($arrTasks, $listTasks) ;Add captured task information and populate Listview in GUI If Not IsArray($arrTasks) Then Return 0 For $i = 0 To UBound($arrTasks) - 1 $arrTasks[$i] = StringReplace(StringReplace($arrTasks[$i], Chr(34) & "," & Chr(34), "|"), Chr(34), "") $arrEntry = StringSplit($arrTasks[$i], "|") $arrEntry[6] = "0x" & Hex($arrEntry[6],8) For $x = 2 To 27 If $x = 2 Then _GUICtrlListView_AddItem($listTasks, $arrEntry[$x]) Else _GUICtrlListView_AddSubItem($listTasks, $i, $arrEntry[$x], $x - 2) EndIf Next Next For $x = 0 To 24 If $x = 6 Then $x = 9 Else _GUICtrlListView_SetColumnWidth($listTasks, $x, $LVSCW_AUTOSIZE) EndIf Next EndFunc ;==>_AddTasksToGUI Func _FileDisplayProperties($sFile,$job) ;Display File Properties for Highlighted Items $objShell = ObjCreate("Shell.Application") $objCP = $objShell.Namespace($sFile) If Not IsObj($objCP) Then Return 0 For $clsConn In $objCP.Items If $clsConn.Name = $job Then For $clsVerb in $clsConn.verbs If $clsVerb.name = "P&roperties" then $clsVerb.DoIt Next EndIf Next $objShell = 0 $objCP = 0 EndFunc;==>_FileDisplayProperties Func _GetTasks($strHost = "") ;Retrieve task information from SCHTASKS.EXE $strExe = "schtasks.exe /query /v /fo csv /nh" If $strHost <> "" Then $strExe = $strExe & " /s " & $strHost $pid = Run($strExe, @WorkingDir, "", 2) $stdout = "" While 1 $line = StdoutRead($pid) If @error Then ExitLoop $stdout = $stdout & StringReplace($line, @CR, "") WEnd If StringInStr($stdout, "ERROR:") Or StringInStr($stdout, "INFO:") Then Return 0 $arrData = StringSplit($stdout, @LF) Do _ArrayDelete($arrData, 0) Until StringInStr($arrData[0], Chr(34) & "," & Chr(34)) _ArrayDelete($arrData, UBound($arrData) - 1) Return $arrData EndFunc ;==>_GetTasks Func _GetWindowsDir($strHost = ".") $objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & $strHost & "\root\cimv2") If Not IsObj($objWMIService) Then Return 0 $objWMIQuery = $objWMIService.ExecQuery("SELECT * FROM Win32_OperatingSystem") For $objOS in $objWMIQuery Return StringReplace($objOS.WindowsDirectory,":","$") Next EndFunc Func _GUIDblClick($tasklist="",$strHost="",$varWindowsDir="") $itemHit = _GUICtrlListView_SubItemHitTest($tasklist) If $itemHit[0] > -1 Then $strJob = "" $job = _GUICtrlListView_GetItemText($tasklist,$itemHit[0],0) If $varWindowsDir Then $strJob = "\\" & $strHost & "\" & $varWindowsDir & "\Tasks\" Else $varWindowsDir = _GetWindowsDir($strHost) If $varWindowsDir Then $strJob = "\\" & $strHost & "\" & $varWindowsDir & "\Tasks\" EndIf If $strJob Then _FileDisplayProperties($strJob,$job) EndIf Return True EndFunc Func _GUIExit() GUIDelete($gui) Exit EndFunc Func _NewConnection() $strHost = InputBox("Connect to...", "Hostname?", @ComputerName, "", 200, 120) $strHost = StringUpper($strHost) If Not Ping($strHost) Then msgbox(0,"","Could not Ping " & $strHost) Return 0 EndIf $tasks = _GetTasks($strHost) If $blanktab<>0 Then GUICtrlDelete($blanktab) If $arrTabs[0][1] <> "" Then ReDim $arrTabs[UBound($arrTabs)+1][4] $arrTabs[UBound($arrTabs)-1][0] = $strHost $arrTabs[UBound($arrTabs)-1][1] = GUICtrlCreateTabItem("Current Tasks on " & $strHost) $pos = WinGetPos($gui) $varWinHeight = $pos[3] $varWinWidth = $pos[2] $arrTabs[UBound($arrTabs)-1][2] = GUICtrlCreateListView("TaskName|Next Run Time|Status|Last Run Time|Last Result|Creator|Schedule|Task To Run|Start In|Comment|Scheduled Task State|Scheduled Type|Start Time|Start Date|End Date|Days|Months|Run as User|Delete Task If Not Rescheduled|Stop Task If Runs X Hours and X Mins|Repeat: Every|Repeat: Until|Repeat: Until Duration|Repeat: Stop If Still Running|Idle Time|Power Management", $varWinWidth - ($varWinWidth * .98), $varWinHeight - ($varWinHeight * .98) + ($varWinHeight * .0475), $varWinWidth * .95, ($varWinHeight * .875) - 12,0x0004) GUICtrlSetResizing(-1, 102) _AddTasksToGUI($tasks, $arrTabs[UBound($arrTabs)-1][2]) $blanktab = GUICtrlCreateTabItem("Connect to ...") $tasks = "" EndFunc Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) ;Notify func Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") For $x = 0 To UBound($arrTabs)-1 Switch $hWndFrom Case GUICtrlGetHandle($arrTabs[$x][2]) $tasklist = GUICtrlGetHandle($arrTabs[$x][2]) $strHost = $arrTabs[$x][0] $varWindowsDir = $arrTabs[$x][3] Switch $iCode Case -3 Return _GUIDblClick($tasklist,$strHost,$varWindowsDir) Case -5 Return True EndSwitch EndSwitch Next EndFunc ;==>WM_NOTIFY1 point
-
GUICtrlCreateLabel or GUICtrlSetData: Word wrap even with no white spaces?
abaddon7734 reacted to PhoenixXL for a topic
Why not get the dimensions of the rectangle that would be able to bound the text Try this code: #include <Constants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GDIPLus.au3> Local $sLongest_Text="C:Documents and SettingsusernameApplication DataNokiaPCSyncSynchDataBackups1232012" Local $sPos=CalcRectangle($sLongest_Text) GUICreate("Window size: 300x300", $sPos[0], 500) GUISetState() GUICtrlCreateLabel("Label with width more than window: 500", 20, 20, 250) GUICtrlSetFont(-1, 8.5, 600) $sPos=CalcRectangle("C:Documents and SettingsusernameApplication DataNokiaPCSyncSynchDataBackups1232012") GUICtrlCreateLabel("", 20, 40, $sPos[0], $sPos[1]) GUICtrlSetBkColor(-1,0xFF23FF) GUICtrlSetData(-1, "C:Documents and SettingsusernameApplication DataNokiaPCSyncSynchDataBackups1232012") GUICtrlCreateLabel("Label with small width less than window: 260", 20, 100, 260) GUICtrlSetFont(-1, 8.5, 600) $sPos=CalcRectangle('C:Documents_and_SettingsusernameApplication_DataNokiaPCSyncSynchDataBackups1232012') GUICtrlCreateLabel("", 20, 120, $sPos[0], $sPos[1]) GUICtrlSetBkColor(-1,0xFF23FF) GUICtrlSetData(-1, "C:Documents_and_SettingsusernameApplication_DataNokiaPCSyncSynchDataBackups1232012") GUICtrlCreateLabel('Label with manual line feed "@LF" ', 20, 180, 250) GUICtrlSetFont(-1, 8.5, 600) $sPos=CalcRectangle("C:Documents and Settingsusername" & @LF & "Application DataNokiaPCSync" & @LF & "SynchDataBackups1232012") GUICtrlCreateLabel("", 20, 200, $sPos[0], $sPos[1]) GUICtrlSetData(-1, "C:Documents and Settingsusername" & @LF & "Application DataNokiaPCSync" & @LF & "SynchDataBackups1232012") GUICtrlSetBkColor(-1,0xFF23FF) While 1 $msg=GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func CalcRectangle($sString, $sFont='Arial',$fFontsize=8.5) _GDIPlus_Startup() Local $aResult, $hFont, $i=0 ,$iLen = StringLen($sString),$tLayout Local $hGfx = _GDIPlus_GraphicsCreateFromHWND(WinGetHandle(AutoItWinGetTitle())) Local $tRectF = DllStructCreate($tagGDIPRECTF) Local $hFormat = _GDIPlus_StringFormatCreate() Local $hFont = _GDIPlus_FontCreate( _GDIPlus_FontFamilyCreate($sFont), $fFontsize, 0) Do $tLayout = _GDIPlus_RectFCreate(0, 0, $i, 0) $aResult = DllCall($ghGDIPDll, "int", "GdipMeasureString", _ "handle", $hGfx, _ "wstr", $sString, _ "int", $iLen, _ "handle", $hFont, _ "struct*", $tLayout, _ "handle", $hFormat, _ "struct*", $tRectF, _ "int*", 0, _ "int*", 0) If $aResult[8] >= $iLen Then ExitLoop $i += 1 Until False _GDIPlus_FontDispose($hFont) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_GraphicsDispose($hGfx) $tLayout = 0 Local $sReturn[2]=[DllStructGetData($aResult[7],'Width'),DllStructGetData($aResult[7],'Height')] _GDIPlus_Shutdown() Return $sReturn EndFunc The rectangle having the exact text in it(nor more nor less space) has been colored pink Hope this helps Regards Phoenix XL1 point -
GUICtrlCreateLabel or GUICtrlSetData: Word wrap even with no white spaces?
abaddon7734 reacted to Roman for a topic
Hi abaddon7734 Thanks, but now try this: #include <Constants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> GUICreate("Window size: 300x300", 300, 300) GUISetState() GUICtrlCreateLabel("Label with width more than window: 500", 20, 20, 250) GUICtrlSetFont(-1, 8.5, 600) GUICtrlCreateLabel("", 20, 40, 500, 400) GUICtrlSetData(-1, "C:Documents and SettingsusernameApplication DataNokiaPCSyncSynchDataBackups1232012") GUICtrlCreateLabel("Label with small width less than window: 260", 20, 100, 260) GUICtrlSetFont(-1, 8.5, 600) GUICtrlCreateLabel("", 20, 120, 260, 500) GUICtrlSetData(-1, "C:Documents_and_SettingsusernameApplication_DataNokiaPCSyncSynchDataBackups1232012") GUICtrlCreateLabel('Label with manual line feed "@LF" ', 20, 180, 250) GUICtrlSetFont(-1, 8.5, 600) GUICtrlCreateLabel("", 20, 200, 500, 500) GUICtrlSetData(-1, "C:Documents and Settingsusername" & @LF & "Application DataNokiaPCSync" & @LF & "SynchDataBackups1232012") While 1 $msg=GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd No wrap fit in the second example. Manually inserting @LF is no option. Cheers.1 point -
THAT1ANONYMOUSEDUDE, Programming in Assembly language is overkill for anything other than code in need of major optimization. You should really stick to C or C++. Compilers are getting very good at optimizing code, and it'd be a waste to learn the obscure assembly instruction set yourself unless you really need to. From what I can tell, most people on these forums haven't written programs in pure Assembly, but rather have dabbled in it lightly, or taken compiled C/C++ code and massaged it slightly to be executable in memory. My programming roots stretch back to around 90-91 when code was in dire need of optimization in a long-since dead DOS 16-bit world. Even then, I only wrote a handful of pure-Assembly projects (mostly TSR programs) - the rest were a mix of C++ and Assembly. You'll find the difficult task of learning Assembly made even more complex by the new 64-bit assembly model and all the quirks involved with that. Also, no inline assembler supports 64-bit code yet as far as I know. However, if you are still interested in it (and I only recommend it for optimization), here's some links: Intel 64 and IA-32 Architectures Software Developer Manuals AMD Developer Guides and Manuals Flat Assembler (FASM) Documentation The Netwide Assembler (NASM) Documentation Iczelion's Win32 Assembly Tutorials X86asm.net and their X86 Opcode and Instruction Reference Sandpile.org Borland Turbo Assembler Manuals (these were my bibles back in the day) There's also plenty of links on 64-bit programming quirks out there. I believe I left a few of these on someone's thread somewhere on these forums.. Good luck (but really - stick to C/C++!)1 point