Archive: start actual screensaver - how to ?


start actual screensaver - how to ?
i found this code in antoher forum:

SendMessage(hWnd, 0x112, 0xF140, 0);

it should start the actual SS

how to in nsis ???

thx


why dont you just read the registry for the current screensaver and launch it with ExecShell?


<lol> nice idea - better it is...

thx

(ps i know where to look)


why go in the registry when u can just do:
SendMessage $HWNDPARENT 0x112 0xF140 0


Function .onInit
; check screen saver
check1:
ClearErrors
ReadRegStr $INSTDIR HKCU "Control Panel\Desktop" "SCRNSAVE.EXE"
IfErrors check2 ; not found
StrCmp $INSTDIR "" check2 ; not set

;control file
IfFileExists $INSTDIR 0 check2

;start screensaver
Exec '"$INSTDIR" /S'

;error
check2:
Quit
FunctionEnd


HTH

>> SendMessage $HWNDPARENT 0x112 0xF140 0

does not work here, dunno why...

Function .onInit
;start screensaver
SendMessage $HWNDPARENT 0x112 0xF140 0
FunctionEnd


That's because the installer window has not yet been created when .onInit is called.
Try putting it in .onGUIInit:


Function .onGuiInit
SendMessage $HWNDPARENT 0x112 0xF140 0
FunctionEnd

or, if you are using MUI, something like:

!define MUI_CUSTOMFUNCTION_GUIINIT myGuiInit
Function myGuiInit
SendMessage $HWNDPARENT 0x112 0xF140 0
FunctionEnd

that works :)

disadvatage - i see for a short period the gui - my first version did not


use SilentInstall


Your first version did not show the GUI because (surprise!) it had not yet been created in the .onInit function.
Why do you need to start the screensaver when you kick off your installer, anyway? Seems to be a counter-intuitive thing to do.


>> Why do you need to start the screensaver when you kick off your installer, anyway?

i am really off with my tools - this is no part of any installer .- this was a question from another forum some1 requestet "actually SS starts on desktop link"

Setups are not my favorite time wasters - i create some 3rd party apps for my mailer with nsis - i used winbatch before but nsis ist much smaller and more flexible

eg. i have a selfmade updater for mcafee sdat & stinger
or backup program for my mailer

btw SilentInstall does nothing - no ss started instead w/o


if u want to start it without showing the installer u could call GetDesktopWindow with the system plugin 2 get a handle, or u can try calling DefWindowProc with the system plugin passing 0 as the hwnd (might work, not tried this :) )


Try using SilentInstall silent in your installer outside sections and functions with SendMessage 0 0x112 0xF140 0 inside the .onInit callback function. (like Anders suggested, without System plugin codes and using SendMessage command)


try this:
SendMessage 0xFFFF 0x112 0xF140 0

and if that doesnt work do:
System::Call 'user32::GetDesktopWindow() i .r0'
SendMessage $0 0x112 0xF140 0


try it yourself "silentinstall" NEVER works here :/

;--------------------------------
;Configuration

!define PRODUCT "Start Screensaver"
!define VERSION "1.0"

Name "Start Screensaver 1.0"
Caption "Start Screensaver 1.0"
OutFile "startscr1.exe"

; automatically close the installer when done.
AutoCloseWindow true

; hide the "show details" box
ShowInstDetails nevershow

SilentInstall silent
;--------------------------------
;Languages

BrandingText " Copyright 2003-2004 Brummelchen "

;--------------------------------
;Pages

;--------------------------------
;Installer Sections

Section ""
SectionEnd

;--------------------------------
;Installer Functions

Function .onGuiInit
System::Call 'user32::GetDesktopWindow() i .r0'
SendMessage $0 0x112 0xF140 0
FunctionEnd

Function .onGUIEnd
Delete $pluginsdir\*.*
RMdir $PLUGINSDIR
FunctionEnd


;)

yeah, ur code doesnt work, but do u have to call it in .onGuiInit?

this code works just fine for me:

!define APP_NAME "Start SS"
Name "${APP_NAME}"
OutFile "${APP_NAME}.exe"
InstallDir "$PROGRAMFILES\nsis test\${APP_NAME}"
SilentInstall silent
Page instfiles
Section
SendMessage 0xFFFF 0x112 0xF140 0
SectionEnd


this was a suggest above - first version works fine...

i dont work with sections if not needed...


Mine and Anders' suggestions won't work because (surprise!) SilentInstall silent makes the installer to don't create a GUI. Solution: Put the .onGuiInit code inside Function .onInit.


i should be able to notice that <omg>
thx for that hint - learned something new :)