Sign in to follow this  
Followers 0
Valuater

Larry's... BMP2RGN.dll

11 posts in this topic




#2 ·  Posted (edited)

there are many parts to this... a main script, an include, ini files, and 12+ folders for the skins

it is hard to make a small erroring sample

but maybe you could look at this smaller section and ... i note that there is no dllopen(), could that be a/the problem

or maybe with all the dllCalls in this function and running it 3-4 times, it overloads the dll's capabilities ???

Func XSkinGUICreate($guiTitle, $width, $height, $Skin_Folder)
    If Not FileExists($Skin_Folder) Then
        MsgBox(64, "Skin Error !", "The skin folder was not found")
        Exit
    EndIf
    $bkg_color = IniRead($Skin_Folder & "\Skin.dat", "color", "background", 0xD9F6FF)
    $btn_color = IniRead($Skin_Folder & "\Skin.dat", "color", "button", 0xD9F6FF)
    $over_color = IniRead($Skin_Folder & "\Skin.dat", "color", "mouseover", 0xD9F6FF)
    $fnt_color = IniRead($Skin_Folder & "\Skin.dat", "color", "fontcolor", 0x000000)
    $tile_size = IniRead($Skin_Folder & "\Skin.dat", "settings", "size", 20)
    Local $R_transparent = 0, $G_transparent = 0, $B_transparent = 0, $elements[8]
    If $width < 100 Then $width = 100
    If $height < 50 Then $height = 50
    If $tile_size < 15 Then $tile_size = 15
    For $px = 0 To 7
        $elements[$px] = $Skin_Folder & "\" & $px & ".bmp"
        If Not FileExists($elements[$px]) Then
            MsgBox(64, "Skin Error !", "A skin picture was not found")
            Exit
        EndIf
    Next
    $gui = GUICreate($guiTitle, $width, $height, -1, -1, $WS_POPUP)
    ; create a mini & exit label/pic/button
    GUISetBkColor($bkg_color)
    GUICtrlCreatePic($elements[0], 0, 0, $tile_size, $tile_size, $WS_CLIPSIBLINGS)
    GUICtrlSetState(-1, $GUI_DISABLE)
    GUICtrlCreatePic($elements[2], ($width - $tile_size), 0, $tile_size, $tile_size, $WS_CLIPSIBLINGS)
    GUICtrlSetState(-1, $GUI_DISABLE)
    GUICtrlCreatePic($elements[5], 0, ($height - $tile_size), $tile_size, $tile_size, $WS_CLIPSIBLINGS)
    GUICtrlSetState(-1, $GUI_DISABLE)
    GUICtrlCreatePic($elements[7], ($width - $tile_size) , ($height - $tile_size), $tile_size, $tile_size, $WS_CLIPSIBLINGS)
    $TL = DllCall(@ScriptDir & "\BMP2RGN.dll", "int", "BMP2RGN", _
            "str", $elements[0], _
            "int", $R_transparent, _
            "int", $G_transparent, _
            "int", $B_transparent)
    $TR = DllCall(@ScriptDir & "\BMP2RGN.dll", "int", "BMP2RGN", _
            "str", $elements[2], _
            "int", $R_transparent, _
            "int", $G_transparent, _
            "int", $B_transparent)
    $BL = DllCall(@ScriptDir & "\BMP2RGN.dll", "int", "BMP2RGN", _
            "str", $elements[5], _
            "int", $R_transparent, _
            "int", $G_transparent, _
            "int", $B_transparent)
    $BR = DllCall(@ScriptDir & "\BMP2RGN.dll", "int", "BMP2RGN", _
            "str", $elements[7], _
            "int", $R_transparent, _
            "int", $G_transparent, _
            "int", $B_transparent)
    $TL = $TL[0]
    $TR = $TR[0]
    $BL = $BL[0]
    $BR = $BR[0]
    OffsetRgn($TR, $width - $tile_size, 0)
    OffsetRgn($BL, 0, $height - $tile_size)
    OffsetRgn($BR, $width - $tile_size, $height - $tile_size)
    Local $TM[Ceiling($width / $tile_size) - 2]
    Local $BM[Ceiling($width / $tile_size) - 2]
    For $i = 0 To (Ceiling($width / $tile_size) - 3)
        GUICtrlCreatePic($elements[1], ($tile_size * ($i + 1)), 0, $tile_size, $tile_size, $WS_CLIPSIBLINGS)
        GUICtrlSetState(-1, $GUI_DISABLE)
        GUICtrlCreatePic($elements[6], ($tile_size * ($i + 1)) , ($height - $tile_size), $tile_size, $tile_size, $WS_CLIPSIBLINGS)
        GUICtrlSetState(-1, $GUI_DISABLE)
        $TMtemp = DllCall(@ScriptDir & "\BMP2RGN.dll", "int", "BMP2RGN", _
                "str", $elements[1], _
                "int", $R_transparent, _
                "int", $G_transparent, _
                "int", $B_transparent)
        $BMtemp = DllCall(@ScriptDir & "\BMP2RGN.dll", "int", "BMP2RGN", _
                "str", $elements[6], _
                "int", $R_transparent, _
                "int", $G_transparent, _
                "int", $B_transparent)
        $TM[$i] = $TMtemp[0]
        $BM[$i] = $BMtemp[0]
        OffsetRgn($TM[$i], ($tile_size * ($i + 1)), 0)
        OffsetRgn($BM[$i], ($tile_size * ($i + 1)) , ($height - $tile_size))
    Next
    OffsetRgn($TM[UBound($TM) - 1], -1 * Mod($width, $tile_size), 0)
    OffsetRgn($BM[UBound($BM) - 1], -1 * Mod($width, $tile_size), 0)
    Local $ML[Ceiling($height / $tile_size) - 2]
    Local $MR[Ceiling($height / $tile_size) - 2]
    For $i = 0 To (Ceiling($height / $tile_size) - 3)
        GUICtrlCreatePic($elements[3], 0, ($tile_size * ($i + 1)), $tile_size, $tile_size, $WS_CLIPSIBLINGS)
        GUICtrlSetState(-1, $GUI_DISABLE)
        GUICtrlCreatePic($elements[4], ($width - $tile_size) , ($tile_size * ($i + 1)), $tile_size, $tile_size, $WS_CLIPSIBLINGS)
        GUICtrlSetState(-1, $GUI_DISABLE)
        $MLtemp = DllCall(@ScriptDir & "\BMP2RGN.dll", "int", "BMP2RGN", _
                "str", $elements[3], _
                "int", $R_transparent, _
                "int", $G_transparent, _
                "int", $B_transparent)
        $MRtemp = DllCall(@ScriptDir & "\BMP2RGN.dll", "int", "BMP2RGN", _
                "str", $elements[4], _
                "int", $R_transparent, _
                "int", $G_transparent, _
                "int", $B_transparent)
        $ML[$i] = $MLtemp[0]
        $MR[$i] = $MRtemp[0]
        OffsetRgn($ML[$i], 0, ($tile_size * ($i + 1)))
        OffsetRgn($MR[$i], ($width - $tile_size) , ($tile_size * ($i + 1)))
    Next
    OffsetRgn($ML[UBound($ML) - 1], 0, -1 * Mod($height, $tile_size))
    OffsetRgn($MR[UBound($MR) - 1], 0, -1 * Mod($height, $tile_size))
    $all = CreateRectRgn($tile_size, $tile_size, $width - $tile_size - $tile_size, $height - $tile_size - $tile_size)
    For $i = 0 To UBound($TM) - 1
        CombineRgn($all, $TM[$i])
        CombineRgn($all, $BM[$i])
    Next
    For $i = 0 To UBound($ML) - 1
        CombineRgn($all, $ML[$i])
        CombineRgn($all, $MR[$i])
    Next
    CombineRgn($all, $TL)
    CombineRgn($all, $TR)
    CombineRgn($all, $BL)
    CombineRgn($all, $BR)
    SetWindowRgn($gui, $all)
    GUISetState()
    Return $gui
EndFunc   ;==>XSkinGUICreate

thanks

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

ok here is some effort to find the prob

First i placed a sleep() after each Dll call

Then, i inserted this line after each Dll call ( with the correct Dll call # )

If @error <> 0 And $debug Then ConsoleWrite("Dll = 1 " & @error & @CRLF)
oÝ÷ Úz®º+±8^eiÇjg¬±¨naz·°êÞ¶ÞÓ~P¬­ën®wjëh×6
If $debug Then MsgBox(262208,"GUI Testing","This is the retun for " & @CRLF & "the last GUI Created" & @CRLF & $gui[$TMA])
    If $debug Then ConsoleWrite("gui = " & $gui[$TMA] & " Error = " & @error & @CRLF)
oÝ÷ Ù§íz»ajÙ²Æ yº1z-Ƕ­¶Ø«zÇ+yéç¢Z'êÜ©àzÇ(ÛºÛazg¬±¨nb¶Ç¥~+*ºb®· ºV«ªê-²­®'¶æ¬r·Èh¶Ú)§Ø^­ëaz̬µé¬j'mêÞÉèµéèºfzj+ÊÊ"¦VyÛaȧ¶°)^)jëh×6

While 1
     _ReduceMemory()
;....
Wend

Func _ReduceMemory()
    Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', -1)
    If @error Then Return 1
    Return $ai_Return[0]
EndFunc   ;==>_ReduceMemory

no help at all.............

seems to be a memory problem

any ideas??

thx

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

I see questionable math and global variables... Global $tile_size is used in XSkinMsgBox() without surety of being assigned a value... And alot of other math... try to reproduce without so much math.

Lar.

"Global $tile_size is used in XSkinMsgBox() without surety of being assigned a value"

the value is set in the first function, i am absolutely sure of that

Also, I check the return from CombineRgn and OffsetRgn and I see that it is failing at some point, but you ignore the failure and continue. I also see that negative numbers are passed sometimes...

Lar.

i did check for errors,,, I will check those returns

can i use, or should i use

func

$var = DllCall()

Consolewrite ( $var )

return $var

endfunc

on all functions with dllcalls? Because some do not have return $var

Thanks for your effort

8)

Remember, i am just a hobbiest who is trying to help Autoit, ... no where near a "real programmer"


NEWHeader1.png

Share this post


Link to post
Share on other sites

The problem as described sounds to me like a resource leak that uses up all the available GDI resources. At that point, Windows starts looking strange. Purely a guess on my part, though.

Share this post


Link to post
Share on other sites

thanks guys!

i will continue also... banging my head against the wall

( imagine my headache )

lol

thx

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

yes i revived the 2 year old thread.

how did you ever solve the problem Valuater?

Share this post


Link to post
Share on other sites

yes i revived the 2 year old thread.

how did you ever solve the problem Valuater?

I dumped it!!! :)

I sure remember that headache!!!

That was a primary effort to create XSkin, just look at the XSkin.au3 there's no dll calls.

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

ah i see you just used CreateRoundRectRgn for the corners?

Share this post


Link to post
Share on other sites

ah i see you just used CreateRoundRectRgn for the corners?

Yes! :)

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

alright thanks.

Share this post


Link to post
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
Sign in to follow this  
Followers 0