That's probably because Access 2.0 was 16 bit, and Access 97 is 32 bit. All
of the APIs changed in the move from 16 bit to 32 bit.
The biggest change is that virtually all Integer declarations need to be
changed to Long. Having said that, though, it's possible that some of the
specific functions got changed with the migration (sorry, but it's been too
long since I've done these sorts of conversions, and I don't remember
whether any of your declarations fall into that category)
Start with the following KB articles:
http://msdn.microsoft.com/library/te...n_acc97con.htm http://msdn.microsoft.com/library/te...n_32bitapi.htm
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
"MLH" <CRCI@NorthState.net> wrote in message
news:pnuv51dsmnm9op7cdl1a19bnkuo9se4kp8@4ax.com...[color=blue]
> Here is the code. I got it off the MicroSoft
> site (for Access 2.0) and modified a few lines
> per recommendation of some of you in this
> newsgroup. This code runs fine in Access 2.0,
> but not at all in Access 97.
> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxx
>
>
> Option Compare Database 'Use database order for string comparisons
> Option Explicit
>
> Type RECT_Type
> left As Integer
> top As Integer
> right As Integer
> bottom As Integer
> End Type
>
> Declare Function GetActiveWindow% Lib "User" ()
> Declare Function GetDesktopWindow% Lib "User" ()
> Declare Sub GetWindowRect Lib "User" (ByVal Hwnd%, lpRect As
> RECT_Type)
> Declare Function GetDC% Lib "User" (ByVal Hwnd%)
> Declare Function CreateCompatibleDC% Lib "GDI" (ByVal hdc%)
> Declare Function CreateCompatibleBitmap% Lib "GDI" (ByVal hdc%,
> ByVal nWidth%, ByVal nHeight%)
> Declare Function SelectObject% Lib "GDI" (ByVal hdc%, ByVal
> hObject%)
> Declare Function BitBlt% Lib "GDI" (ByVal hDestDC%, ByVal X%, ByVal
> Y%, ByVal nWidth%, ByVal nHeight%, ByVal hSrcDC%, ByVal XSrc%, ByVal
> YSrc%, ByVal dwRop&)
> Declare Function OpenClipboard% Lib "User" (ByVal Hwnd%)
> Declare Function EmptyClipboard% Lib "User" ()
> Declare Function SetClipboardData% Lib "User" (ByVal wFormat%,
> ByVal hMem%)
> Declare Function CloseClipboard% Lib "User" ()
> Declare Function ReleaseDC% Lib "User" (ByVal Hwnd%, ByVal hdc%)
> Declare Function DeleteDC% Lib "GDI" (ByVal hdc%)
>
> Global Const SRCCOPY = &HCC0020
> Global Const CF_BITMAP = 2
>
> Function ScreenDump()
> '*******************************************
> ' Activate by pressing CTRL-W
> '*******************************************
> Dim Msg As String, Title As String, Defvalue As String, Answer As
> String, Work As String, CurrentType As Integer
> CurrentType = Application.CurrentObjectType
> Work = " "
> Msg = "Whole (S)creen or just the (W)indow?" ' Set
> prompt.
> Msg = Msg & Work & " (CTRL-W activates)" ' Set
> prompt.
> Title = "InputBox Demo" ' Set
> title.
> Defvalue = "W" ' Set
> default return value.
> Answer = InputBox(Msg, Title, Defvalue) ' Get
> user input.
>
> Dim AccessHwnd%, DeskHwnd%
> Dim hdc%
> Dim hdcMem%
> Dim rect As RECT_Type
> Dim junk%
> Dim fwidth%, fheight%
> Dim hBitmap%
>
> DoCmd.Hourglass True
>
> '---------------------------------------------------
> ' Get window handle to Windows and Microsoft Access
> '---------------------------------------------------
> DeskHwnd = GetDesktopWindow()
> If Answer = "S" Then
> AccessHwnd = GetActiveWindow()
> Else
> Select Case CurrentType
> Case A_FORM
> AccessHwnd = Screen.ActiveForm.Hwnd
> Case A_REPORT
> AccessHwnd = Screen.ActiveReport.Hwnd
> Case Else
> MsgBox "Gotta be a form or a report."
> Exit Function
> End Select
>
> End If
>
> '---------------------------------------------------
> ' Get screen coordinates of Microsoft Access
> '---------------------------------------------------
> Call GetWindowRect(AccessHwnd, rect)
> fwidth = rect.right - rect.left
> fheight = rect.bottom - rect.top
>
> '---------------------------------------------------
> ' Get the device context of Desktop and allocate memory
> '---------------------------------------------------
> hdc = GetDC(DeskHwnd)
> hdcMem = CreateCompatibleDC(hdc)
> hBitmap = CreateCompatibleBitmap(hdc, fwidth, fheight)
>
> If hBitmap <> 0 Then
> junk = SelectObject(hdcMem, hBitmap)
>
> '---------------------------------------------
> ' Copy the Desktop bitmap to memory location
> ' based on Microsoft Access coordinates.
> '---------------------------------------------
> junk = BitBlt(hdcMem, 0, 0, fwidth, fheight, hdc, rect.left,
> rect.top, SRCCOPY)
>
> '---------------------------------------------
> ' Set up the Clipboard and copy bitmap
> '---------------------------------------------
> junk = OpenClipboard(DeskHwnd)
> junk = EmptyClipboard()
> junk = SetClipboardData(CF_BITMAP, hBitmap)
> junk = CloseClipboard()
> End If
>
> '---------------------------------------------
> ' Clean up handles
> '---------------------------------------------
> junk = DeleteDC(hdcMem)
> junk = ReleaseDC(DeskHwnd, hdc)
>
> DoCmd.Hourglass False
>
> End Function
>
>[/color]