Jump to content

Hermano

Active Members
  • Posts

    20
  • Joined

  • Last visited

Everything posted by Hermano

  1. πŸ˜“ VIRTUAL DESKTOP MANAGER LIBRARY FOR WINDOWS 10 (11 NOT TESTED) it has been a lot of work and testing. I could find some minor imperfections in the previous snippets we wrote and finally here is the full library to properly manage win10 virtual desktop system. Every function has been tested but I am sure that our great community will find several improvements and adds-on we did not think of. Without all your contribution this would not have been possible. The library has 4 examples embedded and commented (please do not hesitate to add more). The objects created offers lots of extra tags that I did not use The core objects created where: Global $oVirtualDesktopManagerInternal Global $oApplicationViewCollection Global $oVirtualDesktopPinnedApps Local $oApplicationView I list them here so that anyone interested in using the same objects for other functions can easily find a reference Enjoy πŸ˜ƒ VritDsktLibrary.au3
  2. ☺️ may be you want to edit since you did most of the work you might want to add the option to pin a view to all desktops, it is tested and works. I still need to test the possibility to pin the appID which will allow all sub-windows opened by the app to stay pinned to all desktops I am currently building the whole app to have a small virtual-desktop manager up and running in the Taskbar. With your permission I might upload the whole code when finished in my area $eRightDirection=4
  3. bravo i will give it a try and post back
  4. that is exactly the issue. I cannot get step nmb 2 to work
  5. your job is stunning and a great start. Let's see if i can help with a little more CODE Local $tagIVirtualDesktopPinnedApps = _ "IsAppIdPinned hresult(wstr,bool*);" & _ ; this is the hwnd but might need to be passed as (string appId) "PinAppID hresult(wstr);" & _ "UnpinAppID hresult(wstr);" & _ "IsViewPinned hresult(ptr,bool*);" & _ "PinView hresult(ptr);" & _ "UnpinView hresult(ptr);" ; ------ $oService.QueryService($tCLSID_VirtualDesktopPinnedApps, $tIID_IVirtualDesktopPinnedApps, $pVirtualDesktopPinnedApps) ConsoleWrite("Virtual Desktop Pinned Apps = " & $pVirtualDesktopPinnedApps & @CRLF) Local $oVirtualDesktopPinnedApps = ObjCreateInterface($pVirtualDesktopPinnedApps, $IID_IVirtualDesktopPinnedApps, $tagIVirtualDesktopPinnedApps) ConsoleWrite("Virtual Desktop Pinned Apps = " & IsObj($oVirtualDesktopPinnedApps) & @CRLF) ;------------- $iHresult = $oVirtualDesktopPinnedApps.PinView($pView) ConsoleWrite("Pinned View = " & $iHresult & @CRLF) $iHresult = $oVirtualDesktopPinnedApps.UnpinView($pView) ConsoleWrite("UnPinned View = " & $iHresult & @CRLF) while everying works great if we pin the view i cannot get the PinAppID mode to work correctly. As a matter of fact it requires the appId to work and I do not know how to source that information properly. Trust somebody can complete this, so we can finally create an amazing virtual desktop manager for win10/11 with few simple Autoit lines
  6. Due to the recent changes in Win7 API I had to update part of the library. A good opportunity to make it even more flexible and to provide relative and absolute coords for the monitors relative to the mailn one here the updated functions: You call Monitors() only as a function and you have the array will all the Monitors info you need for your coding ;============================================================================================== _NumberAndNameMonitors ; Function Name: _NumberAndNameMonitors () ; Description: Provides the first key elements of a multimonitor system, included the Regedit Keys ; Parameter(s): None ; Return Value(s): $NumberAndName [][] ;~ [0][0] total number of video devices ;; [x][1] name of the device ;; [x][2] name of the adapter ;; [x][3] monitor flags (value is returned in Hex str -convert in DEC before use with Bitand) ;; [x][4] registry key of the device ; Remarks: the flag value [x][3] can be one of the following ;; DISPLAY_DEVICE_ATTACHED_TO_DESKTOP 0x00000001 ;; DISPLAY_DEVICE_MULTI_DRIVER 0x00000002 ;; DISPLAY_DEVICE_PRIMARY_DEVICE 0x00000004 ;; DISPLAY_DEVICE_VGA 0x00000010 ;; DISPLAY_MIRROR_DEVICE 0X00000008 ;; DISPLAY_REMOVABLE 0X00000020 ; ; Author(s): Hermano ;=========================================================================================================================== Func _NumberAndNameMonitors() Local $dev = -1, $id = 0, $msg_ = "", $EnumDisplays, $StateFlag Dim $NumberAndName[2][6] Local $DISPLAY_DEVICE = DllStructCreate("int;char[32];char[128];int;char[128];char[128]") DllStructSetData($DISPLAY_DEVICE, 1, DllStructGetSize($DISPLAY_DEVICE)) Dim $dll = "user32.dll" Do $dev += 1 $EnumDisplays = DllCall($dll, "int", "EnumDisplayDevices", "ptr", 0, "int", $dev, "ptr", DllStructGetPtr($DISPLAY_DEVICE), "int", 1) If $EnumDisplays[0] <> 0 Then ReDim $NumberAndName[$dev + 2][6] $NumberAndName[$dev + 1][1] = DllStructGetData($DISPLAY_DEVICE, 2) ;device Name $NumberAndName[$dev + 1][2] = DllStructGetData($DISPLAY_DEVICE, 3) ;device or display description $NumberAndName[$dev + 1][3] = Hex(DllStructGetData($DISPLAY_DEVICE, 4)) ;all flags (value in HEX) $NumberAndName[$dev + 1][4] = DllStructGetData($DISPLAY_DEVICE, 6) ;registry key of the device $NumberAndName[$dev + 1][5] = DllStructGetData($DISPLAY_DEVICE, 5) ;hardware interface name EndIf Until $EnumDisplays[0] = 0 $NumberAndName[0][0] += $dev Return $NumberAndName EndFunc ;==>_NumberAndNameMonitors ;============================================================================================== _DisplayKeySettings ; Function Name: _DisplayKeySettings($MonName,$Opt = -1) ; Description: all key information about each adapter needed to properly change the display setting ; Parameter(s): $MonName = return array from _NumberAndNameMonitors ;; $Opt = -1 $ENUM_CURRENT_SETTINGS [default] ;; = -2 $ENUM_REGISTRY_SETTINGS ; Return Value(s): $KeySettings[][] ;; $KeySettings[0][0] = Number of non virtual devices ;; $KeySettings[x][0] = Flags ;; $KeySettings[x][1] = Monitor Name ;; $KeySettings[x][2] = up left desktop position X ;; $KeySettings[x][3] = up left desktop position Y ;; $KeySettings[x][4] = Width (resolution) ;; $KeySettings[x][5] = Heigth (resolution) ;; $KeySettings[x][6] = Bpp color (resolution) ;; $KeySettings[x][7] = Screen Refresh(resolution) ;; $KeySettings[x][8] = Display Orientation ;; $KeySettings[x][9] = Display Fixed Output ; Remarks: ; ; Author(s): Hermano ;=========================================================================================================================== Func _DisplayKeySettings($MonName, $Opt = -1) Local Const $DISPLAY_DEVICE_MIRRORING_DRIVER = 0x00000008 Dim $KeySettings[1][10], $i, $Dn = 0, $res If Not IsArray($MonName) Then $MonName = _NumberAndNameMonitors() Local $DEVMODE = DllStructCreate("char[32];short[4];int[5];short[5];byte[32];short;int[6]") DllStructSetData($DEVMODE, 2, DllStructGetSize($DEVMODE), 3) For $i = 1 To $MonName[0][0] If ($MonName[$i][3] <> $DISPLAY_DEVICE_MIRRORING_DRIVER) Then $Dn += 1 $res = DllCall("user32.dll", "int", "EnumDisplaySettings", "str", $MonName[$i][1], "int", $Opt, "ptr", DllStructGetPtr($DEVMODE)) If $res[0] = 0 Then _ $res = DllCall("user32.dll", "int", "EnumDisplaySettings", "str", $MonName[$i][1], "int", Mod($Opt, 2) - 1, "ptr", DllStructGetPtr($DEVMODE)) ReDim $KeySettings[1 + $Dn][10] $KeySettings[$Dn][0] = $MonName[$i][3] ;flags $KeySettings[$Dn][1] = $MonName[$i][1] ;name $KeySettings[$Dn][2] = DllStructGetData($DEVMODE, 3, 2) ;up left desktop position coord X $KeySettings[$Dn][3] = DllStructGetData($DEVMODE, 3, 3) ;up left desktop position coord Y $KeySettings[$Dn][4] = DllStructGetData($DEVMODE, 7, 2) ;Width (resolution) $KeySettings[$Dn][5] = DllStructGetData($DEVMODE, 7, 3) ;Heigth (resolution) $KeySettings[$Dn][6] = DllStructGetData($DEVMODE, 7, 1) ;Bpp color (resolution) $KeySettings[$Dn][7] = DllStructGetData($DEVMODE, 7, 5) ;Screen Refresh(resolution) $KeySettings[$Dn][8] = DllStructGetData($DEVMODE, 3, 4) ;Display Orientation $KeySettings[$Dn][9] = DllStructGetData($DEVMODE, 3, 5) ;fixed output EndIf Next $KeySettings[0][0] = $Dn Return $KeySettings EndFunc ;==>_DisplayKeySettings ;============================================================================================== Monitors Selection Func Monitors() $a = _DisplayKeySettings(_NumberAndNameMonitors(), -1) ;_ArrayDisplay($a,"full") For $dum = 1 To $a[0][0] If BitAND($a[$dum][0], 1) Then ;I make sure is not a virtual monitor $Monitors += 1 ReDim $MonitorCoords[$Monitors + 1][5] $MonitorCoords[$Monitors][1] = $a[$dum][2];X $MonitorCoords[$Monitors][2] = $a[$dum][3];Y $MonitorCoords[$Monitors][3] = Abs($a[$dum][2] + $a[$dum][4]);XX $MonitorCoords[$Monitors][4] = Abs($a[$dum][5] + $a[$dum][3]);YY EndIf Next $MonitorCoords[0][0] = $Monitors ;_ArrayDisplay($MonitorCoords,"Desktop") EndFunc ;==>Monitors
  7. I had received lots of requests to create a program capable to erase single users chat records from skype This result cannot be achieved by operating with the SKYPE4COM object library. The remove function even if coded is not available to external calls For this reason I decided to start operating directly on the database "main.db" and browsing it through SQLlite calls Weather apparently trivial the database looked more complex to manage than expected The program is fully functional and I am including the full code. It can be integrated by creating a window where only specific chats are removed and not the full block as I decided to do I hope this program will help lots of user that othwerwise are all obliged to go for expensive solutions that most of the time work only in conjunction with administrator rights. My code does not require any special access and does not installs any regedit call, it is therefore perfectly pocket-portable and will guarantee your privacy in any situation dbbrows2.au3
  8. I know you might have solved the issue, but in case you did not here is the solution for recording streams on SKYPE func StartMonitor() ConsoleWrite(@CRLF& "startmonitor" &@CRLF) if $oSkype.ActiveCalls.count > 0 then $CallId = $oSkype.ActiveCalls.Item(1).ID ;1 is the active call $CallObj= $oSkype.ActiveCalls.Item(1); this is the general object $FileAudio= @DesktopDir & "\Audio.wav" $FileMic = @DesktopDir & "\Mic.wav" $oSkype.ActiveCalls.Item(1).OutputDevice(2)=$FileAudio ;$CallIoDeviceTypeFile $oSkype.ActiveCalls.Item(1).CaptureMicDevice(2)=$FileMic consoleWrite(@crlf & "skype ID:" & $CallID) consoleWrite(@crlf & "skype name:" & $CallObj.PartnerHandle) consoleWrite(@crlf & "Real Name in:" & $CallObj.PartnerDisplayName) EndIf EndFunc
  9. I hope this is the code you need. I extracted it from a bigger program that I use daily on my pc. Included in the code there is an GUI that will allow you to set sleeping and wake-up times. Lots of hints coming from the forum as always The routing is currently tested on a win7 0x64 Global $SleepH = 01, $SleepM = 10, $WakeH = 07, $WakeM = 30 ;********* ;SleepCycles Func ReadyForStandby() Local $answ, $r, $snooze, $nMsg, $PostPoned Local $mode = True ;True=Hibernate, False=Suspend Local $WT = String($WakeH) & ":" & String($WakeM) Local $ST = String($SleepH) & ":" & String($SleepM) Local $Form1 = GUICreate("Sleep and Wake up Time", 290, 200, 731, 229, $WS_SYSMENU, $WS_EX_TOPMOST) Local $Button1 = GUICtrlCreateButton("OK", 31, 110, 100, 34, 0) Local $Button2 = GUICtrlCreateButton("NO", 142, 110, 100, 34, 0) Local $SleepInput = GUICtrlCreateEdit("", 31, 84, 100, 21, $ES_WANTRETURN) Local $WakeInput = GUICtrlCreateEdit("", 145, 84, 100, 21, $ES_WANTRETURN) Local $Label1 = GUICtrlCreateLabel("The computer is about to go to sleep", 30, 4, 233, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x800000) Local $label2 = GUICtrlCreateLabel("Press OK to execute NOW ", 55, 20, 233, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x800000) Local $label2 = GUICtrlCreateLabel("Modify values and press OK to RESET ", 28, 36, 233, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x800000) Local $Label3 = GUICtrlCreateLabel("TIME DOWN", 36, 57, 91, 20) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x800000) Local $Label4 = GUICtrlCreateLabel("TIME UP", 160, 57, 65, 20) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x800000) _GUICtrlEdit_SetText ($SleepInput, $ST) _GUICtrlEdit_SetSel ($SleepInput, 0, -1) _GUICtrlEdit_SetText ($WakeInput, $WT) _GUICtrlEdit_SetSel ($WakeInput, 0, -1) GUISetState(@SW_SHOW) $snooze = TimerInit() Do $nMsg = GUIGetMsg() Switch $nMsg Case $nMsg = 0 ContinueLoop Case $Button1 $answ = "yes" $nMsg = $GUI_EVENT_CLOSE Case $Button2 $answ = "no" $nMsg = $GUI_EVENT_CLOSE EndSwitch Until $nMsg = $GUI_EVENT_CLOSE Or TimerDiff($snooze) >= (20 * 1000) ; idle 15 sec If ReadAssign($SleepInput, $WakeInput) = 1 Then $answ = "no" SetWakeUpTime($WakeH, $WakeM) GUIDelete($Form1) If $answ = "yes" Or TimerDiff($snooze) >= (20 * 1000) Then ;stanby!! $r = DllCall("PowrProf.dll", "long", "SetSuspendState", "long", $mode, "long", True, "long", False) EndIf EndFunc ;==>ReadyForStandby ;-- ;-- ;-- Func ReadAssign($Sinp, $Winp) Local $i = _GUICtrlEdit_GetText ($Sinp) $WakeH = Int(StringLeft( _GUICtrlEdit_GetText ($Winp), 2)) $WakeM = Int(StringRight( _GUICtrlEdit_GetText ($Winp), 2)) If $SleepH <> Int(StringLeft($i, 2)) Or $SleepM <> Int(StringRight($i, 2)) Then $SleepH = Int(StringLeft($i, 2)) $SleepM = Int(StringRight($i, 2)) Return 1 EndIf Return 0 EndFunc ;==>ReadAssign ;; ***************************************************SetWakeUpTime Func SetWakeUpTime($Hour, $Minute, $Day = @MDAY, $Month = @MON, $Year = @YEAR) Local $result, $lastError Local $SYSTEMTIME = DllStructCreate("ushort;ushort;ushort;ushort;ushort;ushort;ushort;ushort") Local $lpSYSTEMTIME = DllStructGetPtr($SYSTEMTIME) Local $LOCALFILETIME = DllStructCreate("dword;dword") Local $lpLOCALFILETIME = DllStructGetPtr($LOCALFILETIME) Local $DueTime = DllStructCreate("dword;dword") Local $lpDueTime = DllStructGetPtr($DueTime) DllStructSetData($SYSTEMTIME, 1, $Year) DllStructSetData($SYSTEMTIME, 2, $Month) DllStructSetData($SYSTEMTIME, 3, _DateToDayOfWeek($Year, $Month, $Day) - 1) DllStructSetData($SYSTEMTIME, 4, $Day) DllStructSetData($SYSTEMTIME, 5, $Hour) DllStructSetData($SYSTEMTIME, 6, $Minute) DllStructSetData($SYSTEMTIME, 7, 0) DllStructSetData($SYSTEMTIME, 8, 0) $result = DllCall("kernel32.dll", "long", "SystemTimeToFileTime", "ptr", $lpSYSTEMTIME, "ptr", $lpLOCALFILETIME) If $result[0] = 0 Then $lastError = DllCall("kernel32.dll", "int", "GetLastError") SetExtended($lastError[0]) SetError(1) Return 0 EndIf $result = DllCall("kernel32.dll", "long", "LocalFileTimeToFileTime", "ptr", $lpLOCALFILETIME, "ptr", $lpLOCALFILETIME) If $result[0] = 0 Then Local $lastError = DllCall("kernel32.dll", "int", "GetLastError") SetExtended($lastError[0]) SetError(1) Return 0 EndIf $result = DllCall("kernel32.dll", "long", "CreateWaitableTimer", "long", 0, "long", True, "str", "") If $result[0] = 0 Then Local $lastError = DllCall("kernel32.dll", "int", "GetLastError") SetExtended($lastError[0]) SetError(1) Return 0 EndIf DllCall("kernel32.dll", "none", "CancelWaitableTimer", "long", $result[0]) DllStructSetData($DueTime, 1, DllStructGetData($LOCALFILETIME, 1)) DllStructSetData($DueTime, 2, DllStructGetData($LOCALFILETIME, 2)) $result = DllCall("kernel32.dll", "long", "SetWaitableTimer", "long", $result[0], "ptr", $lpDueTime, "long", 1000, "long", 0, "long", 0, "long", True) If $result[0] = 0 Then Local $lastError = DllCall("kernel32.dll", "int", "GetLastError") SetExtended($lastError[0]) SetError(1) Return 0 EndIf Return 1 EndFunc ;==>SetWakeUpTime
  10. You are welcome. I would have loved also some other input and code from any of the 43 people that have downloaded. I am so keen in implementing the multi-desktop but still no luck. this said: Primary display is A big problem. things are very different if you play with double video card or with one with extension In the latter case no chance i did not manage to make it work in the former instead: then use option 7 to switch off any of the two monitors, make the other primary. (primary is always positioned as 0,0) Reset the position of the switched off monitor $KeySettings[$Index][2] = xxxxx; you decide $KeySettings[$Index][3]= yyyyy and reactivate it _DisplayChangeSettings(7, $KeySettings, $Index = [MONITOR OF YOUR CHOICE]) It works on my system but..... let me know how it goes on yours
  11. Thanks, i guess i need a break
  12. I know you guys are goin got think i am s.... but can you point me out to the link in the FAQ to run a script as a service. Muchas Grazias
  13. Dear All I have two monitors as most of you today and i am struggled to find a library as complete as possible that allows to manage them independently. So at the end I decided to write one myself, collecting as much info as possible from this forum and around the web. THEREFORE MANY THANKS TO ALL THOSE THAT WILL FEEL AS PART OF THE CODE COMES FROM THEIR INPUT Must say Msn and our Microsoft friends also provide a lot of support but it is so fragmented that it is almost impossible to make sense of it sometimes. So here are all the functions you will find Display_Library_Functions Now please help and contribute I am still dreaming to add more functions to the library such as - Multi desktop -- activate several desktops on a multi monitor at the same time - Toggle single monitor on/off - Change fonts 1 monitor at the time .... you name it I am sure lots of you know how to do great things and this can be seen just as a starting point Display_Library_functions.zip
  14. I did it is quite heavy. this is the reason why i modified the function to make it slightly faster. CODE Func DirListRecursive($sSearchPath, $sSearchPattern, $iMaxRecurseLevel, $sWorkerFunction) Local $retVal Local $nFilesFound = 0 Local $debug_prefix = "_FileChangeRecursive: " ;#== If the max recursion level < 0 (e.g. -1) then, we set an insane high If $iMaxRecurseLevel < 0 Then $iMaxRecurseLevel = 0xFFFFFFF EndIf Local $dirs = _FileListToArray($sSearchPath, "*", 2) If @error > 0 And @error < 4 Then SetError(@error, @extended) Return -1 EndIf _ArraySort($dirs, 0, 1) If IsArray($dirs) Then For $n = 1 To $dirs[0] $retval = Call($sWorkerFunction, $sSearchPath, $dirs[$n]) $nFilesFound += 1 Next EndIf ;#== Now recursively walk through all directories If IsArray($dirs) Then For $n = 1 To $dirs[0] $__glb_FileChangeRecursive_current_recurse_level += 1 If $__glb_FileChangeRecursive_current_recurse_level <= $iMaxRecurseLevel Then $retval = DirListRecursive($sSearchPath & "\" & $dirs[$n], $sSearchPattern, $iMaxRecurseLevel, $sWorkerFunction) $__glb_FileChangeRecursive_current_recurse_level -= 1 Else $__glb_FileChangeRecursive_current_recurse_level -= 1 EndIf Next EndIf Return $nFilesFound ;**** return EndFunc ;==>DirListRecursive you can try i definetly had performence improvements
  15. If you look in my signature you will find the create process function. inside the STARTUPINFO you can specify the name of the desktop you want your process to be run DO IT BEFORE YOU SWITCH !Careful keep track of the PID otherwise you will never be able to close that desktop again. Another thing pointer to NULL strings are different in AUTOIT from C and you cannot use just 0 so $NouveauBureau = DLLCall("user32.dll","int","CreateDesktop","str","NouveauBureau", "str",Pt_emptyStr,"ptr",Pt_emptyStr,"int",0,"int",0x10000000,"ptr",Pt_emptyStr) DllCall('user32.dll', 'int', 'SetThreadDesktop', 'hwnd', $NouveauBureau[0]) DLLCall("user32.dll","int","SwitchDesktop",'hwnd',$NouveauBureau[0]) Func Pt_emptyStr() $str="" $temp = DllStructCreate("char [" & Stringlen($str) + 1 & "]") DllStructSetData($temp,1, $str) $P_empty = DllStructGetPtr($temp) Return $P_empty EndFunc is the correct function
  16. If you are patient I am planning to upload a complete multi monitor library tonight. Screen resolution tested on several pcs always working and you can chose how and where to perform it. Should be more or less complete tonight
  17. sometimes the stystem does not allow you to delete a hidden file unless you reset its attribute (equivalent of attrib -h * in dos).
  18. By tonight you will have a full multi-monitor library available (if i manage to complete the fist beta) You will so able to change resolution on a temporary mode without rewriting all the times the registry. wait and see
  19. 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 problem IF 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 =0x00000040 Global Const $BELOW_NORMAL_PRIORITY_CLASS =0x00004000 Global Const $NORMAL_PRIORITY_CLASS =0x00000020 Global Const $ABOVE_NORMAL_PRIORITY_CLASS =0x00008000 Global Const $HIGH_PRIORITY_CLASS =0x00000080 Global Const $REALTIME_PRIORITY_CLASS =0x00000100 Global Const $DETACHED_PROCESS =0x00000008 Global Const $CREATE_NEW_CONSOLE=0x00000010 ; ============================================================================== ; Startup Constants ; ============================================================================== Global Const $STARTF_USESHOWWINDOW = 0x00000001 Global Const $STARTF_USESIZE = 0x00000002 Global Const $STARTF_USEPOSITION = 0x00000004 Global Const $STARTF_USECOUNTCHARS = 0x00000008 Global Const $STARTF_USEFILLATTRIBUTE = 0x00000010 Global Const $STARTF_RUNFULLSCREEN = 0x00000020 Global Const $STARTF_FORCEONFEEDBACK = 0x00000040 Global Const $STARTF_FORCEOFFFEEDBACK = 0x00000080 Global Const $STARTF_USESTDHANDLES = 0x00000100 ; =============================================================================== ; ShowWindow Constants ; ================================================================================= Global Const $SW_HIDE = 0 Global Const $SW_SHOWNORMAL = 1 Global Const $SW_NORMAL = 1 Global Const $SW_SHOWMINIMIZED = 2 Global Const $SW_SHOWMAXIMIZED = 3 Global Const $SW_MAXIMIZE = 3 Global Const $SW_SHOWNOACTIVATE = 4 Global Const $SW_SHOW = 5 Global Const $SW_MINIMIZE = 6 Global Const $SW_SHOWMINNOACTIVE = 7 Global Const $SW_SHOWNA = 8 Global Const $SW_RESTORE = 9 Global Const $SW_SHOWDEFAULT = 10 Global Const $SW_FORCEMINIMIZE = 11 Global 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] & $param Next ConsoleWrite ($Output & @CR) EndFunc
  20. Hola BRAVISSIMO, you beat me on posting. i am compiling a full library of desktop and multi monitor functions. Setting gamma is included. I call the dll in a slightly different way even if i must say it was difficult to get it right (and i believe there is still space for improvement) The whole library will be loaded by tonight i hope. The code comes from many source but view your experience on a similar topic I will appreciate all your comments and possible extensions. The real nighmare is to make things work on multi-monitor set up and i must say there is still such a huge lack of info on this topic that anybody that can help is absolutely welcome.
Γ—
Γ—
  • Create New...