News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Gdi frame color

Started by ragdog, August 19, 2015, 07:11:01 PM

Previous topic - Next topic

ragdog

Hello

I coding a little with Gdi and have a problem with a frame color



This little window have a Black frame how i can change it to a other color?
I try FrameRect but without good result is this blackframe from the CreateCompatibleDC?


invoke GetDC, aWnd
mov aMainDC, eax

invoke CreateCompatibleDC, 0
mov ahDC, eax

;-----------------------------------------------------------------------
mov rect.left,10
mov rect.top,10
mov rect.right,20
mov rect.bottom,20
invoke CreateSolidBrush,0FFFFFFFh
invoke FrameRect,aMainDC,addr rect,eax
;-------------------------------------------------------------------------

; Creating Bitmap... using with "ahDC"
invoke CreateBitmap, aWidth, aHeight, 1, 32, NULL
mov ahBmp, eax

; Creating font
  invoke CreateFont, 16, 0, 0, 0, 400, 0, 0, 0,
DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
DEFAULT_QUALITY, DEFAULT_PITCH, addr szaFontName
mov ahFont, eax

; assign "ahDC" with other variables
invoke SelectObject, ahDC, ahBmp
invoke SelectObject, ahDC, ahFont

; Set Color of Text
invoke SetTextColor, ahDC, 0FFFFFFh


invoke CreateSolidBrush, 094AA97h
mov ahBrush, eax

invoke SelectObject, ahDC, eax




invoke SetBkMode, ahDC, TRANSPARENT

dedndave

i guess you could make a borderless window, then draw the rectangle, using a pen of your own

but - the user has selected a set of colors
it's not nice to change the standard appearance of windows
not to say it isn't done   :P

ragdog

My Window have this styles

Style=90080802
Exstyle=00000000

And i mean this Green Window have a Black frame and i need it in Transparent or other color

Regards

HSE

Hi Ragdog!

You have so many F in the Brush :dazzled:  Delete one F :t

Regards. HSE
Equations in Assembly: SmplMath

dedndave

          Style=90080802h

WS_POPUP    equ 80000000h ;The windows is a pop-up window. This style cannot be used with the WS_CHILD style.
WS_VISIBLE  equ 10000000h ;The window is initially visible.
WS_SYSMENU  equ 00080000h ;The window has a window menu on its title bar. The WS_CAPTION style must also be specified.
DS_CENTER   equ 00000800h ;Centers the dialog box in the working area of the monitor that contains the owner window.
DS_SYSMODAL equ 00000002h ;This style is obsolete and is included for compatibility with 16-bit versions of Windows.
                          ;If you specify this style, the system creates the dialog box with the WS_EX_TOPMOST style.


you want a WS_CHILD window, right ?
or - are those the style bits for the parent window ?   :biggrin:

WS_CHILD    equ 40000000h

ragdog

Hi

Thank you both for your answer

This blue window with frame is  draw with gdi ,this green with black screen is gdi but try to change the color of this black frame

is this from CreateBitmap ?

HSE

It's not easy to see but in your code the FrameRect  brush border have 7 F instead of 6. (6=white 7=black in my test).
Equations in Assembly: SmplMath

dedndave

HSE is right
you have
invoke CreateSolidBrush,0FFFFFFFh ;7 'F's
because the value is invalid, it returns a 0, which gets you black   :P

invoke CreateSolidBrush,0FFFFFFh  ;6 'F's
now, an HBRUSH should be returned

by the way - you should save that HBRUSH, so you can DeleteObject when you are done with it   :t

if you really want a white brush, use GetStockObject, then you don't have to delete it

ragdog

Hello

It works now thank you again  :t

mov rect.left,0
mov rect.top,0
mov rect.right,aWidth
mov rect.bottom,aHeight
invoke CreateSolidBrush,00F4CCA3h
invoke FrameRect,ahDC,addr rect,eax



Greets,