AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Graphic Buttons
Goto page Previous  1, 2, 3, 4, 5, 6
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
garry



Joined: 19 Apr 2005
Posts: 1184
Location: switzerland

PostPosted: Fri Aug 15, 2008 10:23 am    Post subject: Reply with quote

sorry Phischi, I didn't tried the program, you're waiting yet for answer ....
Back to top
View user's profile Send private message
ManualLukeWarmkey



Joined: 01 Aug 2008
Posts: 3

PostPosted: Sat Aug 23, 2008 2:28 am    Post subject: Reply with quote

These graphical buttons look great in the demo, but when I tried to do a 16x16 icon it couldn't seem to leave it alone and insists on resizing it to not fit in button.

Finally, using an icon editor, I copied my 16x16 icon image into a 32x32 icon leaving tons of empty space around it. I saved the icon and added it to my compiled ahk script with Resource Hacker.

It now looks the way I expect it to except the dotted line square inside the button when it has focus.

How can I change the icons in a compiled autohotkey script from the command line so I don't have to click around in Resource hacker after every time I recompile a script?
Back to top
View user's profile Send private message
corrupt



Joined: 29 Dec 2004
Posts: 2436

PostPosted: Sun Nov 23, 2008 7:55 pm    Post subject: Reply with quote

ManualLukeWarmkey wrote:
How can I change the icons in a compiled autohotkey script from the command line so I don't have to click around in Resource hacker after every time I recompile a script?
I currently add the images to the dll file (in the first post) instead of messing around with adding/changing resources in a compiled script each time a script is compiled/updated. The dll also includes the function(s) necessary for loading the image(s).

Last edited by corrupt on Sun Nov 23, 2008 8:48 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
corrupt



Joined: 29 Dec 2004
Posts: 2436

PostPosted: Sun Nov 23, 2008 8:30 pm    Post subject: Reply with quote

Phischi wrote:
This button should not have any text in it, but Icon 166 from SYSTEM32.DLL
That could be difficult since SYSTEM32.DLL doesn't typically exist... Wink

Does this example help? If not, please try to clarify. Sorry for the delayed response (if you're still around to read this...).



Code:
; ********************************
; Demo Script
; ********************************

; Load an icon instead for SampleButton2
AGB_LoadIconDll(sb1, "shell32.dll", 166)

; Create the buttons
AddGraphicButton("SampleButton1", sb1, "h36 w36 gMyButton")

; Show the window
Gui, Show, , Bitmap Buttons

; Image rollover for SampleButton1
 OnMessage(0x200, "MouseMove")
 OnMessage(0x2A3, "MouseLeave")
 OnMessage(0x202, "MouseLeave") ; Restore image on LBUTTONUP
Return

MouseLeave(wParam, lParam, msg, hwnd)
{
  Global
;   If (hwnd = SampleButton1_hwnd)
;     Do something
  Return
}
MouseMove(wParam, lParam, msg, hwnd)
{
  Global
  Static _LastButtonData1 = true

;  If (hwnd = SampleButton1_hwnd)
;    If (_LastButtonData1 != SampleButton1_hwnd)
      ; do something
;   _LastButtonData1 := hwnd

  Return
}

MyButton:
MsgBox, Graphic button clicked :)
return

GuiClose:
ExitApp


; from the library file AGB.ahk (included in the zip file in the download)

; *******************************************************************
; Preload icons from a dll for use with the AddGraphicButton() function
; Version: 2.21 Updated: June 22, 2008
; by corrupt
; *******************************************************************
; VariableName = variable name for the loaded image resource
; dllfile = Path to the dll file that contains the image(s)
; nindex = the index of the icon to load
; *******************************************************************
AGB_LoadIconDll(ByRef VariableName, dllfile, nindex) {
Global
Local spid
spid := DllCall("GetCurrentProcessId")
If (%VariableName%_img != "")
  DllCall("DeleteObject", "UInt", %VariableName%_img)
VariableName := "1." . DllCall("shell32.dll\ExtractIconA", "UInt", spid, "Str", dllfile, "UInt", nindex)
Return ErrorLevel
}
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3, 4, 5, 6
Page 6 of 6

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group