I want to write a program that takes a screenshot of my current WinCE "desktop" view and writes this image to a file. Is it possible to make with PPL?
I have worked on a demo program today that will do just that. It will be included with the next release of PPL but won't work with the current release.
Here is the code:
- Code:
// ScreenShot written by Alain Deschenes (c) 2004, ArianeSoft
#include "gameapi.ppl"
func mainproc(hWnd$, Msg$, wParam$, lParam$)
ok$ = true;
case (Msg$)
WM_TIMER:
KillTimer(hWnd$, wParam$);
PostMessage(hWnd$, WM_CLOSE, 0, 0);
WM_CLOSE:
g_shut(hWnd$);
end;
return (ok$);
end;
func winmain
hdc$ = GetDC(NULL);
height$ = GetSystemMetrics(SM_CYVIRTUALSCREEN);
width$ = GetSystemMetrics(SM_CXVIRTUALSCREEN);
h$ = newform({GAPI}, {GAPIClass}, &mainproc;);
ShowWindow(h$, SW_HIDE);
processmessages;
g_init(h$, NULL, ORIENTATION_NORTH, 0, 0, false);
s$ = NewSurface(width$, height$);
hDest$ = g_getdc(s$);
BitBlt(hDest$, 0, 0, width$, height$, hdc$, 0, 0, SRCCOPY);
g_releasedc(s$, hDest$);
SaveSurface(s$, AppPath$ + "screenshot");
FreeSurface(s$);
SetTimer(h$, 100, 100, NULL);
return (true);
end;