Arreter Windows - Boite de dialogue
o_winDialogShutDown provoque l'affichage de la boîte dialogue de fermeture Windows.
!!! Pas de gestion de la boîte de dialogue: celle-ci envoie un message de fermeture à
toutes les applications ouvertes.
function o_winDialogShutDown: Boolean;
type // API non déclarées dans Shell32.dll
TSHShutDownDialog = function ( arg: Integer ): HRESULT; stdcall;
var
SHShutDownDialog: TSHShutDownDialog;
f_LibHdl: THandle;
begin
Result:= False;
// Juste pour éviter un warning à la compilation
@SHShutDownDialog:= nil;
// Charger Shell32.dll
f_LibHdl:= LoadLibrary( PChar( 'shell32' ) );
if f_LibHdl <> 0 then
@SHShutDownDialog:= GetProcAddress( f_LibHdl , MAKEINTRESOURCE( 60 ) );
// Adresse API trouvée ??
if @SHShutDownDialog <> nil then
if SHShutDownDialog( 0 ) = 0 then
Result:= True;
// Libérer Shell32.dll
FreeLibrary( f_LibHdl );
// Libérer mémoire
@SHShutDownDialog:= nil;
end;
( extrait de o_fonctions :
http://www.fobec.com/protec/grenier2/encadre.php3?cat=VUnité&id_log=35 )