AutoHotkey Community

It is currently May 27th, 2012, 2:37 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: February 16th, 2010, 9:33 am 
Offline

Joined: August 14th, 2007, 12:11 pm
Posts: 86
I have tried to create bitmap from extracted image in axc cab and use it with AddGraphicButton but whenever I launch the script in only loads 3-buttons from 7 I have in my gui. Can anyone help?
here is the script

Code:
skin=btns.axc
Gui +LastFound
resource_loader()

AddGraphicButton("updlist", btn1, "x11 y579 w90 h20 cEFEFEF", 20, 90)
AddGraphicButton("stopplay", btn2, "x116 y579 w90 h20 ", 20, 90)
AddGraphicButton("help", btn3, "x11 y609 w90 h20 ", 20, 90)
AddGraphicButton("exit", btn4, "x116 y609 w90 h20 ", 20, 90)
AddGraphicButton("update", btn6, "x26 y457 w160 h20 ", 20, 160)
AddGraphicButton("submit", btn5, "x116 y534 w70 h20", 20, 70)
AddGraphicButton("c",btn11, "x+4 y26 w22 h22", 22, 22)
Gui, Show,h640 w214
Return

bmp( ByRef BMP,hDC)
{
 hBMP := DllCall( "CreateDIBitmap", UInt,hDC, UInt,(bmiHAddr:=&BMP+14)
  ,UInt,(CBM_INIT:=4), UInt,&BMP+NumGet(BMP,10), UInt,&BMP+14, UInt,(DIB_PAL_COLORS:=1) )

 image:= "0." hBMP
 return, image
}

resource_loader()
{
global
GUI1:=WinExist(), hDC:=DllCall("GetDC",UInt,Gui1)
axc_extracttomem(skin,"updtlist.bmp",BIN1)   
btn1:= bmp(BIN1,hDC)   
axc_extracttomem(skin,"stop.bmp",BIN2)   
btn2:= bmp(BIN2,hDC)   
axc_extracttomem(skin,"help.bmp",BIN3)
btn3:= bmp(BIN3,hDC)       
axc_extracttomem(skin,"exit.bmp",BIN4)
btn4:= bmp(BIN4,hDC)     
axc_extracttomem(skin,"updt.bmp",BIN5)
btn5:= bmp(BIN5,hDC)     
axc_extracttomem(skin,"submit.bmp",BIN6)   
bmp(BIN6,hDC)   
axc_extracttomem(skin,"copy.bmp",BIN11)       
btn11:= bmp(BIN11,hDC)
}

AddGraphicButton(VariableName, ImgPath, Options="", bHeight=32, bWidth=32){
Global
Local ImgType, ImgType1, ImgPath0, ImgPath1, ImgPath2, hwndmode
; BS_BITMAP := 128, IMAGE_BITMAP := 0, BS_ICON := 64, IMAGE_ICON := 1
Static LR_LOADFROMFILE := 16
Static BM_SETIMAGE := 247
Static NULL
SplitPath, ImgPath,,, ImgType1
If ImgPath is float
{
  ImgType1 := (SubStr(ImgPath, 1, 1)  = "0") ? "bmp" : "ico"
  StringSplit, ImgPath, ImgPath,`.
  %VariableName%_img := ImgPath2
  hwndmode := true
}
ImgTYpe := (ImgType1 = "bmp") ? 128 : 64
If (%VariableName%_img != "") AND !(hwndmode)
  DllCall("DeleteObject", "UInt", %VariableName%_img)
If (%VariableName%_hwnd = "")
  Gui, Add, Button,  v%VariableName% hwnd%VariableName%_hwnd +%ImgTYpe% %Options%
ImgType := (ImgType1 = "bmp") ? 0 : 1
If !(hwndmode)
  %VariableName%_img := DllCall("LoadImage", "UInt", NULL, "Str", ImgPath, "UInt", ImgType, "Int", bWidth, "Int", bHeight, "UInt", LR_LOADFROMFILE, "UInt")
DllCall("SendMessage", "UInt", %VariableName%_hwnd, "UInt", BM_SETIMAGE, "UInt", ImgType,  "UInt", %VariableName%_img)
Return %VariableName%_img ; Return the handle to the image
}

axc_extracttomem(packfile,fil,byref bin) {
  ls:="_llseek",lr:="_lread",lo:="_lopen",lc:="_lclose",u:="uint",i:="int",s:="str"
  lt:="_lcreat",lw:="_lwrite",varsetcapacity(x,4,0),varsetcapacity(tfil,256,0)
  h:=dllcall(lo,s,packfile,i,0),dllcall(ls,u,h,u,8,i,0),dllcall(lr,u,h,s,x,i,4)
  f:=numget(x),dllcall(ls,u,h,u,4,i,1),dllcall(lr,u,h,s,x,i,1)
  csz:=numget(x,0,"uchar"),dllcall(ls,u,h,u,csz,i,1)
  loop %f%
{ dllcall(lr,u,h,s,x,i,4),dllcall(lr,u,h,s,tfil,u,256)
  nl:=strlen(tfil)+1,sz:=numget(x)-nl,tfil:=substr(tfil,1,nl)
  if (tfil!=fil)
{ dllcall(ls,u,h,u,-256+numget(x),i,1)
  continue
} dllcall(ls,u,h,u,-256+nl,i,1),varsetcapacity(bin,sz,0)
  Return dllcall(lr,u,h,s,bin,u,sz)+dllcall(lc,u,h2)+dllcall(lc,u,h)
} return dllcall(lc,u,h)   
} ;  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
GuiClose:
ExitApp


and here are the buttons I used (packed with axc) http://www.autohotkey.net/~wankausr/btns.axc


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 17th, 2010, 9:38 am 
Offline

Joined: August 14th, 2007, 12:11 pm
Posts: 86
no one knows why this happens? please help


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Alpha Bravo, Google [Bot], Google Feedfetcher, rbrtryn and 21 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group