RE: Virtual screen creation in Windows?

new topic     » topic index » view thread      » older message » newer message

> -----Original Message-----
> From: Euman [mailto:euman at bellsouth.net]
 
> I hoped someone might give me a pointer to why "memdc" who is 
> assigned a value
> in
> WM_CREATE has no ID in WM_PAINT ?
 
> global function WndProc(atom hwnd, atom iMsg, atom wParam, 
> atom lParam)
>     atom hdc
>     atom memdc

<SNIP>

>     if iMsg = WM_CREATE then

>         memdc = c_func(xCreateCompatibleDC, {hdc})

> end if

<SNIP>

>  return 0
>     elsif iMsg = WM_PAINT then
>           hdc = c_func(BeginPaint, {hwnd, ps})
>          if not c_func(xBitBlt, {hdc, 0, 0, xScreen, yScreen, 
> memdc, 0, 0,
> SRCCOPY}) then end if

The problem is that memdc is local to to WndProc, and you only receive one
message at a time from windows.  So when you receive WM_CREATE, you create
your dc, and then return control to windows.  At that point, memdc is
destroyed, so there's no record of it in your program.  You need to store it
in a variable outside the routine.

Matt Lewis

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu