Connecting Tech Pros Worldwide Help | Site Map

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

  #1  
Old November 13th, 2005, 08:52 AM
MLH
Guest
 
Posts: n/a
http://support.microsoft.com/default...b;en-us;100973
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?
  #2  
Old November 13th, 2005, 08:54 AM
Terry Kreft
Guest
 
Posts: n/a

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


Replace the line
AccessHwnd = GetActiveWindow()

with
AccessHwnd = Screen.ActiveForm.Hwnd



--
Terry Kreft
MVP Microsoft Access


"MLH" <CRCI@NorthState.net> wrote in message
news:edae219ve7m1s85efms105v165605njb80@4ax.com...[color=blue]
> http://support.microsoft.com/default...b;en-us;100973
> 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?[/color]


  #3  
Old November 13th, 2005, 08:58 AM
MLH
Guest
 
Posts: n/a

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


That sure did the trick! Many thanks.
  #4  
Old November 13th, 2005, 09:08 AM
MLH
Guest
 
Posts: n/a

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


That was perfect.
Thx for the suggestion.
  #5  
Old November 13th, 2005, 09:08 AM
PC Datasheet
Guest
 
Posts: n/a

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


What was the answer?


"MLH" <CRCI@NorthState.net> wrote in message
news:j6bn21lifv6napap88tef0aq44h6vnuptc@4ax.com...[color=blue]
> That was perfect.
> Thx for the suggestion.[/color]


  #6  
Old November 13th, 2005, 09:57 AM
MLH
Guest
 
Posts: n/a

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


Replace the line
AccessHwnd = GetActiveWindow()


with
AccessHwnd = Screen.ActiveForm.Hwnd


--
Terry Kreft
MVP Microsoft Access


Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
comp.lang.c Answers to Frequently Asked Questions (FAQ List) Steve Summit answers 5 November 14th, 2005 12:36 PM
comp.lang.c Answers to Frequently Asked Questions (FAQ List) Steve Summit answers 0 November 14th, 2005 04:15 AM
comp.lang.c Answers to Frequently Asked Questions (FAQ List) Steve Summit answers 0 November 13th, 2005 11:37 PM
comp.lang.c Answers to Frequently Asked Questions (FAQ List) Steve Summit answers 0 November 13th, 2005 09:56 PM
comp.lang.c Answers to Frequently Asked Questions (FAQ List) Steve Summit answers 0 November 13th, 2005 03:15 AM