LeHuynhNam Posted December 7, 2008 Share Posted December 7, 2008 (edited) I have a button and i want when i click it, it will appear this dialog like this:And when i choose an icon, it will show the URL of this Icon with Icon Index such as "C:\windows\system32\SHELL32.dll,13"How can i code it? Edited December 7, 2008 by LeHuynhNam Link to comment Share on other sites More sharing options...
BigDod Posted December 7, 2008 Share Posted December 7, 2008 If you had used search you would have found This Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
LeHuynhNam Posted December 7, 2008 Author Share Posted December 7, 2008 (edited) If you had used search you would have found ThisThank you! I've lost this example for a long time! I'll search carefully before i post!but in this topic, i mean i can directly call external DLL and Windows API functions with autoits and it will appear this dialog which is default of windows XP! How can i call and use it? Edited December 7, 2008 by LeHuynhNam Link to comment Share on other sites More sharing options...
ProgAndy Posted December 7, 2008 Share Posted December 7, 2008 Theres a func in post #10 in the same thread *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
LeHuynhNam Posted December 8, 2008 Author Share Posted December 8, 2008 Theres a func in post #10 in the same thread I did with this guide but when i click cancel button of this dialog it stopped running and exit code! How can i resolve it? Link to comment Share on other sites More sharing options...
DeeRiee Posted December 8, 2008 Share Posted December 8, 2008 I did with this guide but when i click cancel button of this dialog it stopped running and exit code! How can i resolve it? You can add this If Not @error Then <your code here> else <Your code here> So The script like this expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 263, 181, 211, 202) $Button1 = GUICtrlCreateButton("Select Icon", 72, 24, 97, 25, 0) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $Button1 $aRet =_PickIconDlg(@SystemDir & "\shell32.dll", 8, WinGetHandle("")) If Not @error Then MsgBox(64, "Results", StringFormat("IconFile Selected: %s\nIconID Selected: %i", $aRet[0], $aRet[1])) GUICtrlCreateIcon($aRet[0],($aRet[1]+1)*(-1), 122, 52) GUICtrlSetImage(-1,$aRet[0],($aRet[1]+1)*(-1)) Else MsgBox(64, "Error", "Please Select an Icon!") EndIf case $msg = $GUI_EVENT_CLOSE Exit EndSelect WEnd Func _PickIconDlg($sFileName, $nIconIndex=0, $hWnd=0) Local $nRet, $aRetArr[2] $nRet = DllCall("shell32.dll", "int", "PickIconDlg", _ "hwnd", $hWnd, _ "wstr", $sFileName, "int", 1000, "int*", $nIconIndex) If Not $nRet[0] Then Return SetError(1, 0, -1) $aRetArr[0] = $nRet[2] $aRetArr[1] = $nRet[4] Return $aRetArr EndFunc Good luck Link to comment Share on other sites More sharing options...
LeHuynhNam Posted December 8, 2008 Author Share Posted December 8, 2008 You can add this If Not @error Then <your code here> else <Your code here> So The script like this expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 263, 181, 211, 202) $Button1 = GUICtrlCreateButton("Select Icon", 72, 24, 97, 25, 0) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $Button1 $aRet =_PickIconDlg(@SystemDir & "\shell32.dll", 8, WinGetHandle("")) If Not @error Then MsgBox(64, "Results", StringFormat("IconFile Selected: %s\nIconID Selected: %i", $aRet[0], $aRet[1])) GUICtrlCreateIcon($aRet[0],($aRet[1]+1)*(-1), 122, 52) GUICtrlSetImage(-1,$aRet[0],($aRet[1]+1)*(-1)) Else MsgBox(64, "Error", "Please Select an Icon!") EndIf case $msg = $GUI_EVENT_CLOSE Exit EndSelect WEnd Func _PickIconDlg($sFileName, $nIconIndex=0, $hWnd=0) Local $nRet, $aRetArr[2] $nRet = DllCall("shell32.dll", "int", "PickIconDlg", _ "hwnd", $hWnd, _ "wstr", $sFileName, "int", 1000, "int*", $nIconIndex) If Not $nRet[0] Then Return SetError(1, 0, -1) $aRetArr[0] = $nRet[2] $aRetArr[1] = $nRet[4] Return $aRetArr EndFunc Good luck Thanks for quick reply Link to comment Share on other sites More sharing options...
LeHuynhNam Posted December 8, 2008 Author Share Posted December 8, 2008 oh, i want to set the URL of this icon which i had choosen to the $input, what should i do? and i have this code: $input1 = GUICtrlCreateCombo ("", 288, 172, 57, 21,0x2042,-1) _GUICtrlComboBox_LimitText($input1,1) GUICtrlSetTip(-1, "Choose a drive you want to change icon") For $i = 1 To $odd[0] GUICtrlSetData ($input1, $odd[$i], $odd[1]) Next GUISetState () but it shows C: or D:.. I want it only show C or D, what should i do? Link to comment Share on other sites More sharing options...
DeeRiee Posted December 8, 2008 Share Posted December 8, 2008 oh, i want to set the URL of this icon which i had choosen to the $input, what should i do? and i have this code: $input1 = GUICtrlCreateCombo ("", 288, 172, 57, 21,0x2042,-1) _GUICtrlComboBox_LimitText($input1,1) GUICtrlSetTip(-1, "Choose a drive you want to change icon") For $i = 1 To $odd[0] GUICtrlSetData ($input1, $odd[$i], $odd[1]) Next GUISetState () but it shows C: or D:.. I want it only show C or D, what should i do? Use StringTrimRight() Example: $result = StringTrimRight("C:", 1) MsgBox(0, "result", $result) Link to comment Share on other sites More sharing options...
LeHuynhNam Posted December 10, 2008 Author Share Posted December 10, 2008 thank you so much! I also have question: Can I Change the Title of Icon picker Dialog! when i call this function it has "Change Icon" Title and i want to changed it what can i do? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now