G
Guest
I´m trying to save graphical contents of a form into a HBITMAP object.
At first, using CreateCompatibleDC ,CreateCompatibleBitmap and BitBlt, but it doesn't works 'cause
when function runs, all screen contents is pulled into the bitmap object like a screen capture function, since I just wanna save client region... In other words, if I have another window over the form that i wanna save finally i
got a picture of both windows...
So I started a intensive search to fix this problem. Solution seems to be like this:
- Use MFC eVC++ with cWnd Class in a dll exporting the following procedure:
# define EXPORTA extern "C" __declspec(dllexport)
EXPORTA int __stdcall _SalvarFondo (HWND hWnd)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
CWnd oControlador;
CDC oBitmap;
oControlador.FromHandle(hWnd);
oControlador.Print(oBitmap,PRF_CLIENT);
return 0;
}
There's a problem with this... when I tried to compile i got this error message:
E:\LogiMap\Edward\MFCLogimap\MFCLogimap.cpp(77) : error C2039: 'Print' : is not a member of 'CWnd'
C:\Archivos de programa\Windows CE Tools\wce420\POCKET PC 2003\mfc\include\afxwin.h(1868) : see declaration of 'CWnd'
E:\LogiMap\Edward\MFCLogimap\MFCLogimap.cpp(77) : error C2065: 'PRF_CLIENT' : undeclared identifier
Error executing cl.exe.
there's a preprocessor directive in afxwin.h :
#if !defined(_WIN32_WCE_NO_PRINTING)
void Print(CDC* pDC, DWORD dwFlags) const;
void PrintClient(CDC* pDC, DWORD dwFlags) const;
#endif // _WIN32_WCE_NO_PRINTING
Does anyone know how to fix it or another way to save form's content?
At first, using CreateCompatibleDC ,CreateCompatibleBitmap and BitBlt, but it doesn't works 'cause
when function runs, all screen contents is pulled into the bitmap object like a screen capture function, since I just wanna save client region... In other words, if I have another window over the form that i wanna save finally i
got a picture of both windows...
So I started a intensive search to fix this problem. Solution seems to be like this:
- Use MFC eVC++ with cWnd Class in a dll exporting the following procedure:
# define EXPORTA extern "C" __declspec(dllexport)
EXPORTA int __stdcall _SalvarFondo (HWND hWnd)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
CWnd oControlador;
CDC oBitmap;
oControlador.FromHandle(hWnd);
oControlador.Print(oBitmap,PRF_CLIENT);
return 0;
}
There's a problem with this... when I tried to compile i got this error message:
E:\LogiMap\Edward\MFCLogimap\MFCLogimap.cpp(77) : error C2039: 'Print' : is not a member of 'CWnd'
C:\Archivos de programa\Windows CE Tools\wce420\POCKET PC 2003\mfc\include\afxwin.h(1868) : see declaration of 'CWnd'
E:\LogiMap\Edward\MFCLogimap\MFCLogimap.cpp(77) : error C2065: 'PRF_CLIENT' : undeclared identifier
Error executing cl.exe.
there's a preprocessor directive in afxwin.h :
#if !defined(_WIN32_WCE_NO_PRINTING)
void Print(CDC* pDC, DWORD dwFlags) const;
void PrintClient(CDC* pDC, DWORD dwFlags) const;
#endif // _WIN32_WCE_NO_PRINTING
Does anyone know how to fix it or another way to save form's content?