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: 1557
Location: switzerland

PostPosted: Fri Aug 15, 2008 11: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: 4

PostPosted: Sat Aug 23, 2008 3: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: 2446

PostPosted: Sun Nov 23, 2008 8: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 9: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: 2446

PostPosted: Sun Nov 23, 2008 9: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
JASON031



Joined: 15 May 2009
Posts: 4

PostPosted: Wed Jul 01, 2009 6:57 pm    Post subject: Reply with quote

I'm a little confused. I have downloaded/copied corrupt's scripts and everytime it gives me this error. I'm still kinda new at this so any help would be appreciated.

Error at line 30.

Line Text: =
Error: this variable of function name contains an illegal character.

The program will exit.


This is line 30:
Static _LastButtonData1 = true
Back to top
View user's profile Send private message
corrupt



Joined: 29 Dec 2004
Posts: 2446

PostPosted: Mon Jul 20, 2009 2:03 pm    Post subject: Reply with quote

JASON031 wrote:
I'm a little confused. I have downloaded/copied corrupt's scripts and everytime it gives me this error. I'm still kinda new at this so any help would be appreciated.

Error at line 30.

Line Text: =
Error: this variable of function name contains an illegal character.

The program will exit.


This is line 30:
Static _LastButtonData1 = true
Which version of AutoHotkey and version of Windows are you running?
Back to top
View user's profile Send private message Visit poster's website
JASON031



Joined: 15 May 2009
Posts: 4

PostPosted: Mon Jul 20, 2009 8:49 pm    Post subject: Reply with quote

AutoHotKey Version 1.0.37.04

Microsoft Windows XP Professional 2002 Service Pack 2
Back to top
View user's profile Send private message
corrupt



Joined: 29 Dec 2004
Posts: 2446

PostPosted: Sun Jul 26, 2009 5:12 am    Post subject: Reply with quote

JASON031, Could you please provide a bit more detail? I'm not currently able to reproduce this error, however, I have not attempted to install AutoHotKey Version 1.0.37.04 and XP SP2. Do you still have this issue if you update to the latest version of AutoHotkey? Are you trying to use the test script(s) "as is" or have you changed the function and/or file names? Have you copied the script from the forum using the "Copy" function in the code box? If so, then do you get the same results if you highlight the text, then copy and paste instead?
Back to top
View user's profile Send private message Visit poster's website
do not know
Guest





PostPosted: Tue Jan 05, 2010 6:33 pm    Post subject: Reply with quote

Quote:
added support for image types: .bmp, .gif, .jpg, .wmf, .emf, .ico when loaded from a custom dll file


also png files from dll?
Back to top
do not know.
Guest





PostPosted: Tue Jan 05, 2010 7:01 pm    Post subject: Reply with quote

i laoded the newest arhive but he gives me in each script errors. whatz up?
Back to top
garry



Joined: 19 Apr 2005
Posts: 1557
Location: switzerland

PostPosted: Fri Jan 15, 2010 9:31 am    Post subject: Reply with quote

added just an example from denick
Code:
;-------- saved at Freitag, 15. Januar 2010 08:55:21 ----------------
;-------- http://de.autohotkey.com/forum/topic6105-15.html denick ---
;-------- http://www.autohotkey.com/forum/topic4047.html  ---
;-------- TAG= COLOR BUTTONS GRAPHIC ------------------------
;-------- DATE=20100115 -------------------------------------
#NoEnv
SetWorkingDir, %A_ScriptDir%
NAME=Test

PB1C := "Red"        ; Backgroundcolor "Button1"
PB2C := "Lime"       ; Backgroundcolor "Button2"
;PB3C := "Black"      ; Backgroundcolor "Button3"   ; example with picture

TX1C := "Yellow"     ; TextColor "Button1"
Tx2C := "000040"     ; TextColor "Button2"
Tx3C := "White"      ; TextColor "Button3"

;Gui, 2:-Theme
Gui, 2:Margin, 10, 10

Gui, 2:Add, Progress, x10 y10 h25 w90 Disabled vPB1 +E0x1 Background%PB1C%
Gui, 2:Add, Text, xp yp wp hp c%TX1C% BackgroundTrans Center 0x200 vTX1 gPrinter1, ----Printer----

Gui, 2:Add, Progress, x110 y10 h25 w90 Disabled vPB2 +E0x1 Background%PB2C%
Gui, 2:Add, Text, xp yp wp hp c%TX2C% BackgroundTrans Center 0x200 vTX2 gSNDVOL,VOLUME

;----- this 3rd example needs a small red picture or just a picture-----------
Gui,2:Add,Picture,x210 y10  h25 w90 gCALC,red.bmp
;Gui,2:Add,text,cWhite BackgroundTrans x240 y15 h25 w90 ,CALC
Gui, 2:Add, Text, xp yp wp hp c%TX3C% BackgroundTrans Center 0x200 ,CALC

Gui, 2:Show, x200 y0, %NAME%
Return

2Guiclose:
ExitApp

PRINTER1:
 run,shell:PrintersFolder
Return

SNDVOL:
 run,sndvol32
Return

CALC:
 run,calc
return
Back to top
View user's profile Send private message
WankaUSR



Joined: 14 Aug 2007
Posts: 86

PostPosted: Wed Feb 03, 2010 7:15 pm    Post subject: Reply with quote

is it possible to use an image storred in memory from skan's AxC_UnPackToMem??
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