UEZ

GDI+ Color Transformer v0.9.7 build 2016-04-23

16 posts in this topic




Very nice work UEZ !

Look nice too !

You could add some tooltips for help to understand each effect setting.

It gives nice effects ( and so why not call it GdiPhotoEffects ? )  o:)

Didn't find any bug (win7x64)

Thanks to share this little jewel !  :thumbsup:


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

Thanks for your comments wakillon!

You could add some tooltips for help to understand each effect setting.

I assume that information about each effect will go beyond the scope of the tool tip. ;)

It gives nice effects ( and so why not call it GdiPhotoEffects ? )

Well, it manipulates only the colors of an image not any pixel and that's the reason why I called it that way. Calling it Photo Effects will convey a false impression imho.

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Ok, but do the Blur effect change only colors ?


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Hmm, I think yes but I'm not really sure. I will make a test soon.

Ok, you got me! ;)  The Blur effect manipulates also the pixels.

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Very nice work UEZ !

thank you

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

very nice UEZ, lot of work. xp users >who follow these instructions to obtain complete gdiplus 1.1 functionality, have the gdiplus.dll v 6.x in the script directory. that is why i recommend the following _GDIPlus_Startup() function:

 

Edited code

Func _GDIPlus11_Startup() ;code by Authenticity - modified by UEZ - modified by Edano
    $giGDIPRef += 1
    If $giGDIPRef > 1 Then Return True

    ; check system version first
    Global $ghGDIP_DLL_location="GDIPlus.dll"; sometimes needed eg for convolution.au3
    If Number(FileGetVersion($ghGDIP_DLL_location))<6 Then; OS Vista or higher v 6.x.x.x

        ; OS XP v 5.x.x.x
        $ghGDIP_DLL_location=@ScriptDir&"\GDIPlus.dll"; check local
        If Number(FileGetVersion($ghGDIP_DLL_location))<6 Then
            MsgBox(0x40010,"Error","This script only runs on OS Vista or higher."&@CRLF&@CRLF&"For XP you need a GDIPlus.dll v1.1 in the script directory, refer to:       "&@CRLF&"http://www.winsxs.org/?OtherTech/thread-13-1-1")
            Return False
        EndIf
    EndIf

    $ghGDIPDll = DllOpen($ghGDIP_DLL_location)
    If $ghGDIPDll = -1 Then
        $giGDIPRef = 0
        Return SetError(1, 2, False)
    EndIf

    Local $tInput = DllStructCreate($tagGDIPSTARTUPINPUT)
    Local $tToken = DllStructCreate("ulong_ptr Data")
    DllStructSetData($tInput, "Version", 1)
    Local $aResult = DllCall($ghGDIPDll, "int", "GdiplusStartup", "struct*", $tToken, "struct*", $tInput, "ptr", 0)
    If @error Then Return SetError(@error, @extended, False)
    $giGDIPToken = DllStructGetData($tToken, "Data")
    Return $aResult[0] = 0
EndFunc   ;==>__GDIPlus_Startup
Edited by Edano

[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

@Edano: does it work for you also on WinXP?

I didn't include the check for Win XP because it is experimental (somehow I didn't get it run in my WinXP vm)!

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

@Edano: does it work for you also on WinXP?

I didn't include the check for Win XP because it is experimental (somehow I didn't get it run in my WinXP vm)!

Br,

UEZ

 

yes, it works. you must follow the exactly, then you use the gdiplus v1.1 dll in the script directory. all effects work like a charm. be very careful with the hex editor, as i pointed it out. copy the three files needed from a vista or win7 OS. i use winxp pro service pack 3, can't say if that is important.

try it again and tell me if you're stuck. maybe by PM ?

Edano

 

Edit PM sent

Edited by Edano

[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Share this post


Link to post
Share on other sites

Thank you Very much UEZ. I register this website for thank you eiei.

your code help me very much.

Share this post


Link to post
Share on other sites

Your are welcome. What did you do which this tool?

What does "eiei" mean?

 

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Hi UEZ, congratulations for this cool tool, as usual coming from you.

Perhapsyou can help me, I'm getting some errors hen I attempt to run it, I believe it comesfrom GDI but not figured out how to solve it.Thanks in advance and regards.

 

"C:TempAU3GDIGDI-Color TransormerGDI+ Color Transformer.au3"(70,151) : error: $tagGDIPCOLORMATRIX previously declared as a 'Const'.
Global Const $tagGDIPCOLORMATRIX = "float m[25];" ; [5][5] matrix; [0][0] - red, [1][1] - green, [2][2] - blue; [3][3] - alpha, [4][4] - ~should~ be 1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:TempAU3GDIGDI-Color TransormerGDI+ Color Transformer.au3"(102,52) : error: $GDIP_RLUM previously declared as a 'Const'.
Global $GDIP_RLUM = $iSlider_GSLumRed_Default / 100,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:TempAU3GDIGDI-Color TransormerGDI+ Color Transformer.au3"(102,100) : error: $GDIP_GLUM previously declared as a 'Const'.
Global $GDIP_RLUM = $iSlider_GSLumRed_Default / 100, $GDIP_GLUM = $iSlider_GSLumGreen_Default / 100,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:TempAU3GDIGDI-Color TransormerGDI+ Color Transformer.au3"(102,166) : error: $GDIP_BLUM previously declared as a 'Const'.
Global $GDIP_RLUM = $iSlider_GSLumRed_Default / 100, $GDIP_GLUM = $iSlider_GSLumGreen_Default / 100, $GDIP_BLUM = $iSlider_GSLumBlue_Default / 100; ; Colors luminace
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:TempAU3GDIGDI-Color TransormerGDI+ Color Transformer.au3"(860,48) : error: $GDIP_RLUM previously declared as a 'Const'.
   $GDIP_RLUM = $iSlider_GSLumRed_Default / 100
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:TempAU3GDIGDI-Color TransormerGDI+ Color Transformer.au3"(861,50) : error: $GDIP_GLUM previously declared as a 'Const'.
   $GDIP_GLUM = $iSlider_GSLumGreen_Default / 100
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:TempAU3GDIGDI-Color TransormerGDI+ Color Transformer.au3"(862,49) : error: $GDIP_BLUM previously declared as a 'Const'.
   $GDIP_BLUM = $iSlider_GSLumBlue_Default / 100
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:TempAU3GDIGDI-Color TransormerGDI+ Color Transformer.au3"(1093,54) : error: $GDIP_BLUM previously declared as a 'Const'.
   $GDIP_BLUM = GUICtrlRead($iSlider_GSLumBlue) / 100
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:TempAU3GDIGDI-Color TransormerGDI+ Color Transformer.au3"(1098,55) : error: $GDIP_GLUM previously declared as a 'Const'.
   $GDIP_GLUM = GUICtrlRead($iSlider_GSLumGreen) / 100
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:TempAU3GDIGDI-Color TransormerGDI+ Color Transformer.au3"(1103,53) : error: $GDIP_RLUM previously declared as a 'Const'.
   $GDIP_RLUM = GUICtrlRead($iSlider_GSLumRed) / 100
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:TempAU3GDIGDI-Color TransormerGDI+ Color Transformer.au3"(1224,114) : error: _WinAPI_CopyImage() already defined.
Func _WinAPI_CopyImage($hImage, $iType = 0, $xDesired = 0, $yDesired = 0, $iFlags = 0); from _WinAPIEx by Yashied
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:TempAU3GDIGDI-Color TransormerGDI+ Color Transformer.au3"(1324,38) : error: _GDIPlus_ImageAttributesCreate() already defined.
Func _GDIPlus_ImageAttributesCreate()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:TempAU3GDIGDI-Color TransormerGDI+ Color Transformer.au3"(1336,56) : error: _GDIPlus_ImageAttributesDispose() already defined.
Func _GDIPlus_ImageAttributesDispose($hImageAttributes)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:TempAU3GDIGDI-Color TransormerGDI+ Color Transformer.au3"(1342,163) : error: _GDIPlus_ImageAttributesSetColorMatrix() already defined.
Func _GDIPlus_ImageAttributesSetColorMatrix($hImageAttributes, $iColorAdjustType = 0, $fEnable = False, $pClrMatrix = 0, $pGrayMatrix = 0, $iColorMatrixFlags = 0)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:TempAU3GDIGDI-Color TransormerGDI+ Color Transformer.au3"(1356,43) : error: _GDIPlus_ColorMatrixCreateGrayScale() already defined.
Func _GDIPlus_ColorMatrixCreateGrayScale()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:TempAU3GDIGDI-Color TransormerGDI+ Color Transformer.au3"(1369,42) : error: _GDIPlus_ColorMatrixCreateNegative() already defined.
Func _GDIPlus_ColorMatrixCreateNegative()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:TempAU3GDIGDI-Color TransormerGDI+ Color Transformer.au3"(1378,74) : error: _GDIPlus_ColorMatrixCreateScale() already defined.
Func _GDIPlus_ColorMatrixCreateScale($nRed, $nGreen, $nBlue, $nAlpha = 1)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:TempAU3GDIGDI-Color TransormerGDI+ Color Transformer.au3"(1389,55) : error: _GDIPlus_EffectCreate() already defined.
Func _GDIPlus_EffectCreate($sEffectGUID, $pEffect = 0)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:TempAU3GDIGDI-Color TransormerGDI+ Color Transformer.au3"(1410,38) : error: _GDIPlus_EffectDispose() already defined.
Func _GDIPlus_EffectDispose($pEffect)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:TempAU3GDIGDI-Color TransormerGDI+ Color Transformer.au3"(1416,114) : error: _GDIPlus_DrawImageFX() already defined.
Func _GDIPlus_DrawImageFX($hGraphics, $hBitmap, $tRECTF, $pEffect, $hMatrix = 0, $pImgAttributes = 0, $iUnit = 2)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:TempAU3GDIGDI-Color TransormerGDI+ Color Transformer.au3 - 20 error(s), 0 warning(s)
!>10:58:56 AU3Check ended. Press F4 to jump to next error.rc:2
>Exit code: 2    Time: 0.688

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

The code works only for v3.3.8.1 or lower. I didn't update the code yet to run it also for > 3.3.9.x.

Edit: it seems very hard to update the code to run properly on > 3.3.9.x.

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

UEZ, okey dokey,  no problem.

Thanks for the answer and the beautifull peace of code.

Br.

Share this post


Link to post
Share on other sites

Is this still only working on v3.3.8.1 or lower?


All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Share this post


Link to post
Share on other sites

Yes, because those GDI+ functions have been added to the GDIPlus.au3 meanwhile but with different function calls, etc. which is a nightmare to adjust the whole code now.

Further I didn't update the code - it is still the same as posted.


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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

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

  • Similar Content

    • SimTheNo1
      By SimTheNo1
      I am busy with building a solution for change monitoring of VOIP call program and to be properly automated means among others need for some limited OCR functionality. Current works of others are way too much overkill for this case what makes the need to build it myself. But to do it properly I significantly have to increase my knowledge about digital graphics management.
      For now I already have discovered here and there some mind blowing  Autoit miracles what can be achieved with Windows own possibilities to manipulate that what is output to the monitor. And as far I can judge there are 2 options to process graphics without use of any external libraries like ImageMagick, FreeImage and so on. These are:
       WinAPI  GDIPlus It is for me quite obvious to have various holes in general understanding of graphics and it is once more very clear what advantages gives consistent general study in 1 or another official institutions like University.  Cause there you are introduced into certain domain of knowledge in a way which usually has been perfected over long period of time. So you are not overloaded by stuff which requires a certain amount of information to be initially clear for you. For example, before starting to solve physics you first learn to read, count and so on and then move to subjects like physics.
      Though in my case opportunity to study in such educational system I had only for 8 years, from my 7th to 15th year of age in the country that was falling apart now Ukraine but used to be USSR, was all what it was. After have immigrated to Netherlands possibilities to study further haven't occur. And this therefor causes often various implications when going deep in that or another field of practical knowledge acquiring for any needed physical result, like programming to perform enormous amount of tasks. In this particular case automating VOIP call program.
      Anyway, right now I think the best direction to move is to concentrate on as basic as possible image management and if someone would maybe explain in general what is a pixel will definitely help. Particularly I am very curious about how to do picture manipulations in Autoit. Especially would help a lot to produce eventually following functions:
      createImage($imageFileName, $width, $height, $color) readImagePixel($imageFileName, $x, $y)  writeImagePixel($imageFileName, $x, $y) I do not know exactly how image is handled in computer but preferably above mentioned functions should deal with so far possible origin of graphics creation on computer. But nevertheless I definitely would love to hear any proposition for solution.
      The problem with explaining screenshots:
       VOIPConnect full Window  Part of Window with control to monitor for changes  Exact location of area where actual changes occur and have to be processed  It comes down to a rectangle of approximately 51 pixel wide and 7 pixel high. In fact if I get to learn as far as to be able exactly read, write and compare 2 images consistently across different computers I could narrow down then even further the area to watch as little as a square of 2-5 pixels wide. 
      To finish here is last detail about particularly no need for ultra fast solution at all. This because it is needed only once when it is first run on a new computer and to have to wait few minutes while it is being set instead of just a few seconds make no sence.
      This is it and what I too think to do beside this very particular case is to purify out beautiful generic Autoit functions for core image manipulation by using WinAPI or/and GDIPlus. 
    • AndyS19
      By AndyS19
      I have a listview with 3 columns and I want to set the 3rd column's color based on the item's 'Param' value, but even though I set up for the 3rd column, the entire row always gets the color.
      My test code is below, but here is the pertinent code:
      Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam, $ilParam Local $hWndFrom, $iCode, $tNMHDR $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hListView Switch $iCode Case $NM_CUSTOMDRAW Local $iDrawStage, $tCustDraw $tCustDraw = DllStructCreate($tagNMLVCUSTOMDRAW, $ilParam) $iDrawStage = DllStructGetData($tCustDraw, 'dwDrawStage') Switch $iDrawStage Case BitOR(0, $CDDS_ITEMPREPAINT) ;, $CDDS_SUBITEM) setItemColor($tCustDraw, $hWndFrom) Return $CDRF_NOTIFYSUBITEMDRAW EndSwitch EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Func setItemColor($tCustDraw, $hWnd) Local $iIndex, $color, $iSubitem $iIndex = DllStructGetData($tCustDraw, 'dwItemSpec') ; item number $color = _GUICtrlListView_GetItemParam($hWnd, $iIndex) $iSubitem = DllStructGetData($tCustDraw, 'iSubItem') ; Here, I want to only change the color of the 3rd col, and not the 1st and 2nd cols DllStructSetData($tCustDraw, 'iSubItem', 2) ; always use the 3rd column (the 'sample' col) logmsg("+++: setItemColor($tCustDraw, 0x" & Hex($hWnd) & ") entered ... " _ & ", $iIndex = " & $iIndex & ", $iSubItem = " & $iSubitem & ", $color = " & Hex($color)) DllStructSetData($tCustDraw, 'clrText', $color) ; set the Text color DllStructSetData($tCustDraw, 'clrTextBk', bitnot($color)) ; set the background color EndFunc ;==>setItemColor Func logmsg($msg, $lnum = @ScriptLineNumber) ConsoleWrite("+++:" & $lnum & ": " & $msg & @CRLF) EndFunc ;==>logmsg
      Here is the full test code:
      #include-once ;#cs #NoTrayIcon #AutoIt3Wrapper_UseUpx=n #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #AutoIt3Wrapper_UseX64=N Opt("GUICloseOnESC", 1) ; ESC closes GUI? (0 = no, 1 = yes) Opt("GUIOnEventMode", 1) ; Change to OnEvent mode Opt('MustDeclareVars', 1) OnAutoItExitRegister("_test_exit") Opt("GUIEventOptions", 1) ;0=default, 1=just notification, 2=GuiCtrlRead tab index Opt("WinTitleMatchMode", -2) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase #include <GuiListBox.au3> #include <ListViewConstants.au3> #include <GuiListView.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <ColorConstants.au3> Global $__MCP_obj, $__MCP_GUI_hWnd, $idListView, $hListView Global $hMainWin test() Exit Func test() $hMainWin = GUICreate("Test window", 120, 100, @DesktopWidth / 2, -1) GUICtrlCreateButton("Hwnd", 10, 10, 40, 20) GUICtrlSetOnEvent(-1, "handle_1stTEST_btn") GUICtrlCreateButton("ID", 50, 10, 40, 20) GUICtrlSetOnEvent(-1, "handle_2ndTEST_btn") GUISetOnEvent($GUI_EVENT_CLOSE, "_test_exit") GUISetState(@SW_SHOW) While (1) Sleep(17) WEnd EndFunc ;==>test Func _myColorPicker($obj) logmsg("+++: $obj = 0x" & Hex($obj) & @CRLF) Local $flags = 0 Local $ww, $wh, $x, $y, $w, $h $__MCP_obj = $obj $ww = 350 $wh = 500 $x = 200 $y = 150 $__MCP_GUI_hWnd = GUICreate("myColorPicker", $ww, $wh, $x, $y, $flags) $x = 10 $y = 10 $w = 150 $h = 20 GUICtrlCreateButton("Set caller's color", $x, $y, $w, $h) GUICtrlSetOnEvent(-1, "__MCP_handle_SetColor_btn") $y += $h + 5 $w = $ww - 25 $h = $wh - 100 $idListView = GUICtrlCreateListView("", $x, $y, $w, $h, -1, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT)) $hListView = GUICtrlGetHandle($idListView) $x = $ww / 2 - 50 $y = $wh - 60 $w = 100 $h = 25 GUICtrlCreateButton("Quit Popup", $x, $y, $w, $h) GUICtrlSetOnEvent(-1, "__MCP_handle_QUIT_btn") GUICtrlSetFont($idListView, 8.5, -1, -1, "courier new") _GUICtrlListView_AddColumn($idListView, "Name", 100) _GUICtrlListView_AddColumn($idListView, "Value", 100) _GUICtrlListView_AddColumn($idListView, "Sample", 100) _GUICtrlListView_SetColumnWidth($idListView, 0, 100) _GUICtrlListView_SetColumnWidth($idListView, 1, 80) logmsg("+++: $idListView = " & $idListView) logmsg("+++: $hListView = 0x" & Hex($hListView)) __MCP_populateListView($hListView) GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUISetState(@SW_SHOW, $__MCP_GUI_hWnd) EndFunc ;==>_myColorPicker Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam, $ilParam Local $hWndFrom, $iCode, $tNMHDR $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hListView Switch $iCode Case $NM_CUSTOMDRAW Local $iDrawStage, $tCustDraw $tCustDraw = DllStructCreate($tagNMLVCUSTOMDRAW, $ilParam) $iDrawStage = DllStructGetData($tCustDraw, 'dwDrawStage') Switch $iDrawStage Case BitOR(0, $CDDS_ITEMPREPAINT) ;, $CDDS_SUBITEM) setItemColor($tCustDraw, $hWndFrom) Return $CDRF_NOTIFYSUBITEMDRAW EndSwitch EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Func setItemColor($tCustDraw, $hWnd) Local $iIndex, $color, $iSubitem $iIndex = DllStructGetData($tCustDraw, 'dwItemSpec') ; item number $color = _GUICtrlListView_GetItemParam($hWnd, $iIndex) $iSubitem = DllStructGetData($tCustDraw, 'iSubItem') ; Here, I want to only change the color of the 3rd col, and not the 1st and 2nd cols DllStructSetData($tCustDraw, 'iSubItem', 2) ; always use the 3rd column (the 'sample' col) logmsg("+++: setItemColor($tCustDraw, 0x" & Hex($hWnd) & ") entered ... " _ & ", $iIndex = " & $iIndex & ", $iSubItem = " & $iSubitem & ", $color = " & Hex($color)) DllStructSetData($tCustDraw, 'clrText', $color) ; set the Text color DllStructSetData($tCustDraw, 'clrTextBk', bitnot($color)) ; set the background color EndFunc ;==>setItemColor Func logmsg($msg, $lnum = @ScriptLineNumber) ConsoleWrite("+++:" & $lnum & ": " & $msg & @CRLF) EndFunc ;==>logmsg Func __MCP_exit() GUIDelete($__MCP_GUI_hWnd) EndFunc ;==>__MCP_exit Func __MCP_handle_SetColor_btn() If (IsHWnd($__MCP_obj)) Then GUISetBkColor($COLOR_BLUE, $__MCP_obj) Else GUICtrlSetBkColor($__MCP_obj, $COLOR_BLUE) EndIf EndFunc ;==>__MCP_handle_SetColor_btn Func __MCP_populateListView($hWnd) Local $text, $parts, $iIndex Local Static $aItems[] = [ _ "BLACK | " & $CLR_BLACK & "|" & "", _ "BLUE | " & $CLR_BLUE & "|" & "", _ "RED | " & $CLR_RED & "|" & "", _ "WHITE | " & $CLR_WHITE & "|" & "", _ "YELLOW | " & $CLR_YELLOW & "|" & "" _ ] _GUICtrlListView_BeginUpdate($hWnd) _GUICtrlListView_DeleteAllItems($hWnd) For $ndx = 0 To UBound($aItems) - 1 $text = $aItems[$ndx] $parts = StringSplit($text, "|", 2) $parts[0] = StringStripWS($parts[0], 3) $parts[2] = StringStripWS($parts[2], 3) $iIndex = _GUICtrlListView_AddItem($hWnd, $parts[0], -1, $parts[1]) _GUICtrlListView_AddSubItem($hWnd, $iIndex, Hex($parts[1]), 1) _GUICtrlListView_AddSubItem($hWnd, $iIndex, $parts[0], 2) Next _GUICtrlListView_EndUpdate($hWnd) EndFunc ;==>__MCP_populateListView Func __MCP_handle_QUIT_btn() GUIDelete($__MCP_GUI_hWnd) EndFunc ;==>__MCP_handle_QUIT_btn Func handle_1stTEST_btn() _myColorPicker($hMainWin) EndFunc ;==>handle_1stTEST_btn Func handle_2ndTEST_btn() _myColorPicker(@GUI_CtrlId) EndFunc ;==>handle_2ndTEST_btn Func _test_exit() Exit EndFunc ;==>_test_exit  
    • UritOR
      By UritOR
      Hi all,
      I'm trying to find how to draw an image (create a label in mspaint) and save it as .bmp. And set it to be a wallpaper
      I also need to know what wallpaper is use now, for restore it when the script is closed.
      What is the best way to do it? Do I need Gdi+ for it?  I use this code (which I found here in forum) to set a .bmp file as wallpaper:
      Func _ChangeWallpaper($sFile,$iType) ; Changes the wallpaper to $sFilename using $iType as: ; 1 Tiled ; 2 Centered ; 3 Stretched ; any other value (usually 0) unchanged ; ; Returns ; 0 if everything is allright. ; -1 if $sFile does not exist. @error is set to 1 ; -2 if £sFile is not a .bmp file. @error is set to 2 If Not FileExists($sFile) Then SetError(1) Return -1 EndIf If StringTrimLeft($sFile,StringInStr($sFile,'.',0,-1)) <> 'bmp' Then SetError(2) Return -2 EndIf Select Case $iType = 1 RegWrite('HKCU\Control Panel\Desktop','TileWallpaper','reg_sz','1') RegWrite('HKCU\Control Panel\Desktop','WallpaperStyle','reg_sz','0') Case $iType = 2 RegWrite('HKCU\Control Panel\Desktop','TileWallpaper','reg_sz','0') RegWrite('HKCU\Control Panel\Desktop','WallpaperStyle','reg_sz','0') Case $iType = 3 RegWrite('HKCU\Control Panel\Desktop','TileWallpaper','reg_sz','0') RegWrite('HKCU\Control Panel\Desktop','WallpaperStyle','reg_sz','2') Case Else EndSelect RegWrite('HKCU\Control Panel\Desktop','Wallpaper','reg_sz',$sFile) DllCall("User32.dll","int","SystemParametersInfo","int",20,"int",0,"str",$sFile,"int",0) Return 0 EndFunc  
      The flow that I understand should be:
      1) Check what wallpaper is in use now. I can find the path to it by going to registry  key named "wallpaper" here :[HKEY_CURRENT_USER\Control Panel\Desktop]
      2) Create a file mspaint
      3) Create a label with its properties (size,color) in this file
      3) Save this file in some temporary directory
      4) Set a created file as a wallpaper using the above code
      5) When the script is closed restore the old wallpaper.
       
      So again, my question is how to create a .bmp file with label in it?
    • Ian_Mac
      By Ian_Mac
      Func dg_get_images() $x1=0 $y1=0 ;MsgBox(0,"start","start") do $result = _ImageSearch("C:\Users\Server\Desktop\my project\image.png",1,$x1,$y1,0) until $result = 1; if $result=1 Then MouseMove($x1,$y1,3) MouseClick("left", $x1,$y1, 1) WinWait("[Title:TightVNC File Transfer]", "", 10) EndIf  this code works when i search the image, but when i change the location of the desktop icon it can't find the desktop icon anymore.   i wanna try image search area. but i don't know how to use it because i cant understand the parameter for the image search area.  please help me how to solve it thank you in advance.