Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to capture the Desktop Window into a jpeg image?
Message
 
À
11/11/2003 15:56:05
Information générale
Forum:
Visual FoxPro
Catégorie:
Photos et traitement d'images
Divers
Thread ID:
00847508
Message ID:
00848903
Vues:
26
Peter,

>If I just build the capture.dll, I will get fatal error C1083: Cannot open include file: 'GdiPlus.h': No such file or directory. I also notice that basetsd.h is added to External Dependencies. I believe the error is actually normal since capture.cpp has the #include "GdiPlus.h". So, I copied all the gdiplus*.h from the Platform SDK to the capture directory and try building the dll again. Well, this time I got a lot of errors and I kind of figure out that the errors are caused by having an older version of stdafx.h in the C:\Program Files\Microsoft Visual Studio\VC98\Include directory. So, I copied the one from Platform SDK. Then I only get fatal error LNK1181: cannot open input file "gdiplus.lib". So, I copied the one from Platform SDK to the capture directory. Finally, I can rebuild the
> capture.dll.

If you have installed Platform SDK, then all that you need is to call "Register PSDK Directories with Visual Studio" from the start menu. This should solve all issues. Or you can specify additional paths for include and library files in Visual Studio options.

>I guess now I just need to understand the capture.cpp and add some error/exception checking.:-)

To check results of GDI+ calls you can use GetLastStatus() method. It retuns Ok for success, or a value that indicates the nature of the most recent failure. So you can simply return img.GetLastStatus(). The nonzero value will mean a failure.
Please note also that saving to a file in GDI+ fails when specified file is already exists. GDI+ will not overwrite it. So you'll need to add file deletion before saving, if output file is already exists.

Good luck! :-)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform