flat assembler
Message board for the users of flat assembler.

Index > Windows > Colors

Author
Thread Post new topic Reply to topic
iic2



Joined: 26 Jun 2008
Posts: 123
iic2
How do I write this in FASM to receive a handle for a color.

I get a handle for the color BLUE with the code below under MASM, but I get nothing when using FASM.

push 00FFFF00h
call GetSysColor
mov [hBLUE], eax

NOTE: Only black, white and sysBackground color works under FASM with no problems but my own defined colors does not

00000000h black
this work under fasm

1
2
3 etc
also works under FASM

Thanks in advance
Post 06 Aug 2008, 00:28
View user's profile Send private message Reply with quote
Goplat



Joined: 15 Sep 2006
Posts: 181
Goplat
There is no such thing as a "handle for a color" in Windows.

The GetSysColor function takes a COLOR_ constant and returns the RGB color value. Since 00FFFF00h is not one of the COLOR_ constants, your call will just return 0.
Post 06 Aug 2008, 01:03
View user's profile Send private message Reply with quote
iic2



Joined: 26 Jun 2008
Posts: 123
iic2
Thanks Goplat for the info.

Handle may be the wrong word but under MASM all 9 colors I declare (xxxxxxxxh) show 9 dwords under .data? and I can use any of those dword to color what ever is needed. I did that for years. No ColorStatic API needed.

So how do I build my own constants that works for fasm. I tried below but it don't work. It got to be in the style of writing that can works for FASM.

yellow = 0000ffffh

red = 000000ffh

etc

Or is there another way to build color using other means.
Post 06 Aug 2008, 01:23
View user's profile Send private message Reply with quote
iic2



Joined: 26 Jun 2008
Posts: 123
iic2
Correction. I went blind... I just checked my old code and the thing is to use CreateSolidBrush and save that value.


push COLOR_BACKGROUND
call GetSysColor
mov [hBACKGROUND], eax

push 0080FF00h ; or any color
call CreateSolidBrush
mov [rGREEN]

etc

etc

Thanks for the Wake-Up-Call Goplat
Post 06 Aug 2008, 01:42
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.