Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to print the active window?
Message
 
À
10/07/2007 16:45:59
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Versions des environnements
Environment:
VB 8.0
OS:
Windows XP SP2
Divers
Thread ID:
01239095
Message ID:
01239232
Vues:
10
>>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform