473,396 Members | 2,030 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

I imported a module from an Access 2.0 database into Access 97. Can I tell by looking at the code what must be changed to 32-bit DLL calls?

MLH
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
Nov 13 '05 #1
2 1513
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" <CR**@NorthState.net> wrote in message
news:pn********************************@4ax.com...
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

Nov 13 '05 #2
MLH
Thx, Doug. I'll check it out.
Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: dody suria wijaya | last post by:
I found this problem when trying to split a module into two. Here's an example: ============== #Module a (a.py): from b import * class Main: pass ============== ==============
6
by: Terry Bell | last post by:
We've had a very large A97 app running fine for the last seven years. I've just converted to SQL Server backend, which is being tested, but meanwhile the JET based version, running under terminal...
4
by: Martin M. | last post by:
Hi, I have the following question: How can an imported module see/find the path to itself? Background: From my main script I import a module which needs a file (AppleScript) located in the...
17
by: dananrg | last post by:
I'm a little confused about what's out there for database modules at: http://python.org/topics/database/modules.html What I'd like to do is use Python to access an Oracle 9.X database for...
15
by: Cheryl Langdon | last post by:
Hello everyone, This is my first attempt at getting help in this manner. Please forgive me if this is an inappropriate request. I suddenly find myself in urgent need of instruction on how to...
17
by: Mell via AccessMonster.com | last post by:
Is there a way to find out where an application was created from? i.e. - work or home i.e. - if application sits on a (work) server/network, the IT people know the application is sitting...
14
by: ccdetail | last post by:
http://www.tiobe.com/index.htm?tiobe_index Python is the 7th most commonly used language, up from 8th. The only one gaining ground besides VB in the top 10. We're glad, our app is written in...
3
by: schpok | last post by:
When I "from foo import *" in my __init__.py, sometimes module foo's docs will be expanded in the pydocs. It seems to depend in what language foo was implemented. For example, if you "from math...
0
by: Jeff Dyke | last post by:
my apologies, to Fredrick, my response when solely to him. reply below, hopefully keeping thread intact. On Mon, Jul 21, 2008 at 12:28 PM, Jeff Dyke <jeff.dyke@gmail.comwrote:
3
by: Mohamed Yousef | last post by:
Hello , The problem I'm asking about is how can imported modules be aware of other imported modules so they don't have to re-import them (avoiding importing problems and Consicing code and...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.