Sir,
     Thanks for the response. Let me put the work I tried till now so that you 
can easily  find my error.
   I know that whenever we resize or minize , maximize etc , windows will 
invalidate the region and will cseng WM_PAINT mesage. I have written a code and 
I habdled WM_SIZE message . I called Invalidate() in that handler (somtime back 
, i heard like invalidaterect() will store the current content of screen in 
some buffer and will be used by OnPaint() to repaint) . Up my screen completly 
washed whener I resized. I used BitBlt ( I created a compatibleDC and stored 
the current content of screen into that DC using BitBlt) . Then in WM_PAINT , I 
tried to restore the compatibleDC content with current screen content using 
BitBltagain. But didn't work.. Can anyone help me out ..
My code is..
  .386 
.model flat,stdcall 
option casemap:none 
include ..\masm32\include\windows.inc 
include ..\masm32\include\user32.inc 
includelib ..\masm32\lib\user32.lib            ; calls to functions in 
user32.lib and kernel32.lib 
include ..\masm32\include\kernel32.inc 
includelib ..\masm32\lib\kernel32.lib 
include ..\masm32\include\gdi32.inc 
includelib ..\masm32\lib\gdi32.lib 
WinMain proto :DWORD,:DWORD,:DWORD,:DWORD 
  .DATA                     ; initialized data 
ClassName db "SimpleWinClass",0        ; the name of our window class 
AppName db "Our First Window",0        ; the name of our window 
OurText  db "GopiKrishnaKomanduri!",0 
FontName db "script",0
regionupdate dword "true" ,0
stri dword "Gopi",0
verify dword "a",0
  
.const
IDC_EDIT        equ 3000 
  
.DATA?                ; Uninitialized data 
hInstance HINSTANCE ?        ; Instance handle of our program 
CommandLine LPSTR ? 
xvalue dword ?
yvalue dword ?
xtemp dword ?
ytemp dword ?
compatibledc HDC ?
memorydc HDC ?
  
.CODE                ; Here begins our code 
start: 
invoke GetModuleHandle, NULL            ; get the instance handle of our 
program. 
                                                                       ; Under 
Win32, hmodule==hinstance mov hInstance,eax 
mov hInstance,eax 
invoke GetCommandLine                        ; get the command line. You don't 
have to call this function IF 
                                                                       ; your 
program doesn't process the command line. 
mov CommandLine,eax 
invoke WinMain, hInstance,NULL,CommandLine, SW_SHOWDEFAULT        ; call the 
main function 
invoke ExitProcess, eax                           ; quit our program. The exit 
code is returned in eax from WinMain. 
  WinMain proc hInst:HINSTANCE,hPrevInst:HINSTANCE,CmdLine:LPSTR,CmdShow:DWORD 
    LOCAL wc:WNDCLASSEX                                            ; create 
local variables on stack 
    LOCAL msg:MSG 
    LOCAL hwnd:HWND 
      mov   wc.cbSize,SIZEOF WNDCLASSEX                   ; fill values in 
members of wc 
    mov   wc.style, CS_HREDRAW or CS_VREDRAW 
    mov   wc.lpfnWndProc, OFFSET WndProc 
    mov   wc.cbClsExtra,NULL 
    mov   wc.cbWndExtra,NULL 
    push  hInstance 
    pop   wc.hInstance 
    mov   wc.hbrBackground,COLOR_WINDOW+10 
    mov   wc.lpszMenuName,NULL 
    mov   wc.lpszClassName,OFFSET ClassName 
    invoke LoadIcon,NULL,IDI_APPLICATION 
    mov   wc.hIcon,eax 
    mov   wc.hIconSm,eax 
    invoke LoadCursor,NULL,IDC_ARROW 
    mov   wc.hCursor,eax 
    invoke RegisterClassEx, addr wc                       ; register our window 
class 
    invoke CreateWindowEx,NULL,\ 
                ADDR ClassName,\ 
                ADDR AppName,\ 
                WS_OVERLAPPEDWINDOW,\ 
                CW_USEDEFAULT,\ 
                CW_USEDEFAULT,\ 
                CW_USEDEFAULT,\ 
                CW_USEDEFAULT,\ 
                NULL,\ 
                NULL,\ 
                hInst,\ 
                NULL 
    mov   hwnd,eax 
    invoke ShowWindow, hwnd,CmdShow               ; display our window on 
desktop 
    invoke UpdateWindow, hwnd                                 ; refresh the 
client area 
      .WHILE TRUE                                                         ; 
Enter message loop 
                invoke GetMessage, ADDR msg,NULL,0,0 
                .BREAK .IF (!eax) 
                invoke TranslateMessage, ADDR msg 
                invoke DispatchMessage, ADDR msg 
   .ENDW 
    mov     eax,msg.wParam                                            ; return 
exit code in eax 
    ret 
WinMain endp 
  WndProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM 
 LOCAL hdc:HDC 
    LOCAL ps:PAINTSTRUCT 
    LOCAL rect:RECT 
    LOCAL brRed:HBRUSH
    LOCAL pt:POINT
    
 LOCAL hfont:HFONT
 RGB macro red,green,blue 
    xor    eax,eax 
    mov  ah,blue 
    shl     eax,8 
    mov  ah,green 
    mov  al,red 
     endm 
   
      .IF uMsg==WM_DESTROY                           ; if the user closes our 
window 
        invoke PostQuitMessage,NULL    
     .ELSEIF uMsg==WM_LBUTTONDOWN   
    ; invoke MessageBox,NULL,NULL,NULL,NULL    
       invoke GetDC,hWnd
        mov hdc,eax
        invoke GetCursorPos,ADDR pt
          mov eax,pt.x
        ADD eax,100
        mov xvalue,eax
        mov eax,pt.x
       
        mov xtemp,eax
        SUB xtemp,48
        mov eax,pt.y
        ADD eax,100
        mov yvalue,eax
        mov ytemp,eax
        SUB ytemp,48
       ; invoke MessageBox,NULL,ADDR xtemp,NULL,NULL
       invoke TextOut,hdc,pt.x,pt.y,ADDR stri,5
         ; invoke Rectangle,hdc,pt.x,pt.y,xvalue,yvalue
        invoke ReleaseDC,hWnd,hdc
  .ELSEIF uMsg==WM_PAINT
  invoke BeginPaint,hWnd, ADDR ps 
  mov memorydc,eax
  invoke BitBlt,memorydc,0,0,1000,1000,compatibledc,0, 0, SRCCOPY
  invoke MessageBox,NULL,ADDR verify,NULL,NULL
  ;BitBlt(dc.m_hDC,0,0,windowSize.right,windowSize.bo
;ttom,memoryDC,0,0,SRCCOPY);
    ;invoke InvalidateRect,hWnd,NULL,TRUE
    ;invoke UpdateWindow,hWnd
      .ELSEIF uMsg==WM_SIZE
      ; invoke MessageBox,NULL,NULL,NULL,NULL
       invoke CreateCompatibleDC,hWnd
       mov compatibledc,eax
    mov eax , "gopi"
   mov verify,"Gopi"
       invoke InvalidateRect,hWnd,NULL,TRUE
       ;invoke UpdateWindow,hWnd
       ;invoke SendMessage,hWnd,WM_PAINT,0,0
     .ELSE 
        invoke DefWindowProc,hWnd,uMsg,wParam,lParam     ; Default message 
processing 
        ret 
    .ENDIF 
    xor eax,eax 
    ret 
WndProc endp 
  
end start 
   
  


Tamas Marki <[EMAIL PROTECTED]> wrote:
          On 5/23/07, Gopi Krishna Komanduri <[EMAIL PROTECTED]> wrote:
> Hi All ,
> It is with respect to windows programming . sorry for posting wrongly . But I 
> strongly believe there will be atlest 1% windows programmers and don't want 
> to leave that chance.
>
> I have a small query from long time like , if I painted some thing on client 
> area and then when I resized , the those won't be there.. How to repaint all 
> that stuff? I know one thing is like when we call begin paint (), it will 
> take care.. But if I don't want to call that function (if I want to call that 
> function , I need to call in WM_SIZE command I think , am I correct ?) how to 
> achieve? I think one way is to call every pixel RGB value and store some 
> where and again call to refill but I couldn't implement
it..

Your window will receive a WM_PAINT message when it needs to be
redrawn, and you need to do the painting in that handler.

-- 
Tamas Marki


         

 
---------------------------------
Food fight? Enjoy some healthy debate
in the Yahoo! Answers Food & Drink Q&A.

[Non-text portions of this message have been removed]

Reply via email to