This is a window capture demo converted from a MASM source that I created a while back. While I did thoroughly test the MASM version, this version has seen only a minimal amount of testing, and there is no significant amount of error checking.
crosshair0.bas:
Code: Select all
'======================================================================
'' Simple crosshair cursor mask definitions, 32x32 only, hot spot at
'' 15, 15.
''
'' The system will AND the screen pixel bits with the AND mask and
'' XOR the result with the XOR mask. In truth table form:
''
'' AND mask XOR mask resulting screen bit
'' -------- -------- --------------------
'' 0 0 0
'' 0 1 1
'' 1 0 unchanged
'' 1 1 inverted
''
'' These masks will leave the cursor background unchanged and invert
'' the foreground.
'======================================================================
dim shared as ubyte cursorAndMask(0 to 4*32-1) = { _
&b11111111,&b11111111,&b11111111,&b11111111, _ '0
&b11111111,&b11111111,&b11111111,&b11111111, _ '1
&b11111111,&b11111111,&b11111111,&b11111111, _ '2
&b11111111,&b11111111,&b11111111,&b11111111, _ '3
&b11111111,&b11111111,&b11111111,&b11111111, _ '4
&b11111111,&b11111111,&b11111111,&b11111111, _ '5
&b11111111,&b11111111,&b11111111,&b11111111, _ '6
&b11111111,&b11111111,&b11111111,&b11111111, _ '7
&b11111111,&b11111111,&b11111111,&b11111111, _ '8
&b11111111,&b11111111,&b11111111,&b11111111, _ '9
&b11111111,&b11111111,&b11111111,&b11111111, _ '10
&b11111111,&b11111111,&b11111111,&b11111111, _ '11
&b11111111,&b11111111,&b11111111,&b11111111, _ '12
&b11111111,&b11111111,&b11111111,&b11111111, _ '13
&b11111111,&b11111111,&b11111111,&b11111111, _ '14
&b11111111,&b11111111,&b11111111,&b11111111, _ '15
&b11111111,&b11111111,&b11111111,&b11111111, _ '16
&b11111111,&b11111111,&b11111111,&b11111111, _ '17
&b11111111,&b11111111,&b11111111,&b11111111, _ '18
&b11111111,&b11111111,&b11111111,&b11111111, _ '19
&b11111111,&b11111111,&b11111111,&b11111111, _ '20
&b11111111,&b11111111,&b11111111,&b11111111, _ '21
&b11111111,&b11111111,&b11111111,&b11111111, _ '22
&b11111111,&b11111111,&b11111111,&b11111111, _ '23
&b11111111,&b11111111,&b11111111,&b11111111, _ '24
&b11111111,&b11111111,&b11111111,&b11111111, _ '25
&b11111111,&b11111111,&b11111111,&b11111111, _ '26
&b11111111,&b11111111,&b11111111,&b11111111, _ '27
&b11111111,&b11111111,&b11111111,&b11111111, _ '28
&b11111111,&b11111111,&b11111111,&b11111111, _ '39
&b11111111,&b11111111,&b11111111,&b11111111, _ '30
&b11111111,&b11111111,&b11111111,&b11111111 } '31
'======================================================================
dim shared as ubyte cursorXorMask(0 to 4*32-1) = { _
&b00000000,&b00000001,&b00000000,&b00000000, _ '0
&b00000000,&b00000001,&b00000000,&b00000000, _ '1
&b00000000,&b00000001,&b00000000,&b00000000, _ '2
&b00000000,&b00000001,&b00000000,&b00000000, _ '3
&b00000000,&b00000001,&b00000000,&b00000000, _ '4
&b00000000,&b00000001,&b00000000,&b00000000, _ '5
&b00000000,&b00000001,&b00000000,&b00000000, _ '6
&b00000000,&b00000001,&b00000000,&b00000000, _ '7
&b00000000,&b00000001,&b00000000,&b00000000, _ '8
&b00000000,&b00000001,&b00000000,&b00000000, _ '9
&b00000000,&b00000001,&b00000000,&b00000000, _ '10
&b00000000,&b00000001,&b00000000,&b00000000, _ '11
&b00000000,&b00000001,&b00000000,&b00000000, _ '12
&b00000000,&b00000000,&b00000000,&b00000000, _ '13
&b00000000,&b00000000,&b00000000,&b00000000, _ '14
&b11111111,&b11111000,&b00111111,&b11111110, _ '15
&b00000000,&b00000000,&b00000000,&b00000000, _ '16
&b00000000,&b00000000,&b00000000,&b00000000, _ '17
&b00000000,&b00000001,&b00000000,&b00000000, _ '18
&b00000000,&b00000001,&b00000000,&b00000000, _ '19
&b00000000,&b00000001,&b00000000,&b00000000, _ '20
&b00000000,&b00000001,&b00000000,&b00000000, _ '21
&b00000000,&b00000001,&b00000000,&b00000000, _ '22
&b00000000,&b00000001,&b00000000,&b00000000, _ '23
&b00000000,&b00000001,&b00000000,&b00000000, _ '24
&b00000000,&b00000001,&b00000000,&b00000000, _ '25
&b00000000,&b00000001,&b00000000,&b00000000, _ '26
&b00000000,&b00000001,&b00000000,&b00000000, _ '27
&b00000000,&b00000001,&b00000000,&b00000000, _ '28
&b00000000,&b00000001,&b00000000,&b00000000, _ '29
&b00000000,&b00000001,&b00000000,&b00000000, _ '30
&b00000000,&b00000000,&b00000000,&b00000000 } '31
'======================================================================
crosshair1.bas:
Code: Select all
'======================================================================
'' High-visibility crosshair cursor mask definitions, 32x32 only, hot
'' spot at 15, 15.
''
'' The system will AND the screen pixel bits with the AND mask and
'' XOR the result with the XOR mask. In truth table form:
''
'' AND mask XOR mask resulting screen bit
'' -------- -------- --------------------
'' 0 0 0
'' 0 1 1
'' 1 0 unchanged
'' 1 1 inverted
''
'======================================================================
dim shared as ubyte cursorAndMask(0 to 4*32-1) = { _
&b11111111,&b11111100,&b01111111,&b11111111, _ '0
&b11111111,&b11111100,&b01111111,&b11111111, _ '1
&b11111111,&b11111100,&b01111111,&b11111111, _ '2
&b11111111,&b11111100,&b01111111,&b11111111, _ '3
&b11111111,&b11111100,&b01111111,&b11111111, _ '4
&b11111111,&b11111100,&b01111111,&b11111111, _ '5
&b11111111,&b11111100,&b01111111,&b11111111, _ '6
&b11111111,&b11111100,&b01111111,&b11111111, _ '7
&b11111111,&b11111100,&b01111111,&b11111111, _ '8
&b11111111,&b11111100,&b01111111,&b11111111, _ '9
&b11111111,&b11111100,&b01111111,&b11111111, _ '10
&b11111111,&b11111100,&b01111111,&b11111111, _ '11
&b11111111,&b11111111,&b11111111,&b11111111, _ '12
&b11111111,&b11111111,&b11111111,&b11111111, _ '13
&b00000000,&b00001111,&b11100000,&b00000001, _ '14
&b00000000,&b00001111,&b11100000,&b00000001, _ '15
&b00000000,&b00001111,&b11100000,&b00000001, _ '16
&b11111111,&b11111111,&b11111111,&b11111111, _ '17
&b11111111,&b11111111,&b11111111,&b11111111, _ '18
&b11111111,&b11111100,&b01111111,&b11111111, _ '19
&b11111111,&b11111100,&b01111111,&b11111111, _ '20
&b11111111,&b11111100,&b01111111,&b11111111, _ '21
&b11111111,&b11111100,&b01111111,&b11111111, _ '22
&b11111111,&b11111100,&b01111111,&b11111111, _ '23
&b11111111,&b11111100,&b01111111,&b11111111, _ '24
&b11111111,&b11111100,&b01111111,&b11111111, _ '25
&b11111111,&b11111100,&b01111111,&b11111111, _ '26
&b11111111,&b11111100,&b01111111,&b11111111, _ '27
&b11111111,&b11111100,&b01111111,&b11111111, _ '28
&b11111111,&b11111100,&b01111111,&b11111111, _ '39
&b11111111,&b11111100,&b01111111,&b11111111, _ '30
&b11111111,&b11111111,&b11111111,&b11111111 } '31
'======================================================================
dim shared as ubyte cursorXorMask(0 to 4*32-1) = { _
&b00000000,&b00001111,&b11100000,&b00000000, _ '0
&b00000000,&b00001111,&b11100000,&b00000000, _ '1
&b00000000,&b00001111,&b11100000,&b00000000, _ '2
&b00000000,&b00001111,&b11100000,&b00000000, _ '3
&b00000000,&b00001111,&b11100000,&b00000000, _ '4
&b00000000,&b00001111,&b11100000,&b00000000, _ '5
&b00000000,&b00001111,&b11100000,&b00000000, _ '6
&b00000000,&b00001111,&b11100000,&b00000000, _ '7
&b00000000,&b00001111,&b11100000,&b00000000, _ '8
&b00000000,&b00001111,&b11100000,&b00000000, _ '9
&b00000000,&b00001111,&b11100000,&b00000000, _ '10
&b00000000,&b00001111,&b11100000,&b00000000, _ '11
&b11111111,&b11110000,&b00011111,&b11111110, _ '12
&b11111111,&b11110000,&b00011111,&b11111110, _ '13
&b11111111,&b11110000,&b00011111,&b11111110, _ '14
&b11111111,&b11110000,&b00011111,&b11111110, _ '15
&b11111111,&b11110000,&b00011111,&b11111110, _ '16
&b11111111,&b11110000,&b00011111,&b11111110, _ '17
&b11111111,&b11110000,&b00011111,&b11111110, _ '18
&b00000000,&b00001111,&b11100000,&b00000000, _ '19
&b00000000,&b00001111,&b11100000,&b00000000, _ '20
&b00000000,&b00001111,&b11100000,&b00000000, _ '21
&b00000000,&b00001111,&b11100000,&b00000000, _ '22
&b00000000,&b00001111,&b11100000,&b00000000, _ '23
&b00000000,&b00001111,&b11100000,&b00000000, _ '24
&b00000000,&b00001111,&b11100000,&b00000000, _ '25
&b00000000,&b00001111,&b11100000,&b00000000, _ '26
&b00000000,&b00001111,&b11100000,&b00000000, _ '27
&b00000000,&b00001111,&b11100000,&b00000000, _ '28
&b00000000,&b00001111,&b11100000,&b00000000, _ '29
&b00000000,&b00001111,&b11100000,&b00000000, _ '30
&b00000000,&b00000000,&b00000000,&b00000000 } '31
'======================================================================
createbmpfile.bas:
Code: Select all
'=========================================================================
#include once "windows.bi"
'=========================================================================
'------------------------------------------------------------------
'' This function creates a DIB from a DDB and stores it in a file,
'' or fails if the bits per pixel (bpp) for the DDB is not 4, 8,
'' 16, 24, or 32, or if the bpp for the DIB, specified in bppDib,
'' is not 4, 8, or 24. There is no error checking.
'------------------------------------------------------------------
function CreateBMPFile( byval hbmp as HBITMAP, _
byval bppDib as integer, _
byref filename as string ) as integer
dim as integer i, clrUsed
dim as any ptr pbmp
dim as HANDLE hFile, hHeap
dim as HDC hdcScreen
dim as BITMAPINFO ptr pbmi
dim as BITMAPFILEHEADER hdr
hHeap = GetProcessHeap
hdcScreen = GetDC( null )
'----------------------------------------------
'' Allocate memory for a BITMAPINFO structure.
'----------------------------------------------
pbmi = HeapAlloc( hHeap, HEAP_ZERO_MEMORY, sizeof(BITMAPINFO) )
'------------------------------------------------
'' Set the biSize member of the BITMAPINFOHEADER
'' structure to the size of the structure.
'------------------------------------------------
pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER)
'---------------------------------------------------------
'' Call the GetDIBits function with the lpvBits parameter
'' set to NULL, so the function will pass the dimensions
'' and format of the bitmap to the BITMAPINFO structure.
'---------------------------------------------------------
GetDIBits( hdcScreen, hbmp, 0, 0, null, pbmi, DIB_RGB_COLORS )
'---------------------------------------------------
'' Fail if the input bpp is not 4, 8, 16, 24 or 32.
'---------------------------------------------------
select case pbmi->bmiHeader.biBitCount
case 4, 8, 16, 24, 32
case else
HeapFree( hHeap, 0, pbmi )
return false
end select
'-------------------------------------------------------------
'' Set the output bpp, or fail if the bpp is not 4, 8, or 24.
'-------------------------------------------------------------
select case bppDib
case 4, 8, 24
pbmi->bmiHeader.biBitCount = bppDib
case else
HeapFree( hHeap, 0, pbmi )
return false
end select
'---------------------------------------------------------------
'' For 4 or 8 bpp, reallocate the memory to allow space for the
'' color table (RGBQUAD array).
''
'' The HeapReAlloc function, when reallocating a memory block
'' to a larger size, even with the HEAP_ZERO_MEMORY flag, will
'' preserve the contents of the original block.
'---------------------------------------------------------------
select case bppDib
case 4
pbmi = HeapReAlloc( hHeap, HEAP_ZERO_MEMORY, pbmi, _
sizeof(BITMAPINFO) + 16 * sizeof(RGBQUAD) )
case 8
pbmi = HeapReAlloc( hHeap, HEAP_ZERO_MEMORY, pbmi, _
sizeof(BITMAPINFO) + 256 * sizeof(RGBQUAD) )
end select
'--------------------------------------------------------------------
'' Assume the bitmap will not be compressed and set the BI_RGB flag.
'--------------------------------------------------------------------
pbmi->bmiHeader.biCompression = BI_RGB
'--------------------------------------------------------------
'' Calc the number of bytes for the bitmap image and store the
'' result in the biSizeImage member. The scan lines must be
'' DWORD aligned, so the width in bits must be adjusted to a
'' multiple of 32 by adding 31 and then clearing the lower 5
'' bits.
'--------------------------------------------------------------
i = pbmi->bmiHeader.biBitCount * pbmi->bmiHeader.biWidth
i += 31
i and= (not 31)
i shr= 3
pbmi->bmiHeader.biSizeImage = i * pbmi->bmiHeader.biHeight
'----------------------------------------------------------------
'' Calc the horizontal and vertical resolution for the screen in
'' pixels per meter and store the results in the biXPelsPerMeter
'' and biYPelsPerMeter members. For index values LOGPIXELSX and
'' LOGPIXELSY the GetDeviceCaps function returns the resolution
'' in pixels per logical inch.
'----------------------------------------------------------------
i = GetDeviceCaps( hdcScreen, LOGPIXELSX )
pbmi->bmiHeader.biXPelsPerMeter = i * 39370 \ 1000
i = GetDeviceCaps( hdcScreen, LOGPIXELSY )
pbmi->bmiHeader.biYPelsPerMeter = i * 39370 \ 1000
'-------------------------------------------------
'' For 4 or 8 bpp set the biClrUsed member to the
'' correct value, otherwise leave it set to 0.
'-------------------------------------------------
select case pbmi->bmiHeader.biBitCount
case 4
pbmi->bmiHeader.biClrUsed = 16
case 8
pbmi->bmiHeader.biClrUsed = 256
end select
'-------------------------------------------------
'' Set the biClrImportant member to 0, indicating
'' that all of the device colors are important.
'-------------------------------------------------
pbmi->bmiHeader.biClrImportant = 0
'------------------------------------------------
'' Allocate a buffer to receive the bitmap data.
'------------------------------------------------
pbmp = HeapAlloc( hHeap, HEAP_ZERO_MEMORY, _
pbmi->bmiHeader.biSizeImage )
'---------------------------------------------------------------
'' Call the GetDIBits function to retrieve the bitmap bits from
'' the DDB and store them, and the synthesized color table, if
'' present, in the buffer.
''
'' The biClrUsed member of the BITMAPINFOHEADER structure must
'' be preserved around the call to prevent the function from
'' setting it to 0.
'---------------------------------------------------------------
clrUsed = pbmi->bmiHeader.biClrUsed
GetDIBits( hdcScreen, hbmp, 0, pbmi->bmiHeader.biHeight, _
pbmp, pbmi, DIB_RGB_COLORS )
pbmi->bmiHeader.biClrUsed = clrUsed
'-------------------
'' Create the file.
'-------------------
hFile = CreateFile( filename, GENERIC_READ or GENERIC_WRITE, _
0, null, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, _
null )
'-----------------------------------------------------
'' Calculate the size of the file and initialize the
'' members of the BITMAPFILEHEADER.
''
'' The bfType member must be 'BM' as stored in memory.
'-----------------------------------------------------
i = pbmi->bmiHeader.biClrUsed * sizeof(RGBQUAD)
i += sizeof(BITMAPFILEHEADER)
i += pbmi->bmiHeader.biSize
hdr.bfOffBits = i
i += pbmi->bmiHeader.biSizeImage
hdr.bfType = &h4d42
hdr.bfSize = i
'-----------------------------------------------------
'' Copy the BITMAPFILEHEADER structure into the file.
'-----------------------------------------------------
WriteFile( hFile, @hdr, sizeof(BITMAPFILEHEADER), @i, null )
'-------------------------------------------------------------
'' Copy the BITMAPINFOHEADER structure and the RGBQUAD array,
'' if present, into the file.
'-------------------------------------------------------------
i = pbmi->bmiHeader.biClrUsed * sizeof(RGBQUAD)
i += sizeof(BITMAPINFOHEADER)
WriteFile( hFile, pbmi, i, @i, null )
'--------------------------------------
'' Copy the bitmap bits into the file.
'--------------------------------------
WriteFile( hFile, pbmp, pbmi->bmiHeader.biSizeImage, @i, null )
'------------
'' Clean up.
'------------
ReleaseDC( null, hdcScreen )
HeapFree( hHeap, 0, pbmi )
HeapFree( hHeap, 0, pbmp )
CloseHandle( hFile )
return true
end function
capture.bas:
Code: Select all
'=========================================================================
'' Minimal window capture demo, modal dialog as main.
''
'' With the mouse cursor in the client area, press and hold the left
'' mouse button, drag the cursor to the target window, then release
'' the button.
'=========================================================================
#include "dialogs.bas"
#include "createbmpfile.bas"
#include "crosshair1.bas"
'=========================================================================
function DialogProc( byval hDlg as HWND, _
byval uMsg as UINT, _
byval wParam as WPARAM, _
byval lParam as LPARAM ) as integer
dim as HDC hdcScreen, hdcWnd, hdcBM
dim as HWND hwndTarget
dim as integer wd, ht
dim as HBITMAP hbmp
dim as RECT rc
dim as POINT pt
static as HCURSOR hCursor
select case uMsg
case WM_INITDIALOG
'------------------------------------------------------
'' If the system cursor size is 32x32 (likely), create
'' our crosshair custom cursor and save the handle.
'------------------------------------------------------
if GetSystemMetrics( SM_CXCURSOR ) = 32 and _
GetSystemMetrics( SM_CYCURSOR ) = 32 then
hCursor = CreateCursor( GetModuleHandle( null ), _
15, 15, 32, 32, _
@cursorAndMask(0), _
@cursorXorMask(0) )
end if
case WM_LBUTTONDOWN
'----------------------------------------------------------
'' If we have a custom cursor, make it the current cursor.
'----------------------------------------------------------
if hCursor then
SetCursor( hCursor )
end if
'---------------------
'' Capture the mouse.
'---------------------
SetCapture( hDlg )
case WM_LBUTTONUP
'------------------------------------------------------------
'' Get the client coordinates of the cursor and save them in
'' our POINT structure. The 16-bit coordinate values must be
'' sign extended to 32 bits because client coordinates to the
'' left of and/or above the client area are negative.
'------------------------------------------------------------
asm
mov eax, [lParam]
movsx eax, ax
mov [pt], eax
mov eax, [lParam]
shr eax, 16
movsx eax, ax
mov [pt+4], eax
end asm
'--------------------------------------------------------
'' Convert the client coordinates to screen coordinates.
'--------------------------------------------------------
ClientToScreen( hDlg, @pt )
'---------------------------------------------------
'' Get the handle of the window beneath the cursor.
'---------------------------------------------------
hwndTarget = WindowFromPoint( pt )
'--------------------------------------------
'' Remove our custom cursor from the screen.
'--------------------------------------------
SetCursor( null )
'-----------------------------
'' Release the mouse capture.
'-----------------------------
ReleaseCapture()
'-----------------------------------------------------
'' Bring the target window to the top of the Z-order.
'-----------------------------------------------------
SetForegroundWindow( hwndTarget )
'---------------------------------------
'' Get a DC for the screen and create a
'' compatible memory DC for the bitmap.
'---------------------------------------
hdcScreen = GetDC( null )
hdcBM = CreateCompatibleDC( hdcScreen )
'----------------------------------------------
'' Get the dimensions of the target window and
'' calculate the bitmap width and height.
'----------------------------------------------
GetWindowRect( hwndTarget, @rc )
wd = rc.right - rc.left
ht = rc.bottom - rc.top
'--------------------------------------------------
'' Create a compatible bitmap to store the window
'' and select it into the memory DC.
'--------------------------------------------------
hbmp = CreateCompatibleBitmap( hdcScreen, wd, ht )
SelectObject( hdcBM, hbmp )
'----------------------------------
'' Get a DC for the target window.
'----------------------------------
hdcWnd = GetWindowDC( hwndTarget )
'---------------------------------
'' Copy the window to the bitmap.
'---------------------------------
BitBlt( hdcBM, 0, 0, wd, ht, hdcWnd, 0, 0, SRCCOPY )
'-----------------------------
'' Copy the bitmap to a file.
'-----------------------------
CreateBmpFile( hbmp, 24, "cap.bmp" )
'------------
'' Clean up.
'------------
DeleteObject( hbmp )
DeleteDC( hdcBM )
ReleaseDC( null, hdcScreen )
ReleaseDC( null, hdcWnd )
case WM_COMMAND
if loword(wParam) = IDCANCEL then
DestroyCursor( hCursor )
EndDialog( hDlg, null )
end if
case WM_CLOSE
DestroyCursor( hCursor )
EndDialog( hDlg, null )
end select
return 0
end function
'====================================================================
dim as LPDLGTEMPLATE lpdt
Dialog( 0, 0, 0, 90, 30, "Window Capture Demo", lpdt, _
WS_OVERLAPPED or WS_SYSMENU or DS_CENTER )
CreateModalDialog( 0, @DialogProc, 0, lpdt )
'====================================================================
And another related example:
Code: Select all
'====================================================================
'' Minimal desktop window capture demo, modal dialog as main.
'====================================================================
#include "dialogs.bas"
#include "createbmpfile.bas"
'====================================================================
function DialogProc( byval hDlg as HWND, _
byval uMsg as UINT, _
byval wParam as WPARAM, _
byval lParam as LPARAM ) as integer
dim as HWND hwndDesktop
dim as HDC hdcScreen, hdcDesktopWindow, hdcBM
dim as HBITMAP hbmp
dim as RECT rc
dim as integer wd, ht
select case uMsg
case WM_INITDIALOG
''----------------------------------------
'' Get the handle for the desktop window.
''----------------------------------------
hwndDesktop = GetDesktopWindow()
'---------------------------------------
'' Get a DC for the screen and create a
'' compatible memory DC for the bitmap.
'---------------------------------------
hdcScreen = GetDC( null )
hdcBM = CreateCompatibleDC( hdcScreen )
'-----------------------------------------------
'' Get the dimensions of the desktop window and
'' calculate the bitmap width and height.
'-----------------------------------------------
GetWindowRect( hwndDesktop, @rc )
wd = rc.right - rc.left
ht = rc.bottom - rc.top
'--------------------------------------------------
'' Create a compatible bitmap to store the desktop
'' window and select it into the memory DC. We have
'' no need to save the handle to the object being
'' replaced (returned by SelectObject) because we
'' will be destroying the memory DC when we have
'' finished using it.
'--------------------------------------------------
hbmp = CreateCompatibleBitmap( hdcScreen, wd, ht )
SelectObject( hdcBM, hbmp )
'-----------------------------------
'' Get a DC for the desktop window.
'-----------------------------------
hdcDesktopWindow = GetWindowDC( hwndDesktop )
'---------------------------------
'' Copy the window to the bitmap.
'---------------------------------
BitBlt( hdcBM, 0, 0, wd, ht, hdcDesktopWindow, 0, 0, SRCCOPY )
'-----------------------------
'' Copy the bitmap to a file.
'-----------------------------
CreateBmpFile( hbmp, 24, "cap.bmp" )
'------------
'' Clean up.
'------------
DeleteObject( hbmp )
DeleteDC( hdcBM )
ReleaseDC( null, hdcScreen )
ReleaseDC( null, hdcDesktopWindow )
'---------------------------------------------------------
'' Destroy our dialog. Since the WM_INITDIALOG message is
'' sent before the dialog is displayed, the dialog is
'' destroyed before it is displayed.
'---------------------------------------------------------
EndDialog( hDlg, null )
end select
return 0
end function
'====================================================================
dim as LPDLGTEMPLATE lpdt
Dialog( 0, 0, 0, 90, 30, "Window Capture Demo", lpdt, _
WS_OVERLAPPED or WS_SYSMENU or DS_CENTER )
CreateModalDialog( 0, @DialogProc, 0, lpdt )
'====================================================================