GEOSoft Posted June 30, 2004 Posted June 30, 2004 It would be really nice if we could give an icon a button styleor use an icon on the button face instead of text. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!"
Developers Jos Posted June 30, 2004 Developers Posted June 30, 2004 Why not reverse it and use an picture "as button" and use it's click event ? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
GEOSoft Posted June 30, 2004 Author Posted June 30, 2004 It's trying to get the Pic to look like a button as in a toolbar button. Secondly if I could use an icon then I could include an icon library and call them from there. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!"
Holger Posted June 30, 2004 Posted June 30, 2004 At the moment I try to change the GUISetControl-function for the "button", so if you use the "BS_ICON"-style then instead of the text it will be used to define the iconlocation and index (like the icon-GUISetControl): For instance it could be like: ... $BS_ICON = 0x00000040 $BS_BITMAP = 0x00000080 ... $buttonok = GUISetControl("button","OK",50,50,70,20); normal 'text'-button $buttonchoosefolder = GUISetControl("button","shell32.dll|150",50,100,70,30,$BS_ICON) We will see if it works Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView
Holger Posted June 30, 2004 Posted June 30, 2004 (edited) So this is how it looks at the moment:This script:$BS_ICON = 0x00000040 $BS_BITMAP = 0x00000080 GUICreate("test",240,120) $button1 = GUISetControl("button","shell32.dll|5",0,0,40,40,$BS_ICON) $button2 = GUISetControl("button","shell32.dll|7",40,00,40,40,$BS_ICON) $button3 = GUISetControl("button","shell32.dll|22",80,00,40,40,$BS_ICON) $button4 = GUISetControl("button","shell32.dll|23",120,0,40,40,$BS_ICON) $button5 = GUISetControl("button","shell32.dll|32",160,0,40,40,$BS_ICON) $buttonclose = GUISetControl("button","shell32.dll|28",200,0,40,40,$BS_ICON) $buttonok = GUISetControl("button","OK",90,80,70,20) GUIShow() GUIWaitClose() GUIDelete() Exitwould bring up (XP):http://www.autoitscript.com/fileman/users/public/Holger/buttonswithicon.jpgMaybe I find a way to load bitmap resources index pictures, you know, like in Explorer or Winzip,etc... Edited June 30, 2004 by Holger Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView
Doxie Posted June 30, 2004 Posted June 30, 2004 Were can i find the buttons like that? Would you mind to zip and post them here? Were ever i lay my script is my home...
Holger Posted June 30, 2004 Posted June 30, 2004 @Doxie: what do you mean? the buttons/icons are in the shell32.dll from XP And the other is still in developement you know Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView
CyberSlug Posted June 30, 2004 Posted June 30, 2004 @Holger: Are you saying that you are working on a way to let us use icons/bitmaps on button controls? If yes, then Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Doxie Posted June 30, 2004 Posted June 30, 2004 How did you get that to work?I only get this and i'm using XP aswell. Were ever i lay my script is my home...
Holger Posted June 30, 2004 Posted June 30, 2004 @Doxie: you did misunderstand me I'm still working on it...at this moment Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView
Doxie Posted June 30, 2004 Posted June 30, 2004 Do you know if there is a register of all icons in winshell? If so, were can i find it? Were ever i lay my script is my home...
Holger Posted June 30, 2004 Posted June 30, 2004 (edited) @Doxie: ohhh, I don't really know what you mean I'm a programming-beginner you know However, at the moment it would look like:http://www.autoitscript.com/fileman/users/public/Holger/buttonscurrent.jpgSo cause I didn't know how to split the functions I changed the current "CreateButton" to that:expandcollapse popup//////////////////////////////////////////////////////////////////////////////////////////////// // // CreateBUTTON() // //////////////////////////////////////////////////////////////////////////////////////////////// HWND CGuiBox::CreateBUTTON(const char* Text, HWND hWnd, int id, int X, int Y, int W, int H, int Style, int Exstyle) { HWND A; bool bDefault = false; HICON hIcon; char szBuffer[_MAX_PATH+1]; const char *szDelim, *szToken; int nTemp; HINSTANCE hInstance=NULL; HBITMAP hBitmap; if (Style == -1) Style = 0; Style = ResolveGroupStyle(Style | WS_TABSTOP | BS_PUSHBUTTON | BS_NOTIFY); // If the default button style is requested make a note of it and remove it (we will set it later). if (Style & BS_DEFPUSHBUTTON) { bDefault = true; Style ^= BS_DEFPUSHBUTTON; } if ( Exstyle==-1 ) Exstyle=WS_EX_WINDOWEDGE; A = _CreateControl(Exstyle, "button", Text, Style, X, Y, W, H, hWnd, id, m_hInstance, NULL, true); if (Style & BS_ICON) { if ( (szDelim = strpbrk(Text, "|")) != NULL) { nTemp = (int)(szDelim-Text); strncpy(szBuffer, Text, nTemp); szBuffer[nTemp] = '\0'; nTemp = atoi(szDelim+1); nTemp = nTemp - 1; if (nTemp==-1) nTemp = 0; szToken = szBuffer; hIcon=(HICON) ExtractIcon(hInstance,szToken,nTemp); SendMessage(A,(UINT)BM_SETIMAGE,(WPARAM)IMAGE_ICON,(LPARAM)hIcon); } else { hBitmap=(HBITMAP) LoadImage(0,Text,IMAGE_ICON,0,0,LR_LOADFROMFILE|LR_CREATEDIBSECTION); SendMessage(A,(UINT)BM_SETIMAGE,(WPARAM)IMAGE_ICON,(LPARAM)hBitmap); } } if (Style & BS_BITMAP) { hBitmap=(HBITMAP) LoadImage(0,Text,IMAGE_BITMAP,0,0,LR_LOADFROMFILE|LR_CREATEDIBSECTION); SendMessage(A,(UINT)BM_SETIMAGE,(WPARAM)IMAGE_BITMAP,(LPARAM)hBitmap); } // If the Default button style was specified then set it as the default button now that it // has been created if (bDefault) SendMessage(m_hWndGUI, DM_SETDEFID, id, 0); if (m_nGUIResizeMode == 0) GUICtrl[m_nMaxCtrl].nSizeable = GUI_SZ_DOCKWIDTH | GUI_SZ_DOCKHEIGHT; return A; } // CreateBUTTON()and that was the sample-au3 (don't forget that these pics and so on on my local hd).$BS_ICON = 0x00000040 $BS_BITMAP = 0x00000080 GUICreate("test",240,180) $button1 = GUISetControl("button","shell32.dll|5",0,0,40,40,$BS_ICON) $button2 = GUISetControl("button","shell32.dll|7",40,00,40,40,$BS_ICON) $button3 = GUISetControl("button","shell32.dll|22",80,00,40,40,$BS_ICON) $button4 = GUISetControl("button","shell32.dll|23",120,0,40,40,$BS_ICON) $button5 = GUISetControl("button","shell32.dll|32",160,0,40,40,$BS_ICON) $buttonclose = GUISetControl("button","shell32.dll|28",200,0,40,40,$BS_ICON) $buttonok = GUISetControl("button","OK",85,60,70,20) $buttonani = GUISetControl("button",@ScriptDir & "\horse.ani",0,40,40,40,$BS_ICON) $buttonpic = GUISetControl("button",@ScriptDir & "\setup.bmp",25,100,50,50,$BS_BITMAP + $BS_FLAT) $buttonpic = GUISetControl("button",@ScriptDir & "\share.bmp",95,100,50,50,$BS_BITMAP + $BS_DEFPUSHBUTTON) $buttonpic = GUISetControl("button",@ScriptDir & "\sync.bmp",165,100,50,50,$BS_BITMAP) GUIShow() GUIWaitClose() GUIDelete() ExitWithout any garanties No...no problem, I tested it , but maybe there are errors or it could be easier to realize... FORGET: the 'horse.ani' doesn't move (if you think about it) Edited June 30, 2004 by Holger Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView
Doxie Posted June 30, 2004 Posted June 30, 2004 I have made some googling, and are now pretty sure this will not work at the moment. In some way, you need to call the windows API, and the only way i found so far is by using delphi, C or VB. I don´t think AutoIt support that. But i'm not that good with this, so i leave it to the pro´s Were ever i lay my script is my home...
CyberSlug Posted June 30, 2004 Posted June 30, 2004 (edited) @Doxie: Here's one way to view all the icons in shell32.dll on Windows 2000/XP without using a third-party program.1) Pick some shortcut that's on your Desktop or start menu.2) Right-click it, choose Properties, click the Change Icon button.3) Press Delete, Enter.4) You should see a bunch of icons in shell32.dll The icons are indexed starting top-to-bottom, left-to-right starting with index 0.5) Click Cancel, Cancel when done viewing.If anyone is looking for a really cool set of XP Icons, look here Edited June 30, 2004 by CyberSlug Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
CyberSlug Posted July 1, 2004 Posted July 1, 2004 For fun, here's a scripted version of the process in my previous post: expandcollapse popup;View icons in DLL file without third-party appliction ;CyberSlug - 30 June 2004 - tested on Windows XP Pro sp1 Opt("WinTitleMatchMode", 4) ;1=start, 2=subStr, 3=exact, 4=... Opt("WinWaitDelay", 50) ;50 milliseconds FileCreateShortcut("","C:\tmpIconScript.lnk") Run("explorer.exe /n,/select,C:\tmpIconScript.lnk") WinWaitActive("classname=CabinetWClass") Send("{AppsKey}r") WinClose("classname=CabinetWClass") WinWaitActive("tmpIconScript Properties") ControlClick("tmpIconScript Properties","","&Change Icon...") WinSetState("tmpIconScript Properties","", @SW_HIDE) WinWaitActive("Change Icon") WinSetTitle("Change Icon","","Icon Viewer") ControlHide("Icon Viewer","","OK") $pos = WinGetPos("Icon Viewer") WinMove("Icon Viewer","", 100,100 ,400+$pos[2],$pos[3]) $pos = ControlGetPos("Icon Viewer","","ListBox1") ControlMove("Icon Viewer","","ListBox1", $pos[0],$pos[1], 400+$pos[2],$pos[3]) ControlSend("Icon Viewer","","Edit1","{Delete}{Enter}") #cs -- Anyone know how to get the item index instead of the item "text" ? $sel = "" While WinExists("Icon Viewer") sleep(100) If ControlCommand("Icon Viewer","", "ListBox1","GetCurrentSelection","") <> $sel Then $sel = ControlCommand("Icon Viewer","", "ListBox1","GetCurrentSelection","") WinSetTitle("Icon Viewer","","Icon Viewer: " & $sel) EndIf WEnd #ce FileDelete("C:\tmpIconScript.lnk") Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
cowsmanaut Posted July 1, 2004 Posted July 1, 2004 so that is an add on then Holger? It looks like more C++ code. do we need to wait for it to be included by Jon? or is it something we should be using some GnuC++ compiler co complile into a command.. and if so where would it need to go? are there specific .h files and so on that we would need? I thought we could already use images as buttons.. I've not tried it yet.. but it seems to me Larry suggested it to someone else a few weeks ago in annother thread.. moo
Holger Posted July 1, 2004 Posted July 1, 2004 @cowsmanaut: I can work it only at home, but sometimes I'm so late at home after work that I don't have time. I will try to send the changes to Jon. I have to change the html-files and make a change-text-file and so on. Maybe I find the time today in the evening...we will see... cause I'm making that for fun and have a 'privat life' you know Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView
Holger Posted July 1, 2004 Posted July 1, 2004 So, I send Jon the code-submission, maybe it's possible to integrate that...we will see Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView
Administrators Jon Posted July 2, 2004 Administrators Posted July 2, 2004 Maybe I find the time today in the evening...we will see... cause I'm making that for fun and have a 'privat life' you know Tell me about it. My girlfriend has got me tied up pretty much every night at the moment Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/
cowsmanaut Posted July 2, 2004 Posted July 2, 2004 tied up.. hmmm sounds kinky (heh.. sorry couldn't resist) unless you are serious moo
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