1. RE: Graphics Problems

Have you tried resetting the palette on WM_ACTIVATE?

Exotica requires you to rebuild custom graphics on WM_ACTIVATE. If not, 
the video memory buffer is corrupted from other windows, and the custom 
bitmaps are thrashed.
I assume, it's a similar situation.

Chris

euman at bellsouth.net wrote:
> Hello all,
> 
> I have a program that uses graphics exclusivly for the GUI and I have 
> one minor
> problem. Im using DIBSections for the imagery and double buffering the 
> images
> with memory DC's so I can bitblt the images to screen when needed at 
> certain 
> locations. What Ive found is in 256 color mode the screen and images 
> retain 
> their respective palette until my window looses focus.
> 
> I have this short piece of code that works fine for any window that may 
> overlap
> my window but if any window  is exclusive to the screen size (full 
> screen) and 
> recieves focus then my window losses its palette when it regains focus.
>   
>     elsif iMsg = WM_ACTIVATE then
>    
>           if LOWORD(wParam) =  0 then
>              hdc = GetDC(hwnd)
>              savedDC = c_func(xSaveDC,{hdc})
>              ReleaseDC(hwnd, hdc) 
>           
>              
>           elsif LOWORD(wParam) =  1 or LOWORD(wParam) =  2 then
> 
>                 if lParam = hwnd then
>                    ShowWindow(hwnd, SW_SHOWNORMAL)   
>                    junk = c_func(xRestoreDC,{hdc, -1})
>                    c_proc(UpdateWindow, {hwnd}) 
>                 end if
> 
> any ideas?
> 
> Euman
> euman at bellsouth.net
> 
> 5 2 1 - 1 - n - 5  The Doors  
> 
>

new topic     » topic index » view message » categorize

2. RE: Graphics Problems

euman at bellsouth.net wrote:
> Hello all,
> 
> I have a program that uses graphics exclusivly for the GUI and I have 
> one minor
> problem. Im using DIBSections for the imagery and double buffering the 
> images
> with memory DC's so I can bitblt the images to screen when needed at 
> certain 
> locations. What Ive found is in 256 color mode the screen and images 
> retain 
> their respective palette until my window looses focus.
> 
> I have this short piece of code that works fine for any window that may 
> overlap
> my window but if any window  is exclusive to the screen size (full 
> screen) and 
> recieves focus then my window losses its palette when it regains focus.
>   
>     elsif iMsg = WM_ACTIVATE then
>    
>           if LOWORD(wParam) =  0 then
>              hdc = GetDC(hwnd)
>              savedDC = c_func(xSaveDC,{hdc})
>              ReleaseDC(hwnd, hdc) 
>           
>              
>           elsif LOWORD(wParam) =  1 or LOWORD(wParam) =  2 then
> 
>                 if lParam = hwnd then
>                    ShowWindow(hwnd, SW_SHOWNORMAL)   
>                    junk = c_func(xRestoreDC,{hdc, -1})
>                    c_proc(UpdateWindow, {hwnd}) 
>                 end if
> 
> any ideas?
> 

Euman:
  The -1 in RestoreDC maybe causing a problem if somewhere
  in your program or windows the device context stack has
  been disturbed.
Bernie

new topic     » goto parent     » topic index » view message » categorize

3. RE: Graphics Problems

euman at bellsouth.net wrote:
> ----- Original Message ----- 
> So I ask this: 
> 
> If I issue SaveDC( ) when my windows is deactivated and RestoreDC( ) 
> when
> my window is re-Activated how can the DC stack become corrupt in an 
> unactive state?

Euman:

Maybe this will help.


nSavedDC

Specifies the instance of the device context to be restored. If this 
parameter is positive, nSavedDC represents a specific instance of the 
device context to be restored. If this parameter is negative, nSavedDC 
represents an instance relative to the current device context. For 
example, -1 restores the most recently saved state. 

Return Value

If the function succeeds, the return value is TRUE.
If the function fails, the return value is FALSE. 

Remarks

The stack can contain the state information for several instances of the 
device context. If the state specified by the given parameter is not at 
the top of the stack, RestoreDC deletes all state information between 
the top of the stack and the specified instance. 

Bernie

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu