Vb, Delphi, .net, framework, C++, Java, Pascal,Visual Studio, Asm, Ruby, C#, j#, Cs, Html, Php, Perl, Asp, xHtml Get Free Souce Code Here...



Execute screensaver, then force execute your application at the same time


function KillScreenSaverWndProc(hwndx: HWND; lParamx: LPARAM): boolean;
begin
   PostMessage(hwndx, WM_CLOSE, 0, 0);
   Result := true;
end;

:


var
   osversioninfo: TOSVersionInfo;
   hssWnd: HWND;
   hDeskWnd: HDESK;
begin
   osversioninfo.dwOSVersionInfoSize := sizeof(osversioninfo);

   GetVersionEx(osversioninfo);

   case osversioninfo.dwPlatformId of
       VER_PLATFORM_WIN32_WINDOWS:
       begin
           hssWnd := FindWindow('WindowsScreenSaverClass', nil);

           if hwwWnd <> 0 then
PostMessage(hsswnd, WM_CLOSE, 0, 0);
       end;

       VER_PLATFORM_WIN32_NT:
       begin
           hDeskWnd := OpenDesktop(
               'Screen-saver',
               0,
               false,
               DESKTOP_READOBJECTS or DESKTOP_WRITEOBJECTS
           );

           if hDeskWnd <> 0 then
           begin
               EnumDesktopWindows(hDeskWnd, TFNWndEnumProc(@KillScreenSaverWndProc), 0);
               CloseDesktop(hDeskWnd);
           end
       end;
   end;
end;

0 comments:

Post a Comment