Hermano Posted December 10, 2007 Share Posted December 10, 2007 I am currently writing a full library of functions tailored to those that use a multi monitor situation where one of the two monitor is a tv set or project.The full libray will be available to the community very soon. In the mean time i would appreciate some ideas how to sort the following problemIF I LAUNCH AN EXISTING SCREENSAVER on one monitor than the process starts to intercept all keyboard and mouse inputs and therefore self-close itself as soon as i do an operation on the other screen. HOW CAN this be avoided?? (beside writing my on screensaver on a separate gui)One of my attempt was 1 Use create process to launch the screensaver2 catching the generated thread3 Hooking it with a callback and SetWindowsHookEx function (absolutely local)but it does not work the thread generated does not receive the hook. Only Hotkey is capable to intercept the keystrokes before the screensaver.But not all bad news are bad so to induce you guys to help me i will start by sharing the PROCESSCREATE function. It can be extremely useful to control the way programs open (much more powerful than the classic RUN()CODE#include <winapi.au3>;#include <A3LWinAPI.au3>; =======================================================================; Process Create Flags Constants; =========================================================================Global Const $IDLE_PRIORITY_CLASS =0x00000040Global Const $BELOW_NORMAL_PRIORITY_CLASS =0x00004000Global Const $NORMAL_PRIORITY_CLASS =0x00000020Global Const $ABOVE_NORMAL_PRIORITY_CLASS =0x00008000Global Const $HIGH_PRIORITY_CLASS =0x00000080Global Const $REALTIME_PRIORITY_CLASS =0x00000100Global Const $DETACHED_PROCESS =0x00000008Global Const $CREATE_NEW_CONSOLE=0x00000010; ==============================================================================; Startup Constants; ==============================================================================Global Const $STARTF_USESHOWWINDOW = 0x00000001Global Const $STARTF_USESIZE = 0x00000002Global Const $STARTF_USEPOSITION = 0x00000004Global Const $STARTF_USECOUNTCHARS = 0x00000008Global Const $STARTF_USEFILLATTRIBUTE = 0x00000010Global Const $STARTF_RUNFULLSCREEN = 0x00000020Global Const $STARTF_FORCEONFEEDBACK = 0x00000040Global Const $STARTF_FORCEOFFFEEDBACK = 0x00000080Global Const $STARTF_USESTDHANDLES = 0x00000100; ===============================================================================; ShowWindow Constants; =================================================================================Global Const $SW_HIDE = 0Global Const $SW_SHOWNORMAL = 1Global Const $SW_NORMAL = 1Global Const $SW_SHOWMINIMIZED = 2Global Const $SW_SHOWMAXIMIZED = 3Global Const $SW_MAXIMIZE = 3Global Const $SW_SHOWNOACTIVATE = 4Global Const $SW_SHOW = 5Global Const $SW_MINIMIZE = 6Global Const $SW_SHOWMINNOACTIVE = 7Global Const $SW_SHOWNA = 8Global Const $SW_RESTORE = 9Global Const $SW_SHOWDEFAULT = 10Global Const $SW_FORCEMINIMIZE = 11Global Const $SW_MAX = 11;============================================================================; ProcessCreate Needed structures; =============================================================================Global Const $tagSECURITY_ATTRIBUTES = "int Length;ptr Descriptor;int InheritHandle"Global Const $tagSTARTUPINFO = "int Size;ptr Reserved1;ptr Desktop;ptr Title;int X;int Y;int XSize;int YSize;int XCountChars;" & _ "int YCountChars;int FillAttribute;int Flags;short ShowWindow;short Reserved2;ptr Reserved3;int StdInput;" & _ "int StdOutput;int StdError"Global Const $tagPROCESS_INFORMATION = "hwnd hProcess;hwnd hThread;int ProcessID;int ThreadID";=============================================================================; ProcessCreate ; ===============================================================================$Nm = "" ;<<--- 1 can be ignored$Cm= "ssstars.scr /s" ;<<--- 2$ProcSec = DllStructCreate($tagSECURITY_ATTRIBUTES)DllStructSetData ($ProcSec,"Length",DllStructGetSize($ProcSec))DllStructSetData ($ProcSec,"InheritHandle",False) ; inherit security process$pProcSec = DllStructGetPtr($ProcSec) ;<<--- 3$ThredSec = DllStructCreate($tagSECURITY_ATTRIBUTES)DllStructSetData ($ThredSec,"Length",DllStructGetSize($ThredSec))DllStructSetData ($ThredSec,"InheritHandle",False) ;; inherit security Thread$pThredSec = DllStructGetPtr($ProcSec) ;<<--- 4$Inht = True ;<<--- 5$Flags = BitOR($NORMAL_PRIORITY_CLASS,0) ;<<--- 6$Env = 0 ;<<--- 7$dir = "" ;<<--- 8 no working dir specified; -------------startup elements$StartUp = DllStructCreate($tagSTARTUPINFO)DllStructSetData ($StartUp,"Size",DllStructGetSize($StartUp))DllStructSetData($Startup, "ShowWindow",$SW_SHOWNOACTIVATE)DllStructSetData($Startup, "Flags",BitOR($STARTF_USESHOWWINDOW,$STARTF_FORCEONFEEDBACK))$pStartUP = DllStructGetPtr($StartUp) ;<<--- 9 $ProcInfo= DllStructCreate($tagPROCESS_INFORMATION) $pProcInfo= DllStructGetPtr($ProcInfo) ;<<--- 10_WinAPI_CreateProcess($Nm, $Cm, $pProcSec, $pThredSec, $Inht, $Flags, $Env,$dir, $pStartUP, $pProcInfo)$Hproc = DllStructGetData($ProcInfo,1) ;- A handle to the newly created process$Hthr = DllStructGetData($ProcInfo,2) ;- A handle to the primary thread of the newly created process$PID = DllStructGetData($ProcInfo,3) ;- A value that can be used to identify the process$ThID = DllStructGetData($ProcInfo,4) ;- A value that can be used to identify the thread_oo("$Hproc =0x; $hthr=0x; $Pid=; $ThId =; ",Hex($Hproc), Hex($hthr),$Pid,$ThId );**********************************************************************************************; debugging funciton;************************************************************************************************Func _oo ($Input, $Inp1=0, $Inp2=0, $Inp3=0, $Inp4=0, $Inp5=0, $Inp6=0, $Inp7=0, $Inp8=0, $Inp9=0, $Inp10=0) Dim $str,$i, $Output="",$param$str = StringSplit ($input,";") For $i = 1 To $str[0] -1 $param=String(Eval("Inp"&String($i))) $Output =$Output & $str[$i] & $paramNextConsoleWrite ($Output & @CR)EndFunc ------- CARPE DIEM Display_Library_ Skype erase history Win10VirtualDesktopManager Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now