home *** CD-ROM | disk | FTP | other *** search
/ Reverse Code Engineering RCE CD +sandman 2000 / ReverseCodeEngineeringRceCdsandman2000.iso / RCE / LordLucifer / win32asm / files / win32asm.exe / Win32ASM / Win32Proto / W32PStatBar.asm < prev    next >
Encoding:
Assembly Source File  |  1997-11-10  |  4.1 KB  |  134 lines

  1.     Page 60,190
  2.     TITLE W32PStatBar - Windows 95 prototype - Status bar handling.
  3.  
  4.                 .586
  5.                 .MODEL FLAT,STDCALL
  6.  
  7.                 .NOLISTMACRO
  8.                 .NOLIST
  9.  
  10. UniCode         = 0
  11.                 INCLUDE INSTR32.MAC
  12.                 INCLUDE WIN32INC.EQU
  13.  
  14.                 INCLUDE WIN32RES.EQU
  15.  
  16.                 INCLUDE COMCTL32.EQU
  17.                 INCLUDE USER32.EQU
  18.  
  19.                 INCLUDE W32PROTO.EQU
  20.                 .LIST
  21.  
  22. ; External references.
  23.  
  24. ErrorBox PROTO lpszErrorMsg:DWORD
  25.  
  26.     PAGE
  27. ; ==================================================================
  28. ; Global Data section.
  29. ; ==================================================================
  30.  
  31.     .DATA
  32.  
  33. Parts     DWORD SBPARTS DUP(0)          ;Parts array.
  34. hWndStatB DWORD 0                       ;Status bar handle.
  35.  
  36.     .CODE
  37.  
  38. ; ==========================================================================
  39. ; Create the status bar.
  40. ; On entry,
  41. ;   ECX = main window handle,
  42. ;   EDX = this process handle.
  43. ; On exit,
  44. ;   EAX undefined,
  45. ;   other registers unchanged.
  46. ; ==========================================================================
  47.  
  48.     .CONST
  49.  
  50. ErrorStatB BYTE 'Could not create status bar',0
  51.  
  52.  
  53.     .CODE
  54.  
  55. SBCreate PROTO hWnd:DWORD
  56. SBCreate PROC PUBLIC USES EBX EDI ESI,
  57.            hWnd:DWORD
  58.  
  59.     INVOKE CreateStatusWindow,          ;Create status bar. describe style,
  60.              WS_CHILD or WS_BORDER or WS_VISIBLE or SBS_SIZEGRIP,
  61.              0,                         ;no name in first part,
  62.              hWnd,                      ;parent window handle,
  63.              IDXX_STATUSBAR             ;Status bar control identifier.
  64.     MOV hWndStatB,EAX                   ;save the handle to statusbar
  65.  
  66.       .IF EAX == 0                      ;If create failed,
  67.       INVOKE ErrorBox,                  ;give error,
  68.                OFFSET ErrorStatB
  69.       XOR EAX,EAX                       ;set return reg back to zero.
  70.       .ENDIF
  71.     RET
  72.  
  73. SBCreate ENDP
  74.  
  75.  
  76. SBResize PROTO lParam:DWORD
  77. SBResize PROC PUBLIC lParam:DWORD
  78.  
  79.       .IF hWndStatB != 0                ;If we have a status handle,
  80.       XOR EBX,EBX                       ;ebx = loword(lparam) = width
  81.       MOV BX,WORD PTR lParam
  82.       XOR EAX,EAX                       ;eax = hiword(lparam) = height
  83.       MOV AX,WORD PTR lParam+2
  84.  
  85.       INVOKE MoveWindow,                ;adjust window
  86.                hWndStatB,               ;handle to status bar,
  87.                0,                       ;x
  88.                EAX,                     ;y
  89.                EBX,                     ;width,
  90.                EAX,                     ;height,
  91.                TRUE                     ;set repaint flag.
  92.  
  93.       XOR EAX,EAX
  94.       MOV AX,WORD PTR lParam            ;get width
  95.  
  96.       SHR EAX,2                         ;/4
  97.       MOV ECX,EAX                       ;save factor
  98.       MOV Parts+0,EAX                   ;make part 1 1/4 the width
  99.       ADD EAX,ECX
  100.       MOV Parts+4,EAX                   ;and also part2, .. etc
  101.       ADD EAX,ECX
  102.       MOV Parts+8,EAX
  103.       MOV Parts+12,-1                   ;the last part extends to the end
  104.  
  105.       INVOKE SendMessage,               ;set the sections in the statusbar
  106.                hWndStatB,
  107.                SB_SETPARTS,
  108.                SBPARTS,
  109.                OFFSET Parts
  110.  
  111.       .ENDIF
  112.     RET
  113. SBResize ENDP
  114.  
  115. ; ==========================================================================
  116. ; Display a message on the status bar.
  117. ; ==========================================================================
  118.  
  119. SBDisplay PROTO uSBPart:DWORD,lpszMsg:DWORD
  120.  
  121. SBDisplay PROC PUBLIC uSBPart:DWORD,
  122.             lpszMsg:DWORD
  123.  
  124.       .IF hWndStatB                     ;If we have a status bar,
  125.       INVOKE SendMessage,               ;Send a message
  126.                hWndStatB,               ;to the status bar
  127.                SB_SETTEXT,              ;display text there
  128.                uSBPart,                 ;status bar section
  129.                lpszMsg                  ;Message to display.
  130.       .ENDIF
  131.     RET
  132. SBDisplay ENDP
  133.     END
  134.