Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to print the active window?
Message
 
To
10/07/2007 16:45:59
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, United States
General information
Forum:
ASP.NET
Category:
Forms
Environment versions
Environment:
VB 8.0
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01239095
Message ID:
01239232
Views:
11
>>I am involved into the project for conversion VFP application to VB.Net.
>>
>>In VFP the active window is printed by using PrintWindow API based on DibApi32 library.
>>
>>For Windows XP there is also the PrintWindow API function based on user32 library that looks promising.
>>
>>I tried both approaches, but without success. Could anybody provide the example that works? Thank you in advance
>>
>>Yuri Rubinov
>
>Yuri,
>
>Sorry... I must have missed your original post.
>
>Check this out: http://www.vb-helper.com/howto_net_print_form_image.html
>
>I have used it 2 or 3 times and it seems to work pretty well.

Mike,

Thanks you. I have however a few problems converting this pure VB code to VB.NET. I was able to understand that the VB line:
Dim WithEvents m_PrintDocument As PrintDocument
should be converted to:
Dim WithEvents m_PrintDocument As System.Drawing.Printing.PrintDocument
But could you help me with the following?

1. At the line:
Dim bm_gr As Graphics = me_gr.FromImage(bm)
it complains that me_gr.FromImage(bm), "Access of shared member, constant member, ... through an instance; qualifying expression will not be evaluated" .

2. At the line:
Dim me_hdc As IntPtr = GetWindowDC(Me.Handle)
it complains that
"PInvokeStackImbalance was detected
Message: A call to PInvoke function 'dlr_cost!dlr_cost.Form1::GetWindowDC' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature."


Thanks in advance
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform