473,385 Members | 1,492 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,385 software developers and data experts.

How to constrain a screen-dump to include only the current form...

MLH
Last month, I posted this...

http://support.microsoft.com/d*efaul...;en-us;1009*73
shows Function Screendump(). It is code that effectively does the
same thing as pressing SHIFT-PRTSCR on your keyboard. I am
trying to modify that code to copy only the screen image of the
current form to the clipboard, rather than the entire Access window.
Here is a small snippet from the function...
'-----------------------------*----------------------
' Get window handle to Windows and Microsoft Access
'-----------------------------*----------------------
DeskHwnd = GetDesktopWindow()
AccessHwnd = GetActiveWindow()
'-----------------------------*----------------------
' 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 its possible to drill down the "Get window handle to Windows
and Microsoft Access" operation and do the same sort of thing
for a specific form displayed in the MS Access window, I would
like to do so. That way, when I paste the clipboard contents into
PBrush.exe, only the subject form's image appears - none of the
surrounding image data.
I need read coordinates and make assignments to rect.right,
rect.left, rect.bottom & rect.top for form in the window rather than
the window itself. Suggestions anyone?

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxx

Terry Kreft was so kind as to post an excellent recommendation...

Replace the line
AccessHwnd = GetActiveWindow()

with
AccessHwnd = Screen.ActiveForm.Hwnd

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxx

I would now like to ask for a solution that would capture some
other types of windows. Specifically, the relationships window,
the database window and the macro design window
Nov 13 '05 #1
1 2378
A simple method is to use the FindWindow API. This API allows you to
find a WIndow handle by the Caption of a Window and/or its Window class.
Here is sample code showing you how to find the Relationship window.
http://www.lebans.com/saverelationshipview.htm

If you have access to Spy++ then it is easy to determine the
Caption/Class of any window you want to programmatically find. If you do
not have Spy++ then there are several Freeware alternatives out there.
Alternatively, you could go to the Access Web where you'll find a
solution produced by Dev and Terry that can be used to find the
information you require.
http://www.mvps.org/access/modules/mdl0032.htm

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
"MLH" <CR**@NorthState.net> wrote in message
news:k9********************************@4ax.com...
Last month, I posted this...

http://support.microsoft.com/d*efaul...;en-us;1009*73
shows Function Screendump(). It is code that effectively does the
same thing as pressing SHIFT-PRTSCR on your keyboard. I am
trying to modify that code to copy only the screen image of the
current form to the clipboard, rather than the entire Access window.
Here is a small snippet from the function...
'-----------------------------*----------------------
' Get window handle to Windows and Microsoft Access
'-----------------------------*----------------------
DeskHwnd = GetDesktopWindow()
AccessHwnd = GetActiveWindow()
'-----------------------------*----------------------
' 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 its possible to drill down the "Get window handle to Windows
and Microsoft Access" operation and do the same sort of thing
for a specific form displayed in the MS Access window, I would
like to do so. That way, when I paste the clipboard contents into
PBrush.exe, only the subject form's image appears - none of the
surrounding image data.
I need read coordinates and make assignments to rect.right,
rect.left, rect.bottom & rect.top for form in the window rather than
the window itself. Suggestions anyone?

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxx

Terry Kreft was so kind as to post an excellent recommendation...

Replace the line
AccessHwnd = GetActiveWindow()

with
AccessHwnd = Screen.ActiveForm.Hwnd

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxx

I would now like to ask for a solution that would capture some
other types of windows. Specifically, the relationships window,
the database window and the macro design window


Nov 13 '05 #2

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

Similar topics

6
by: J. VerSchave | last post by:
I have a bunch of images that are 600x800 800x600 640x480 480x640 I want to use HTML to contrain the size of these images. I basically want to display them as thumnails. Here is what I am...
48
by: David J Patrick | last post by:
I'm trying to rewrite the CSS used in http://s92415866.onlinehome.us/files/ScreenplayCSSv2.html. using the w3.org paged media standards as described at http://www.w3.org/TR/REC-CSS2/page.html ...
6
by: Tony Liu | last post by:
Hi, when switched to the full screen mode in VS.NET IDE, is there any way to hide the main menu bar? Thanks Tony
1
by: Shmulik | last post by:
Is there a way to constrain a Generics class to only accept specific value types, for instance, lets say I want to create a Histogram class that could accept the types int, float, double, etc.,...
8
by: Hei | last post by:
Hi, any ideas how to constrain the numbers of item can check in CheckListBox. i would force user can only check one item. thx William
0
by: Jeffery Tyree | last post by:
I have a machine that will be used to demo some Excel spreadsheets at a convention. Because I did not author the spreadsheets and attendees will be allowed to play with the spreadsheets, I needed...
2
oll3i
by: oll3i | last post by:
how to constrain a collection so it takes only strings
6
oll3i
by: oll3i | last post by:
how to constrain a string to 30 chars?
0
by: yashgt | last post by:
We have a ASP .NET 2.0 app that has a header, left nav and center. We want to provide a design mode so that the left nav and center can be interchanged. Also the header can be dragged and brought...
1
karthickkuchanur
by: karthickkuchanur | last post by:
Please help me how rename my column and add contrain to my table I have tried alter but i cant able to add constrain
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.