Jump to content

Make simple skins out of your bmp's.


xroot
 Share

Recommended Posts

My Makeskin.dll is simple to use.

Call it with the GUICreate handle, and string pointer of your bmp.

It returns the handle of the bmp.

If your bmp's are bigger than default(400) width,height then change it from -1 in GUICreate.

To make your BMP's work, all you have to do is set a color for the mask. A color not in the

BMP. Look at the 3 BMP's I changed. Two of them have magenta other has grey color mask.

Run the sample program, it will give you the idea on what you can do.

sskins.zip

Link to comment
Share on other sites

xroot,

This is really cool.

Thanks for sharing your hard work.

taurus905

"Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs

Link to comment
Share on other sites

  • Moderators

xroot,

Nice job with the DLL. :mellow:

But I thought I would point out to less-experienced forum members that you do not have to use it to get shaped GUIs. :( AutoIt can produce GUIs directly from BMPs using only built-in commands (I have used the BMPs you included in your zip):

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <SendMessage.au3>

Global Const $SC_DRAGMOVE = 0xF012

Global $aSize[2], $aImages[3][7] = [["\Pen.bmp",    323, 382, 230, 300, 25, 295], _
                                    ["\fbi.bmp",    340, 400, 255, 368, 50, 368], _
                                    ["\kkitty.bmp", 452, 400, 222, 284,  0,   0]]

For $i = 0 To 2
    _GUI_Image($i)
Next

Exit

Func _GUI_Image($i)

    Local $hTestButton

    Local $hGUI = GUICreate("No DLL Required", $aImages[$i][1], $aImages[$i][2], -1, -1, $WS_POPUP, $WS_EX_LAYERED)
    GUICtrlCreatePic(@ScriptDir & $aImages[$i][0], 0, 0, $aImages[$i][1], $aImages[$i][2])
    GUICtrlSetState(-1, $GUI_DISABLE)

    If $i < 2 Then
        $hTestButton = GUICtrlCreateButton("Next BMP", $aImages[$i][5], $aImages[$i][6], 70, 30)
        GUICtrlSetFont(-1, 10, 800, 0, "Arial")
    Else
        $hTestButton = 9999
    EndIf
    Local $hExitButton = GUICtrlCreateButton("E x i t", $aImages[$i][3], $aImages[$i][4], 55, 25, 1)
    GUICtrlSetFont(-1, 12, 800, 0, "Arial")

    GUISetState(@SW_SHOW)

    While 1

        Switch GUIGetMsg()
            Case $hExitButton
                Exit
            Case $hTestButton
                MsgBox(0, "Next", "Next GUI ready when you are!")
                GUIDelete($hGUI)
                ExitLoop
            Case $GUI_EVENT_PRIMARYDOWN
                _SendMessage($hGUI, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0)
        EndSwitch

    WEnd

EndFunc

I hard-coded the BMP size (which you could get through GDI) and the positions of the buttons to make the script easier to loop.

Anyway, nice work with the DLL - looking forward to your next project. :lol:

M23

Edit: To clarify that I was only offering an alternative solution, not criticizing the OP's work in any way.

Edited by Melba23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

picea892,

Very true. :mellow:

But, as I hoped you noticed, I was very careful not to criticise or belittle xroot's work. I was merely offering another way to produce essentially the same result - without the need for an external DLL or the (relatively short) delay while it does its magic. My only purpose was to show some of the less experienced members here that the external DLL method was not the only way to go about producing a shaped GUI and that there are often many solutions to a given problem. . :(

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Melba23,

I was not offended by your example, the funny thing is I had done what you did but got frustrated not getting things to work properly,

so I created the Dll.

Here is what I was working on before I made the Dll.

When I use the Pic control the GUI ignores the WS_EX_LAYERED, if I use Button control then no transparency no blending.

Anyway, thanks for your input.

Global Const $WM_POPUP=0x80000000
Global Const $WS_EX_CONTROLPARENT=0x00010000
Global Const $GUI_WS_EX_PARENTDRAG=0x00100000
Global Const $WS_EX_LAYERED=0x00080000
Global Const $GUI_DISABLE=128
Global Const $BS_BITMAP=0x0081
Global Const $TRANSPARENT=-2
Global Const $LR_LOADFROMFILE=16

Func Get_WH($iFile,$iType=0)
    Local $BM=DllStructCreate("int;int;int;int;word;word;ptr")
    Local $ret=DllCall("user32.dll","hwnd","LoadImage","hwnd",0, _
                                                       "str",$iFile, _
                                                       "int",$iType, _  ;1=IMAGE_ICON 0=Bmp
                                                       "int",0, _
                                                       "int",0, _
                                                       "int",$LR_LOADFROMFILE)
    DllCall("GDI32.dll","int","GetObject","hwnd",$ret[0], _
                                          "int",DllStructGetSize($BM), _
                                          "ptr",DllStructGetPtr($BM))
    Global $W=DllStructGetData($BM,2)
    Global $H=DllStructGetData($BM,3)
    $BM=0
    Return
EndFunc

Local $BG="C:\My Documents\Images\Skins\face.bmp"
Local $ExitBmp="C:\My Documents\Images\exit.bmp"
Local $xBmp="C:\My Documents\Images\Buttons\XU.bmp"
Local $MinBmp="C:\My Documents\Images\Buttons\MinU.bmp"

Get_WH($BG)
$hWnd=GUICreate("***",$W,$H,-1,-1,$WM_POPUP,$WS_EX_LAYERED+$WS_EX_CONTROLPARENT)
$mBG=GUICtrlCreatePic($BG,0,0,$W,$H)
GUICtrlSetState(-1,$GUI_DISABLE)

Get_WH($xBmp)
;$X=GUICtrlCreateButton("",434,9,$W,$H,$BS_BITMAP) ; This works but ugly. No transp.
$X=GUICtrlCreatePic($xBmp,434,9,$W,$H) ;****This is what I can not get to work.
;GUICtrlSetImage(-1,$xBmp)

Get_WH($MinBmp)
$Min=GUICtrlCreatePic("",416,9,$W,$H)
GUICtrlSetImage(-1,$MinBmp)

Get_WH($ExitBmp)
$Exit=GUICtrlCreateButton("",375,185,$W,$H,$BS_BITMAP)
GUICtrlSetImage(-1,$ExitBmp)

GUICtrlCreateLabel("Skinned",20,9,72,14,1,$GUI_WS_EX_PARENTDRAG)
GUICtrlSetFont(-1,11,800,0,"Arial")
GUICtrlSetBkColor(-1,$TRANSPARENT)
GUICtrlSetColor(-1,0xFFFFFF)

GUISetState()

While True
    Switch GUIGetMsg()
        Case -3,$Exit,$X
            Exit
        Case $Min
            GUISetState(@SW_MINIMIZE)
    EndSwitch
WEnd

bmps.zip

Link to comment
Share on other sites

  • 2 months later...
  • 4 months later...
  • 1 year later...

umm also can any1 tell me how to save .bmp so taht u get the pink around the image? o.o

im using photoshop cs3

my problem is taht when i save an image .bmp ..

and then the gui shows white lines around the image which makes the img look crappy.. :/

Edited by tomashen

Proud of AutoIt Proud of MySelf :)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...