Author Topic: Window background  (Read 1063 times)

clamicun

  • Member
  • **
  • Posts: 240
Re: Window background
« Reply #15 on: June 03, 2017, 12:13:17 AM »
hutch,
easy to answer.
Because me stupido  didnt open your zipfile thinking it was  the one I uploaded.
But my was  chg_background.zip
Very sorry about that.

clamicun

  • Member
  • **
  • Posts: 240
Re: Window background
« Reply #16 on: June 03, 2017, 12:35:35 AM »
ok.
Now I understand what you meant with "Static control".
Its uncomplicated.
But seems , its working only with .bmp and thats not what I wanted, because the user can pick his own background.

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 4922
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: Window background
« Reply #17 on: June 03, 2017, 06:42:21 AM »
The next trick is to use GDI+ to load the JPG/PNG/whatever image and convert it to BMP so you can use the standard Windows controls. I have it done in 64 bit but not 32 bit.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :biggrin:

clamicun

  • Member
  • **
  • Posts: 240
Re: Window background
« Reply #18 on: June 04, 2017, 06:35:02 AM »
hutch thank you,
that's exactely what my little example does (gdi+)
 

clamicun

  • Member
  • **
  • Posts: 240
Re: Window background
« Reply #19 on: June 04, 2017, 11:40:50 PM »
Bom dia jj,
"It's just that the answer "use WM_PAINT" is the right one, but it took me years to accept that, so you are in good bad company
Spend an hour reading a good book on WM_PAINT"

I did too.
I MUST use WM_PAINT...

Here again is an example to not use WM_PAINT.
no_wmpaint.zip


jj2007

  • Member
  • *****
  • Posts: 7730
  • Assembler is fun ;-)
    • MasmBasic
Re: Window background
« Reply #20 on: June 05, 2017, 12:13:04 AM »
Nice! Move the window with the photo slightly out of the desktop, then move it back. As written earlier, it took me years to accept WM_PAINT, so you still have a lot of time to try without ;)

clamicun

  • Member
  • **
  • Posts: 240
Re: Window background
« Reply #21 on: June 05, 2017, 12:36:21 AM »
jj,
obviously I don't understand the basics of WM_PAINT.

ok. I write this into my WndProc.

.elseif uMsg == WM_PAINT
INVOKE BeginPaint,main_hwnd,addr ps
mov hdc,eax
;do something ? IDM_1, IDM_2 ,IDM_3
INVOKE EndPaint,main_hwnd,addr ps

Now I have various commands in WM_COMMAND.  IDM_1, IDM_2
What I have to do, to make WM_PAINT  react to the command ?
 
 
 

jj2007

  • Member
  • *****
  • Posts: 7730
  • Assembler is fun ;-)
    • MasmBasic
Re: Window background
« Reply #22 on: June 05, 2017, 12:47:14 AM »
Between BeginPaint and EndPaint, you typically BitBlt a bitmap to the DC that BeginPaint gave to you. Really, Petzold or the Iczelion tutorials should give you everything you need.

clamicun

  • Member
  • **
  • Posts: 240
Re: Window background
« Reply #23 on: June 05, 2017, 01:04:45 AM »
yes, I know

.elseif uMsg == WM_PAINT
INVOKE BeginPaint,main_hwnd,addr ps
mov hdc,eax
INVOKE Change_Bkgr,offset imagepath2,400,300,0,0
INVOKE EndPaint,main_hwnd,addr ps

The window starts with imagepath2 foto.

But I want that only after I clicked on a IDM_
And what about the other commands ?
What I do to use WM_PAINT on various tasks ?

The iczelion example I sure do know.
Does the same ... one job on startup.

ok.  this migt have to do with m "problem"

 If you want to repaint your client area in response to other messages, you have two choices:

    Use GetDC-ReleaseDC pair and do your painting between these calls
    Call InvalidateRect or UpdateWindow  to invalidate the entire client area, forcing Windows to put WM_PAINT message in the message queue of your window and do your painting in WM_PAINT section