News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Problems writing text in a static window

Started by allynm, December 17, 2009, 01:01:13 AM

Previous topic - Next topic

allynm

Hello eveyone:

I use the following code to write a string to a static window:

invoke SendMessage, hwndStatic, WM_SETTEXT, 0, ADDR StaticText

The problem is that nothing gets written in the static window.  The static window is drawn, but the text string StaticText doesn't show up.

I create the static child window with this call:

invoke CreateWindowEx, NULL, ADDR ChildClass, NULL, \
        WS_CHILD or WS_VISIBLE or SS_BLACKFRAME or SS_CENTER,\
          300, 150, 100, 50,\
         hWnd, StaticID, hInstance, NULL

ChildClass is a db string "static".


Thaniks,
Mark Allyn

hutch--

Mark,

Remove the "SS_BLACKFRAME" style and see if it displays correctly then.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

allynm

Hello Hutch -

Blimey, it worked like a charm!  OK, now if you don't mind too much, what is there about the SS_BLACKFRAME that prevents the display of the text?  I searched and searched thru my Windows API reference (Rector and Newcomer) and couldn't find anything on this.

Thanks,

Mark Allyn

MichaelW

Not all of the static control styles are intended to display text. SS_BLACKFRAME, for example, specifies a box with a frame drawn in the same color as the window frames. See Simple Graphics Static Control at the first link below.

http://msdn.microsoft.com/en-us/library/bb760767(VS.85).aspx

http://msdn.microsoft.com/en-us/library/bb760773(VS.85).aspx

eschew obfuscation

allynm

Hi MichaelW-

I looked at the two MSDN library items you sent.  Maybe I need to look again, but it seems to me they are both a bit ambiguous as far as writing in the static control.  I tried a couple of other frames and rects and can't write in any of them.  However, I can write reliably in a frame-less or unfilled control.  Is there no way to fill a static control with a color (or an icon or bitmap) and write in it too?

Thanks for your and Hutch's help on this.

Mark Allyn

jj2007

Have a look at \masm32\examples\exampl04\bmpbutn\bmpbutns.asm, Mark.

allynm

Hello JJ-

Thanks for the tip.  I looked at the example.  It was very helpful.  There are also two very useful Procs that went with the example, esp.  TopXY.

Regards,

Mark Allyn

MichaelW

QuoteIs there no way to fill a static control with a color (or an icon or bitmap) and write in it too?

The attachment demonstrates one method, and there are probably others.

eschew obfuscation