nacerbaaziz

how to add a ico file to the compiled autoit file and use it in GUICtrlCreateIcon

17 posts in this topic

#1 ·  Posted

Hi guys
I have an inquiry please
I want an example of how to add an icon file to the compiled autoit file and how to use it in GUICtrlCreateIcon

Preferably in a separate list within the resourceFor example myIcons
I hope my request is clear and I hope you will help me solve this problem
Because I found an example in the help files but I did not understand the method well

Share this post


Link to post
Share on other sites



#2 ·  Posted

I have tried the ResourcesEx.au3 file
It succeeded but the problem is that the icons are set in rt_icon
I want them to be in a completely independent list of major icons

Share this post


Link to post
Share on other sites

#3 ·  Posted

this is the resources udf file

resources udf

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

To use custom icon on compiled exe, from scite with target script open, press Ctrl + F7 to open compile options.  Roughly the fifth option down is Icon.  Use the ... (browse) button and navigate to the .ico file.  Then press compile, the resulting exe will have the specified icon.  I am also pretty sure all the GUIs will have the specified icon instead of the default AutoIt icon after the compile.

Edited by Xandy

I am not a lawyer.  (-_-) Xandy About  (^o^) Discord - Xandy Programmer

Share this post


Link to post
Share on other sites

#6 ·  Posted

I want to use the icon that was added in GUICtrlCreateIcon
Does this work?

Share this post


Link to post
Share on other sites

#8 ·  Posted

 

Put this at the top of your source code - these are the parameters that are written if you follow the post that Xandy wrote.

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=YourIconFile.ico
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

Is this what you wanted?

Share this post


Link to post
Share on other sites

#9 ·  Posted

No unfortunately
I need to add a multiple icons to the  exe file and use it in a GUI like GUICreateIcon
Greetings and sorry for the late reply

Share this post


Link to post
Share on other sites

#11 ·  Posted

Dear,
for example, I found this code
#AutoIt3Wrapper_Res_File_Add=icons\volume+.ico, playerIcons, up, 0
I want to use it to create the icon in the GUI
e.g :
GUICtrlCreateIcon()
I hope this is clear

Share this post


Link to post
Share on other sites

#13 ·  Posted

Fine, so what is the problem with that? 
Do you have the Full version of SciTE4AutoIt3 installed?
If so then open the SciTE4AutoIt3 helpfile and find the example for #AutoIt3Wrapper_Res_Icon_Add under AutoIt3Wrapper to get you going.

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#14 ·  Posted

@Jos
Why does not AutoIT have the full version (AutoIT and SciTE4AutoIT Full) for the installer?
I think it would be a good idea!


Regards,
 

Share this post


Link to post
Share on other sites

#15 ·  Posted

That was on request of Jon at the time this project was started by me. I created the LITE version for inclusion in the standard AutoIt3 installer, which is a 2 file installation to keep things simple. We also wanted to leave it up to the scripter to choose their preferred Editor themselves.

Jos 


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#16 ·  Posted

Although it is possible to change your favorite editor with just a few clicks :)
I hope AutoIT soon has the full version and the same lite is released!
Thanks to the Jon, Jos and AutoIT team.


Regards,
 

Share this post


Link to post
Share on other sites

#17 ·  Posted

i want to use the ResourcesEx.au3

but i want to add the icons to player not in RT_ICON

i don't know how to do that using the ResourcesEx.au3

can i do that?

I tried a lot and no icons appear on the screen

but if i use the RT_ICON all thank is work

i need your suggestions

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

  • Similar Content

    • GordonFreeman
      By GordonFreeman
      Hi, i searched some topics but cannot found a simple way to do that:
      #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 615, 438, 192, 124) GUISetState(@SW_SHOW) ; I tried this but user reported that it work in 2006, not seems work actually $filemenu = GUICtrlCreateMenu ("&File") $fileitem = GUICtrlCreateMenuitem ("Open",$filemenu) GuiCtrlSetImage($fileitem, "shell32.dll", 4) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Also tried:
      #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 615, 438, 192, 124) GUISetState(@SW_SHOW) $filemenu = TrayCreateMenu("&File") $fileitem = TrayCreateItem("Open",$filemenu) ;GuiCtrlSetImage($fileitem, "shell32.dll", 4) ;GuiCtrlSetImage(TrayItemGetHandle($fileitem), "shell32.dll", 4) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Well.. thanks in advance!
       
      Ok. I found this working example from Yashied. If i cannot find a simple then i will go with it
      #Include <GUIConstantsEx.au3> #Include <GUIMenu.au3> #Include <Constants.au3> #Include <WinAPI.au3> #Include <WindowsConstants.au3> Opt('MustDeclareVars', 1) Global $hMenu, $hForm, $hFile = 1000, $idNew, $idExit $hForm = GUICreate('Menu', 400, 300) $hFile = _GUICtrlMenu_CreateMenu() _GUICtrlMenu_InsertMenuItem ($hFile, 0, ' &Favorites', $idNew) _GUICtrlMenu_InsertMenuItem ($hFile, 1, '', 0) _GUICtrlMenu_InsertMenuItem($hFile, 2, ' E&xit', $idExit) $hMenu = _GUICtrlMenu_CreateMenu() _GUICtrlMenu_InsertMenuItem($hMenu, 0, '&File', 0, $hFile) _GUICtrlMenu_SetMenu($hForm, $hMenu) _GUICtrlMenu_SetItemBmp($hFile, 0, _CreateBitmapFromIcon(_WinAPI_GetSysColor($COLOR_MENU), @SystemDir & '\shell32.dll', 43, 16, 16)) _GUICtrlMenu_SetItemBmp($hFile, 2, _CreateBitmapFromIcon(_WinAPI_GetSysColor($COLOR_MENU), @SystemDir & '\shell32.dll', 27, 16, 16)) GUISetState() Do Until GUIGetMsg() = $GUI_EVENT_CLOSE Func _CreateBitmapFromIcon($iBackground, $sIcon, $iIndex, $iWidth, $iHeight) Local $hDC, $hBackDC, $hBackSv, $hIcon, $hBitmap $hDC = _WinAPI_GetDC(0) $hBackDC = _WinAPI_CreateCompatibleDC($hDC) $hBitmap = _WinAPI_CreateSolidBitmap(0, $iBackground, $iWidth, $iHeight) $hBackSv = _WinAPI_SelectObject($hBackDC, $hBitmap) $hIcon = _WinAPI_PrivateExtractIcon($sIcon, $iIndex, $iWidth, $iHeight) If Not @error Then _WinAPI_DrawIconEx($hBackDC, 0, 0, $hIcon, 0, 0, 0, 0, $DI_NORMAL) _WinAPI_DestroyIcon($hIcon) EndIf _WinAPI_SelectObject($hBackDC, $hBackSv) _WinAPI_ReleaseDC(0, $hDC) _WinAPI_DeleteDC($hBackDC) Return $hBitmap EndFunc ;==>_CreateBitmapFromIcon Func _WinAPI_PrivateExtractIcon($sIcon, $iIndex, $iWidth, $iHeight) Local $hIcon, $tIcon = DllStructCreate('hwnd'), $tID = DllStructCreate('hwnd') Local $Ret = DllCall('user32.dll', 'int', 'PrivateExtractIcons', 'str', $sIcon, 'int', $iIndex, 'int', $iWidth, 'int', $iHeight, 'ptr', DllStructGetPtr($tIcon), 'ptr', DllStructGetPtr($tID), 'int', 1, 'int', 0) If (@error) Or ($Ret[0] = 0) Then Return SetError(1, 0, 0) EndIf $hIcon = DllStructGetData($tIcon, 1) If ($hIcon = Ptr(0)) Or (Not IsPtr($hIcon)) Then Return SetError(1, 0, 0) EndIf Return $hIcon EndFunc ;==>_WinAPI_PrivateExtractIcon Ok, i noticed that is a pain create submenu with _GUICtrlMenu_CreatePopup to do like in Tray, and Tray better located, then i need images/icon with Tray functions, some workaround?? 
    • FrancescoDiMuro
      By FrancescoDiMuro
      Good morning
      I'm working on a little project, and I was wondering if there's a way ( sure there is ) to insert data to a ComboBox control everytime the user insert some text in the ComboBox which is not in the ComboBox data. I'll try to explain with an example:
      - Form with some data ( ComboBox is empty );
      - User prompt something in the ComboBox: if what the user prompts is not in the ComboBox values ( at the moment empty ), then insert the value in the ComboBox values, in order to have, next time the user prompts the form, the value that he entered.
      More pratical example:
      - First call of the form, ComboBox empty;
      - I prompt "A" in the ComboBox;
      - Second call, in the ComboBox I should see "A";
      - I prompt "B" in the ComboBox;
      - Third call, I should see "A"
                                                 "B";
      - And so on...
      Everytime the form is called, I re-create it, so I think I can't use _GUICtrlComboBox_AddStrings().
      I tried with
      Global $strCboStrings = "" ; When the user prompt the form, the code below is executed. ; I.E. : User prompt "A", after the if I should have "A"; ; In the second call, If I write "B", I should see "A" ; "B"; ; If I write "A" again, in the combobox values should not be any changes. If Not StringInStr($strCboStrings, GUICtrlRead($cboVoiceCategory)) <> 0 Then $strCboStrings &= $strCboStrings & "|" & GUICtrlRead($cboVoiceCategory) EndIf Any suggestion?
      Thanks
    • WoodGrain
      By WoodGrain
      Hi All,
      I'm using UseTraySetIcon("shell32.dll", xx) to set my tray icon to a specific icon while running, is there a way I can specify this icon when I compile my script into an exe so my exe icon is the same?
      Thanks!
    • nacerbaaziz
      By nacerbaaziz
      Hello my friends
      I have an urgent problem and we hope you can help me
      I want to detect if the audio output of the device has changed
      Such as the headset is connected or disConnected.
      or change the default audio output
      Is this possible?
      I really searched a lot and found suggestions but unfortunately I did not understand them
      Please explain to me
      Greetings