Hi,
There are a few more tweaks you need. Have a look at the following code:

invoke BeginPaint, hDlg, ps
mov hdc, eax
invoke CreateCompatibleDC, hdc
mov hMemDC, eax
invoke SelectObject, hMemDC, hBitMap
mov hOldBitmap, eax ; <-------
invoke GetClientRect, hDlg, rect
invoke BitBlt, hdc, 0, 0, rect.right, rect.bottom, hMemDC, 0, 0, SRCCOPY
invoke SelectObject, hMemDC, hOldBitMap ; <----- Resource leak otherwise
invoke DeleteDC, hMemDC

; Text Colors
invoke SelectObject, hdc, hFont;
mov hOldFont, eax
invoke SetTextColor, hdc, 0DFBAA2h
mov rgbPrevText, eax
invoke SetBkMode, hdc, TRANSPARENT
mov rect.top, ........ ; top coordinate for area you want text drawn to
mov rect.right, ........ ; right coordinate for area you want text drawn to
mov rect.bottom, ........ ; bottom coordinate for area you want text drawn to
mov rect.left, ........ ; left coordinate for area you want text drawn to
invoke ExtTextOut, hdc, 10, 41, ETO_CLIPPED, addr rect, addr MsgSobre2, NumberOfCharactersInString, NULL
invoke SelectObject, hdc, hOldFont ; <------ Select the Old Font back in
invoke SetTextColor, hdc, rgbPrevText
invoke SetBkMode, hdc, OPAQUE
; invoke DeleteObject, hFont <---- Commented out because you don't want
; to delete this here - you will need to use it again the next time
; your window is painted. Delete this when the window is destroyed


A couple of other things I would look at are contained in the following lines:

invoke PostQuitMessage, NULL
mov eax, FALSE

invoke DefWindowProc, hWin, uMsg, wParam, lParam

There is no need to call DefWindowProc in a dialog box procedure. These procedures generally just return TRUE if they process a message and FALSE otherwise. However WM_PAINT is one of the few exceptions to this. Unless you paint every part of your application (titlebar, the works) you should do whatever painting you need to do and then return FALSE so that windows does its thing.

You also don't need to call PostQuitMessage for a dialog based application. EndDialog does everything you need.
Posted on 2003-09-28 18:30:37 by andrew_k
HmmmI did the modifications, and still not working...The text continues to show on a single line.

I adapted to fit on the area of the static control....(Not used, but needs to be on the same coordinates), but nothing....



call 'GDI32.SetBkMode' D@hdc &TRANSPARENT

; Area of the static box in the resource file xpos 10 ; ypos 31; width 163; height 173

mov rect.top 0 ; top coordinate for area you want text drawn to
mov rect.right 300 ; right coordinate for area you want text drawn to
mov rect.bottom 213 ; bottom coordinate for area you want text drawn to
mov rect.left 0 ; left coordinate for area you want text drawn to
invoke ExtTextOut hdc 15 45 ETO_CLIPPED rect OurText OurTextLen NULL


Best Regards,

Guga
Posted on 2003-09-28 20:25:01 by Beyond2000!
Hi,

You can try this, does word wrap or CRLF.
.ELSEIF uMsg==WM_PAINT

mov eax,hWin
.IF eax == hDlg
invoke BeginPaint,hDlg,addr ps
mov hdc,eax
invoke CreateCompatibleDC,hdc
mov hMemDC,eax
invoke SelectObject,hMemDC,hBitMap
mov OldObject,eax
invoke GetClientRect,hDlg,addr rect

invoke SetBkMode,hMemDC,TRANSPARENT
invoke SetTextColor,hMemDC,0
invoke GetObject,hBitMap,SIZEOF BITMAP,ADDR bmp
mov rect.left,0
mov rect.top,0
mov eax,bmp.bmWidth
mov rect.right,eax
mov eax,bmp.bmHeight
mov rect.bottom,eax
invoke DrawText,hMemDC,OFFSET Text,-1,ADDR rect,DT_NOCLIP or DT_LEFT or DT_WORDBREAK

invoke BitBlt,hdc,0,0,rect.right,rect.bottom,hMemDC,0,0,SRCCOPY
invoke SelectObject,hMemDC,OldObject
invoke DeleteDC,hMemDC
invoke EndPaint,hDlg,addr ps
.ENDIF
Posted on 2003-09-28 20:28:41 by donkey
Here's a demo program for it. The test program will measure the bitmap and confine the text to the bitmap automatically. This is the preferable way to do this as you have no constant data to pass to the procedure it allows you to have variable size drawing areas handled automatically.

Hi Guga,

This one is a little better, it doesn't need alot of the extra painting...
Posted on 2003-09-28 20:46:34 by donkey
Hi Donkey

Great, this is exactly what i'm testing...


I'm testing your above routine, and the new you posted.
Posted on 2003-09-29 00:21:46 by Beyond2000!

Hi QvasiModo,
Do you mean something other than using:
Invoke SetBkMode, hDC, TRANSPARENT
with ExtTextOut?

Yes, that's what I meant.
Anyway, I see since my last visit to the board the problem was solved. :)
BTW, donkey's test proggy works just fine under Windows Millenium (4.90.3000).
Posted on 2003-09-29 17:15:50 by QvasiModo