   to BitBlt or not to BitBlt... that is the question
  Hi,I''m having some trouble drawing to a control on my win32 dialog.I''ve basically got a dialog with a rectangle control that I want to bitblt an image to when the program starts.I obtain the dc of the control like this:HDC dc = GetDC(GetDlgItem(g_hWnd,IDC_NAV));My big problem here though is that  I can''t figgure out where to put my drawing code! If I stick it in my dialog''s WM_INITDIALOG handler, nothing draws (i''d guess thats because the window isn''t completely loaded when WM_INITDIALOG is fired)I''ve tried sticking it in my dialog''s WM_PAINT thing, but it''ll overlap my control draw on my DIALOG, but nothing will show up in the actual CONTROL that I''m trying to draw to. What I was thinking I could do is create a custom message proc for the control, but I can''t figgure out how to (or if I even can) assign a window a new message handler.How should I go about drawing my stuff into this control when the program starts?RegardsMatt 
  Try using the WM_CREATE message.  This message is the first thing that is called when the application starts, but Im not familiar with dialogs so I may be wrong.  I know SetWindowLong(...)  will allow you to ''hook'' or change the procedure that handles windows built in types of windows.  The SetWindowLong(...) function does a lot, so you might want to research it to figure out how to change the default window procedure. Hope that help ;  Hmm... Well, I was able to change the message procedure, but now the box control doesn''t display WM_CREATE also isn''t firing in my dialogs message procedure. I guess that''s probably because it''s a dialog and not a normal window :-\Thanks for the help anyways ;  the first message in a dialog is WM_INITDIALOG and in a normal window it is WM_NCCREATE. Hope that haelps a little. ;  hmm.. is there a function that I can use to ''refresh'' a window? ;  You can Invalidate() the window and the framework will send another WM_PAINT message to "refresh" it.   --------------------You are not a real programmer until you end all your sentences with semicolons; (c) 2000 ROAD Programming You are unique.  Just like everybody else."Mechanical engineers design weapons; civil engineers design targets.""Sensitivity is adjustable, so you can set it to detect elephants and other small creatures." -- Product Description for a vibration sensorYanroy@usa.com ;  doesn't invalidate only work with .NET?EDIT: I added a button and made it so when I click that, it uses SendMessage to send WM_PAINT to the control and it draws then. I need to know when I should send WM_PAINT so it paints right when the app starts   [edited by - Xtremehobo on August 4, 2003 3:57:23 PM];quote:Original post by Xtremehobo  doesn''t invalidate only work with .NET?InvalidateRect() is part of the Win32 API   Qui fut tout, et qui ne fut rienInvader''s Realm;  Where should I stick InvalidateRect()? ;quote:Original post by Xtremehobo  Where should I stick InvalidateRect()?   At the place where you''d like your screen to be redrawn.   Qui fut tout, et qui ne fut rienInvader''s Realm