Jump to content

Recommended Posts

Posted (edited)

Thank you!
I will use it to improve this script I did a long time ago:

'?do=embed' frameborder='0' data-embedContent>>

That script contols Magnifier in very primitive way (at that time when i made that script i was less talented so I did it in bad way..)

Edited by Guest
Posted

Right, I cracked that last little undocumented function.  All is well now!

Update:

- _MagnifierFullScreenSetScale() now works on Win7. Don't fully understand the offsets tho?

- Added 1 more function

- 64-bit mode restart if 64-bit O/S

By the way, I'm not sure, but the values for XOffset and YOffset for _MagnifierFullScreenSetScale() may differ betwen Windows 7 and Windows 8?  Right now it seems a bit odd that I have to feed a negative # in but perhaps there's logic in there somewhere?

Oh, UEZ good to see you - would you happen to have any clever ideas on matrix transformations for colors? You are a whiz at matrix stuff after all..  There's a link off here that describes how transforms work on colors with these matrices..

Posted

can you include a function that show if the feature "invert colors" is turned on or off?

 
In the past I tried to think of a way to know this ..
It would be very helpful for me if you include a function that gives this information
Posted

Guess this was today's obession.  New update:

Update #2!

- Added General SetColorEffect functions which take matrices as 2D arrays now

  This also simplified other functions, and the matrixes look nicer

- Added GetColorEffect functions which return 2D arrays

- Added _MagnifierIsInvertColorsStyle() to detect if a Magnify Control has the MS_INVERTCOLORS flag set.  Note this will be set even after a SetColorEffect operation, so be aware!

- Added _MagnifierSetInvertColorsStyle() which allows enabling/disabling Invert-Colors operation of the Magnify Control (by setting/clearing MS_INVERTCOLORS flag and refreshing the Control contents)

gil900, I added the function, but read the comments!  the 'invert colors' flag can be on even if the colors have been 'corrected', although its probably best to use the other function MagnifierSetInvertColorsStyle() to clear it before using any SetColorEffect functions.

Posted (edited)

Here some color matrices which you can use -> http://docs.rainmeter.net/tips/colormatrix-guide

Scale doesn't work for (_MagnifierFullScreenSetScale(2.0, -1*@DesktopWidth / 2, -1*@DesktopHeight / 2)) - get an black screen only.

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Posted

Updated

2014-05-12:

 - Added: Color Effects Matrix constants for typical effects like Invert Colors, Grayscale, Sepia tone - pass these as parameters to the SetColorEffect functions

 - Removed: Grayscale functions - use the Color Effect Matrix as a paramer to SetColorEffect functions instead

- Added: More annoying Msgboxes! (with more examples between!)

UEZ - Do you have Windows 8?  It might just be that the Windows 7 function requires negative numbers.  From what I gather, something like this might work for Windows 8:

_MagnifierFullScreenSetScale(2.0, @DesktopWidth / 4, @DesktopHeight / 4)

Might have to experiment with various settings though!

Posted

I have the same system as UEZ and I too get the black screen problem.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Posted

UEZ and guinness, thanks for not testing the single line of code I posted above for testing on Win 8. lol..

Posted

_MagnifierFullScreenSetScale(2.0, @DesktopWidth / 4, @DesktopHeight / 4) works on Win8.  :D 

Br,

UEZ
 

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Posted

UEZ and guinness, thanks for not testing the single line of code I posted above for testing on Win 8. lol..

You asked UEZ, not me! But it solved the issue, happy now? -_0

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

  • 3 months later...
Posted

I made some small changes, and added an example script which lets you invert the colors on the screen (Win7+) via Tray controls. The last bit was inspired by a post long ago by gil900 about Inversion being better than the Windows Dimmer/Shade/Spotlight eyestrain solutions that I've put up.

2014-08-25:
- Changed: WinMagnifier UDF is now separate from the examples
- Changed: MagnifierExperiments is a separate script
- Changed: Full-screen Scale example now adjusts correctly for Win8+
- Added: MagnifierScreenInverter example - invert screen colors via Tray
- Added: _MagnifierColorEffectIsEqual() - compare two Color Matrices for Equality

  • 5 months later...
Posted

Have you any idea on how to keep the "colors" intact while inverting the "grayscales" only (in order to protect our eyes whitout leaving in a "negative colors" world)?

  • 1 month later...
Posted

I've found this UDF and it seems perfect for magnifying a fixed area of my screen (eventually, this system tray).

But I haven't been able to get it to magnify any area that doesn't start at the top left corner.

#include "WinMagnifier.au3"

_MagnifierInit()

$aTmp = _MagnifierGUICreate(1200, 800, 200, 100) ; , $iX1, $iY1, $bInvertColors, $bShowCursor)
$hMagnifyGUI = $aTmp[0]
$hMagnifyCtrl = $aTmp[1]
_MagnifierSetSource($hMagnifyGUI, 200, 100, 800, 500)   ;<<<< HAS NO EFFECT
_MagnifierSetScale($hMagnifyCtrl, 2)

GUISetState(@SW_SHOW, $hMagnifyGUI)
Sleep(5000)

GUIDelete($hMagnifyGUI)
_MagnifierUnInit()

Obviously I'm missing something.  But what?

Also, what is the proper way to update the contents of the GUI after it has been displayed?  Plus, I'm a little uncertain as to when _MagnifierInit() is required.

Thanks in advance for help.

 

  • 2 weeks later...
Posted

I've found this UDF and it seems perfect for magnifying a fixed area of my screen (eventually, this system tray).

But I haven't been able to get it to magnify any area that doesn't start at the top left corner.

#include "WinMagnifier.au3"

_MagnifierInit()

$aTmp = _MagnifierGUICreate(1200, 800, 200, 100) ; , $iX1, $iY1, $bInvertColors, $bShowCursor)
$hMagnifyGUI = $aTmp[0]
$hMagnifyCtrl = $aTmp[1]
_MagnifierSetSource($hMagnifyGUI, 200, 100, 800, 500)   ;<<<< HAS NO EFFECT
_MagnifierSetScale($hMagnifyCtrl, 2)

GUISetState(@SW_SHOW, $hMagnifyGUI)
Sleep(5000)

GUIDelete($hMagnifyGUI)
_MagnifierUnInit()

Obviously I'm missing something.  But what?

Also, what is the proper way to update the contents of the GUI after it has been displayed?  Plus, I'm a little uncertain as to when _MagnifierInit() is required.

Thanks in advance for help.

 

you should pass the handle $hMagnifyCtrl  instead of $hMagnifyGUI to the _MagnifierSetSource function

#include <GUIConstantsEx.au3>
#include "WinMagnifier.au3"

_MagnifierInit()

$aTmp = _MagnifierGUICreate(500, 250, 200, 100) ; , $iX1, $iY1, $bInvertColors, $bShowCursor)
$hMagnifyGUI = $aTmp[0]
$hMagnifyCtrl = $aTmp[1]
; _MagnifierSetSource($hMagnifyGUI, 200, 100, 800, 500)   ;<<<< HAS NO EFFECT
_MagnifierSetScale($hMagnifyCtrl, 2)

GUISetState(@SW_SHOW, $hMagnifyGUI)
; Sleep(5000)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
    $aCoords = MouseGetPos()
    _MagnifierSetSource($hMagnifyCtrl, $aCoords[0], $aCoords[1], 100, 100)
WEnd

GUIDelete($hMagnifyGUI)
_MagnifierUnInit()

>here some other tests I've tried

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Posted

Thanks for pointing that out.  My script was pretty crude, as I was just trying to get a handle on your UDF's basic operation.

I now have the magnified window following the cursor by moving both the Source Area and the Displayed Result in tandem.  It's not as smooth as I'd like, but it doesn't require any timers or other triggers.

I'll play with it over the next days and see what I can make of it.

Thanks, again.

Posted

In working with this UDF, I've noticed a DLL call in the function _MagnifierSetSource() that seems to execute on each call such that a new structure is created each time:

$stRect = DllStructCreate("long[4];")

This normally wouldn't be a particular problem, but I'm trying to drag the window and am calling "set source" many times each second.

Can someone familiar with structures confirm that this is a problem? ... and maybe suggest a solution or an alternative?

Thanks in advance.

  • 4 months later...
Posted (edited)

By the way, I'm not sure, but the values for XOffset and YOffset for _MagnifierFullScreenSetScale() may differ betwen Windows 7 and Windows 8?  Right now it seems a bit odd that I have to feed a negative # in but perhaps there's logic in there somewhere?

 

Thanks again
For the problem with Windows 7-,
My solution is to change _MagnifierInit() from this:

Func _MagnifierInit()
    If $g_hMagnificationDLL <> -1 Then Return 1

    $g_hMagnificationDLL = DllOpen("Magnification.dll")
    If $g_hMagnificationDLL = -1 Then Return SetError(-1, 0, 0)

    Local $aRet = DllCall($g_hMagnificationDLL, "bool", "MagInitialize")
    If @error Or Not $aRet[0] Then
        Local $iErr = @error
        DllCall($g_hMagnificationDLL, "bool", "MagUninitialize")
        DllClose($g_hMagnificationDLL)
        $g_hMagnificationDLL = -1
        Return SetError(-1, $iErr, 0)
    EndIf

    ; Check on Windows 7+ and 8+ Magnifier Full-screen API functions support
    If _WinAPI_GetProcAddress(_WinAPI_GetModuleHandle("Magnification.dll"), "MagSetFullscreenColorEffect") = 0 Then
        ; Windows 8 API not present
        ;$g_bWin8MagnifyAPIPresent = False
        If _WinAPI_GetProcAddress(_WinAPI_GetModuleHandle("user32.dll"), "SetMagnificationDesktopColorEffect") = 0 Then
            ; Window 7 API not present (Vista-level O/S)
            ;$g_bWin7MagnifyAPIPresent = False
            $g_nWinMagnifyAPILevel = 1
            ConsoleWrite("Boo, simple Vista Magnify API Present!" & @LF)
        Else
            ;$g_bWin7MagnifyAPIPresent = True
            $g_nWinMagnifyAPILevel = 7
            ConsoleWrite("Windows 7 Magnify API Present!" & @LF)
        EndIf
    Else
        ConsoleWrite("Windows 8 Magnify API Present!" & @LF)
        ;$g_bWin7MagnifyAPIPresent = False
        ;$g_bWin8MagnifyAPIPresent = True
        $g_nWinMagnifyAPILevel = 8
    EndIf

    OnAutoItExitRegister("_MagnifierUnInit")
    Return 1
EndFunc

to this:

Func _MagnifierInit()
    If $g_hMagnificationDLL <> -1 Then Return 1
    
    If @OSBuild >= 7850 Then
        $g_hMagnificationDLL = DllOpen("Magnification.dll")
    Else
        $g_hMagnificationDLL = DllOpen(@ScriptDir&'\Magnification_win8.dll')
    EndIf
    
    If $g_hMagnificationDLL = -1 Then Return SetError(-1, 0, 0)

    Local $aRet = DllCall($g_hMagnificationDLL, "bool", "MagInitialize")
    If @error Or Not $aRet[0] Then
        Local $iErr = @error
        DllCall($g_hMagnificationDLL, "bool", "MagUninitialize")
        DllClose($g_hMagnificationDLL)
        $g_hMagnificationDLL = -1
        Return SetError(-1, $iErr, 0)
    EndIf
    
    $g_nWinMagnifyAPILevel = 8 
    OnAutoItExitRegister("_MagnifierUnInit")
    Return 1
EndFunc

And you need the win 8 version of the dll.

 

 

Magnification_win8.dll

Edited by Guest

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...