Freeze screen display in Win '95 
Author Message
 Freeze screen display in Win '95

Folks,

I'm reduced to using SendKeys to manipulate a (very poorly written)
16-bit app. The idea here is to carry out a looooong series of
operations that involve opening and closing three to four separate
dialogs.

Works fine, but looks like hell onscreen because of all the boxes
opening and closing.

Is there a way to freeze the screen display so the user never sees the
dialogs opening and closing and is only presented with the end result?

TIA . . .
Chuck Chiavarini

=========================================================
*** You can't close the door when the wall's caved in ***
=========================================================



Wed, 07 Feb 2001 03:00:00 GMT  
 Freeze screen display in Win '95

Quote:

> Is there a way to freeze the screen display so the user never sees the
> dialogs opening and closing and is only presented with the end result?

The following may help you out.  Call HideDesktop to freeze the
current display, and UnhideDesktop to restore the display.  This
should work assuming none of the windows that get created are OnTop
windows.

'-----------------------------------------------
' Make the following part of a standard module

Public Const HWND_DESKTOP = 0
Public Const HWND_TOPMOST = -1
Public Const SWP_NOACTIVATE = &H10
Public Const SWP_SHOWWINDOW = &H40
Public Const SRCCOPY = &HCC0020

Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, _
        ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, _
        ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc _
        As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Declare Function CreateCompatibleBitmap Lib "gdi32" (ByVal hdc As _
        Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long
Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hdc As Long) As Long
Declare Function DeleteDC Lib "gdi32" (ByVal hdc As Long) As Long
Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, _
        ByVal hdc As Long) As Long
Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, _
        ByVal hObject As Long) As Long
Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal _
        hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, _
        ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long

Public Sub HideDesktop()

  Load frmHideDesktop

  Dim RemoteDC As Long
  Dim RemoteBitmap As Long
  Dim DeskDC As Long

  DeskDC = GetDC(HWND_DESKTOP)

  RemoteDC = CreateCompatibleDC(DeskDC)
  RemoteBitmap = CreateCompatibleBitmap(DeskDC, _
                  Screen.Width / Screen.TwipsPerPixelX, _
                  Screen.Height / Screen.TwipsPerPixelY)

  SelectObject RemoteDC, RemoteBitmap

  BitBlt RemoteDC, 0, 0, Screen.Width / Screen.TwipsPerPixelX, _
                         Screen.Height / Screen.TwipsPerPixelY, _
                         DeskDC, 0, 0, SRCCOPY

  ReleaseDC HWND_DESKTOP, DeskDC

  frmHideDesktop.RemoteDC = RemoteDC
  frmHideDesktop.RemoteBitmap = RemoteBitmap
  frmHideDesktop.RemoteDCInit = True

  SetWindowPos frmHideDesktop.hwnd, HWND_TOPMOST, 0, 0, _
            Screen.Width / Screen.TwipsPerPixelX, _
            Screen.Height / Screen.TwipsPerPixelY, _
            SWP_NOACTIVATE

  BitBlt frmHideDesktop.hdc, 0, 0, Screen.Width / Screen.TwipsPerPixelX, _
        Screen.Height / Screen.TwipsPerPixelY, RemoteDC, 0, 0, SRCCOPY

  SetWindowPos frmHideDesktop.hwnd, HWND_TOPMOST, 0, 0, _
            Screen.Width / Screen.TwipsPerPixelX, _
            Screen.Height / Screen.TwipsPerPixelY, _
            SWP_NOACTIVATE Or SWP_SHOWWINDOW

End Sub

Public Sub UnhideDesktop()
  Unload frmHideDesktop
End Sub
'-----------------------------------------------

'-----------------------------------------------
' Make the following part of a form, named frmHideDesktop, with the
' following properties:
'
'   Appearance: Flat
'   AutoRedraw: True
'   Border Style: None
'   Caption: "" (blank)
'   Control box: False

Public RemoteDC As Long
Public RemoteDCInit As Boolean
Public RemoteBitmap As Long

Private Sub Form_DblClick()
  Unload Me
End Sub

Private Sub Form_Initialize()
  RemoteDCInit = False
End Sub

Private Sub Form_Paint()
  If RemoteDCInit Then
    BitBlt Me.hdc, 0, 0, Screen.Width / Screen.TwipsPerPixelX, _
           Screen.Height / Screen.TwipsPerPixelY, RemoteDC, 0, 0, SRCCOPY
  End If
End Sub

Private Sub Form_Unload(Cancel As Integer)
  If RemoteDCInit Then
    DeleteObject RemoteBitmap
    DeleteDC RemoteDC
    RemoteDCInit = False
  End If
End Sub
'-----------------------------------------------

--
-- Scott Seligman                  will hack perl for knowledge



Thu, 08 Feb 2001 03:00:00 GMT  
 Freeze screen display in Win '95
Seems like a lot of work.  Would this help?

-------------------------------- SNIP --------------------------------
Private Declare Function LockWindowUpdate Lib "user32" _
    (ByVal hwndLock As Long) As Long
Private Declare Function GetDesktopWindow Lib "user32" () As Long

Sub FreezeScreen(ByVal yn As Boolean)
    Dim Handle As Long

    If yn Then
        Handle = GetDesktopWindow
    Else
        Handle = 0
    End If
    LockWindowUpdate Handle
End Sub
-------------------------------- SNIP --------------------------------

Call "FreezeScreen True" before then "FreezeScreen False" after.

--
       ----------------------------------------------------------------
 ____  Bulk mailers, please review     |
| __|| US Code Title 47, Sec.227(a)(2) | Mark Kintigh

 \\//  (b)(3)(C) -- stop breaking the  | http://www.westol.com/~breetai
  \/   law!                            |
       ----------------------------------------------------------------



Fri, 16 Feb 2001 03:00:00 GMT  
 Freeze screen display in Win '95

That does the trick BEAUTIFULLY. Thank you kindly!
(And, yes, the original suggestion was a lot of work.)



** Snip **

Chuck Chiavarini

=========================================================
*** You can't close the door when the wall's caved in ***
=========================================================



Fri, 16 Feb 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Win '95 kills VB Screen Saver Compiles?

2. Changing win'95 display setting from VB5

3. Vb thunder Cooltips don't display on Win 95 machine

4. Q: Config of Win '95/Win NT Task Bar via VB4

5. Splash screen won't display unless modal

6. Screen Saver Passwords in Win 95

7. VB 4/Win 95 screen saver question

8. VB4.0a 16 Bit Applications and Win 95 Screen Size

9. Help with Win 95 screen saver command line - command line.zip [1/1]

10. Screen Saver with WIN 95?

11. Win 95 password protected screen saver.

12. ??? Display icon in win 95 task bar???

 

 
Powered by phpBB® Forum Software