Jump to content

greymouse

Members
  • Posts

    18
  • Joined

  • Last visited

Everything posted by greymouse

  1. The security for this can't be good. I mean if i want it to send an email to me with attachmen. With a new created email with usr and pw in the code. 1. Anyone can sniff the traffic, and maybe take my usr and pw. And do what they want. 2. Anyone can decompile my program which is easy to do, and take my usr and pw. So how can i secure this? I know that it's possible to send emails with php without using any passwords or usernames. Just using a email address and then send it.
  2. I mean, it should close the minimap. And then open it. Not be open forever. ^ And here is what i want it to be ^ With the pixels that "BitmapCreateFromScan0" saves. Need to be cleared. Because if i load a new "text2.txt" it's will not be cleared. ^ Here is the example for that, test2.txt added as attachment. ^ #include <GuiConstantsEx.au3> #include <GDIPlus.au3> #include <misc.au3> #include <file.au3> Opt('MustDeclareVars', 1) Global $hGUI, $hWnd, $hGraphic, $hPen, $hBrush, $s,$lines,$s1,$x,$color,$ss Global $s2,$file,$label,$msg,$button1 $file = @ScriptDir & "\test.txt" Global $width = 300 Global $height = 200 $hGUI = GUICreate("Test", $width, $height) guisetbkcolor("0x181717") ;~ $label = guictrlcreatelabel("",5,100,84,62) ;~ guictrlsetbkcolor(-1,"0x000000") ;~ guictrlsetstate(-1,$GUI_HIDE) $button1 = guictrlcreatebutton("Minimap",5,170,50,21) GUISetState() _GDIPlus_Startup () $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) #region exclude GUI controls from GDI+ graphic screen Global Const $GW_CHILD = 5, $GW_HWNDNEXT = 2 Global $hRegion = _GDIPlus_RegionCreateFromRect(_GDIPlus_RectFCreate(0, 0, $width, $height)) Global $hChild = _WinAPI_GetWindow($hGUI, $GW_CHILD) Global $aRect Do $aRect = ControlGetPos($hChild, "", 0) _GDIPlus_RegionCombineRect($hRegion, _GDIPlus_RectFCreate($aRect[0], $aRect[1], $aRect[2], $aRect[3]), 3) $hChild = _WinAPI_GetWindow($hChild, $GW_HWNDNEXT) Until Not $hChild _GDIPlus_GraphicsSetClipRegion($hGraphic, $hRegion) _GDIPlus_RegionDispose($hRegion) #endregion $hBrush = _GDIPlus_BrushCreateSolid(0xFF000000) $hpen = _GDIPlus_PenCreate(0xFF696969) Global $hBitmap = _GDIPlus_BitmapCreateFromScan0($width, $height) Global $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap) _GDIPlus_GraphicsFillRect($hContext, 6, 101, 81, 59, $hBrush) Global $button1_status = 1 while 1 $msg = GUIGetMsg() switch $msg case $GUI_EVENT_CLOSE _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_GraphicsDispose($hContext) _GDIPlus_BrushDispose($hBrush) _GDIPlus_PenDispose($hpen) _GDIPlus_GraphicsDispose($hgraphic) _GDIPlus_Shutdown () Exit case $button1 If $button1_status = 1 Then _GDIPlus_GraphicsFillRect($hGraphic, 6, 101, 81, 59, $hBrush) _GDIPlus_PenSetColor($hpen, 0xFF696969) _GDIPlus_GraphicsDrawRect ($hGraphic, 5, 100, 83,61,$hPen) update() _GDIPlus_GraphicsDrawImage($hgraphic, $hBitmap, 5, 100) Else $file = @ScriptDir & "\test2.txt" ; Just a test, this shouldn't be here update() ; Just a test, this shouldn't be here _GDIPlus_GraphicsDrawImage($hgraphic, $hBitmap, 5, 100) ; Just a test, this shouldn't be here EndIf $button1_status *= -1 EndSwitch WEnd func update() $lines = _FileCountLines($file) $s1 = stringsplit(filereadline($file,1),chr(32)) for $i = 2 to $lines $s = stringsplit(filereadline($file,$i),chr(32)) $ss = $s[1] $color = iniread("colors.ini","colors",$s1[$ss],0) if stringinstr($color,chr(44)) then $s2 = stringsplit($color,chr(44)) $s2 = "0xFF"&hex($s2[1],2)&hex($s2[2],2)&hex($s2[3],2) _GDIPlus_PenSetColor($hpen,$s2) Else _GDIPlus_PenSetColor($hpen,0x00000000) EndIf _GDIPlus_GraphicsDrawRect ($hContext, $s[2]*2, $s[3]*2, 1,1,$hPen) Next EndFunc Func _GDIPlus_GraphicsSetClipRegion($hGraphics, $hRegion, $iCombineMode = 0) Local $aResult = DllCall($ghGDIPDll, "uint", "GdipSetClipRegion", "hwnd", $hGraphics, "hwnd", $hRegion, "int", $iCombineMode) If @error Then Return SetError(@error, @extended, False) Return $aResult[0] = 0 EndFunc ;==>_GDIPlus_GraphicsSetClipRegion Func _GDIPlus_RegionCreateFromRect($tRectF) Local $pRectF, $aResult $pRectF = DllStructGetPtr($tRectF) $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateRegionRect", "ptr", $pRectF, "int*", 0) If @error Then Return SetError(@error, @extended, 0) Return $aResult[2] EndFunc ;==>_GDIPlus_RegionCreateFromRect Func _GDIPlus_RegionCombineRect($hRegion, $tRectF, $iCombineMode = 2) Local $pRectF, $aResult $pRectF = DllStructGetPtr($tRectF) $aResult = DllCall($ghGDIPDll, "uint", "GdipCombineRegionRect", "hwnd", $hRegion, "ptr", $pRectF, "int", $iCombineMode) If @error Then Return SetError(@error, @extended, False) Return $aResult[0] = 0 EndFunc ;==>_GDIPlus_RegionCombineRect Func _GDIPlus_RegionDispose($hRegion) Local $aResult = DllCall($ghGDIPDll, "uint", "GdipDeleteRegion", "hwnd", $hRegion) If @error Then Return SetError(@error, @extended, False) Return $aResult[0] = 0 EndFunc ;==>_GDIPlus_RegionDispose Func _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight, $iStride = 0, $iPixelFormat = 0x0026200A, $pScan0 = 0) Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $iWidth, "int", $iHeight, "int", $iStride, "int", $iPixelFormat, "ptr", $pScan0, "int*", 0) If @error Then Return SetError(@error, @extended, 0) Return $aResult[6] EndFunc ;==>_GDIPlus_BitmapCreateFromScan0test2.txt
  3. Works really nice. It's nice from you to give the whole code too.But to learn, what does all this do. And how does it work? I'm not so good at Autoit and really want to learn more each day. #region exclude GUI controls from GDI+ graphic screen Global Const $GW_CHILD = 5, $GW_HWNDNEXT = 2 Global $hRegion = _GDIPlus_RegionCreateFromRect(_GDIPlus_RectFCreate(0, 0, $width, $height)) Global $hChild = _WinAPI_GetWindow($hGUI, $GW_CHILD) Global $aRect Do $aRect = ControlGetPos($hChild, "", 0) _GDIPlus_RegionCombineRect($hRegion, _GDIPlus_RectFCreate($aRect[0], $aRect[1], $aRect[2], $aRect[3]), 3) $hChild = _WinAPI_GetWindow($hChild, $GW_HWNDNEXT) Until Not $hChild _GDIPlus_GraphicsSetClipRegion($hGraphic, $hRegion) _GDIPlus_RegionDispose($hRegion) #endregion Func _GDIPlus_GraphicsSetClipRegion($hGraphics, $hRegion, $iCombineMode = 0) Local $aResult = DllCall($ghGDIPDll, "uint", "GdipSetClipRegion", "hwnd", $hGraphics, "hwnd", $hRegion, "int", $iCombineMode) If @error Then Return SetError(@error, @extended, False) Return $aResult[0] = 0 EndFunc ;==>_GDIPlus_GraphicsSetClipRegion Func _GDIPlus_RegionCreateFromRect($tRectF) Local $pRectF, $aResult $pRectF = DllStructGetPtr($tRectF) $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateRegionRect", "ptr", $pRectF, "int*", 0) If @error Then Return SetError(@error, @extended, 0) Return $aResult[2] EndFunc ;==>_GDIPlus_RegionCreateFromRect Func _GDIPlus_RegionCombineRect($hRegion, $tRectF, $iCombineMode = 2) Local $pRectF, $aResult $pRectF = DllStructGetPtr($tRectF) $aResult = DllCall($ghGDIPDll, "uint", "GdipCombineRegionRect", "hwnd", $hRegion, "ptr", $pRectF, "int", $iCombineMode) If @error Then Return SetError(@error, @extended, False) Return $aResult[0] = 0 EndFunc ;==>_GDIPlus_RegionCombineRect Func _GDIPlus_RegionDispose($hRegion) Local $aResult = DllCall($ghGDIPDll, "uint", "GdipDeleteRegion", "hwnd", $hRegion) If @error Then Return SetError(@error, @extended, False) Return $aResult[0] = 0 EndFunc ;==>_GDIPlus_RegionDispose Func _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight, $iStride = 0, $iPixelFormat = 0x0026200A, $pScan0 = 0) Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $iWidth, "int", $iHeight, "int", $iStride, "int", $iPixelFormat, "ptr", $pScan0, "int*", 0) If @error Then Return SetError(@error, @extended, 0) Return $aResult[6] EndFunc ;==>_GDIPlus_BitmapCreateFromScan0 And one more thing. The minimap is going to be updated when everyone click on the minimap. People drawing and it saving the colors, and the minimap need to clear the recent picture. And one more thing. How do i remove the rectangle when i close the minimap? I only come to this stage, then didn't i understand how i should create it. #include <GuiConstantsEx.au3> #include <GDIPlus.au3> #include <misc.au3> #include <file.au3> Opt('MustDeclareVars', 1) Global $hGUI, $hWnd, $hGraphic, $hPen, $hBrush, $s,$lines,$s1,$x,$color,$ss Global $s2,$file,$label,$msg,$button1 $file = @ScriptDir & "\test.txt" Global $width = 300 Global $height = 200 $hGUI = GUICreate("Test", $width, $height) guisetbkcolor("0x181717") ;~ $label = guictrlcreatelabel("",5,100,84,62) ;~ guictrlsetbkcolor(-1,"0x000000") ;~ guictrlsetstate(-1,$GUI_HIDE) $button1 = guictrlcreatebutton("Minimap",5,170,50,21) GUISetState() _GDIPlus_Startup () $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) #region exclude GUI controls from GDI+ graphic screen Global Const $GW_CHILD = 5, $GW_HWNDNEXT = 2 Global $hRegion = _GDIPlus_RegionCreateFromRect(_GDIPlus_RectFCreate(0, 0, $width, $height)) Global $hChild = _WinAPI_GetWindow($hGUI, $GW_CHILD) Global $aRect Do $aRect = ControlGetPos($hChild, "", 0) _GDIPlus_RegionCombineRect($hRegion, _GDIPlus_RectFCreate($aRect[0], $aRect[1], $aRect[2], $aRect[3]), 3) $hChild = _WinAPI_GetWindow($hChild, $GW_HWNDNEXT) Until Not $hChild _GDIPlus_GraphicsSetClipRegion($hGraphic, $hRegion) _GDIPlus_RegionDispose($hRegion) #endregion $hBrush = _GDIPlus_BrushCreateSolid(0xFF000000) $hpen = _GDIPlus_PenCreate(0xFF696969) Global $hBitmap = _GDIPlus_BitmapCreateFromScan0($width, $height) Global $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap) _GDIPlus_GraphicsFillRect($hContext, 6, 101, 81, 59, $hBrush) Global $button1_status = 1 while 1 $msg = GUIGetMsg() switch $msg case $GUI_EVENT_CLOSE _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_GraphicsDispose($hContext) _GDIPlus_BrushDispose($hBrush) _GDIPlus_PenDispose($hpen) _GDIPlus_GraphicsDispose($hgraphic) _GDIPlus_Shutdown () Exit case $button1 If $button1_status = 1 Then _GDIPlus_GraphicsFillRect($hGraphic, 6, 101, 81, 59, $hBrush) _GDIPlus_PenSetColor($hpen, 0xFF696969) _GDIPlus_GraphicsDrawRect ($hGraphic, 5, 100, 83,61,$hPen) update() _GDIPlus_GraphicsDrawImage($hgraphic, $hBitmap, 5, 100) Else _GDIPlus_GraphicsClear ($hgraphic) EndIf $button1_status *= -1 EndSwitch WEnd func update() $lines = _FileCountLines($file) $s1 = stringsplit(filereadline($file,1),chr(32)) for $i = 2 to $lines $s = stringsplit(filereadline($file,$i),chr(32)) $ss = $s[1] $color = iniread("colors.ini","colors",$s1[$ss],0) if stringinstr($color,chr(44)) then $s2 = stringsplit($color,chr(44)) $s2 = "0xFF"&hex($s2[1],2)&hex($s2[2],2)&hex($s2[3],2) _GDIPlus_PenSetColor($hpen,$s2) Else _GDIPlus_PenSetColor($hpen,0x00000000) EndIf _GDIPlus_GraphicsDrawRect ($hContext, $s[2]*2, $s[3]*2, 1,1,$hPen) Next EndFunc Func _GDIPlus_GraphicsSetClipRegion($hGraphics, $hRegion, $iCombineMode = 0) Local $aResult = DllCall($ghGDIPDll, "uint", "GdipSetClipRegion", "hwnd", $hGraphics, "hwnd", $hRegion, "int", $iCombineMode) If @error Then Return SetError(@error, @extended, False) Return $aResult[0] = 0 EndFunc ;==>_GDIPlus_GraphicsSetClipRegion Func _GDIPlus_RegionCreateFromRect($tRectF) Local $pRectF, $aResult $pRectF = DllStructGetPtr($tRectF) $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateRegionRect", "ptr", $pRectF, "int*", 0) If @error Then Return SetError(@error, @extended, 0) Return $aResult[2] EndFunc ;==>_GDIPlus_RegionCreateFromRect Func _GDIPlus_RegionCombineRect($hRegion, $tRectF, $iCombineMode = 2) Local $pRectF, $aResult $pRectF = DllStructGetPtr($tRectF) $aResult = DllCall($ghGDIPDll, "uint", "GdipCombineRegionRect", "hwnd", $hRegion, "ptr", $pRectF, "int", $iCombineMode) If @error Then Return SetError(@error, @extended, False) Return $aResult[0] = 0 EndFunc ;==>_GDIPlus_RegionCombineRect Func _GDIPlus_RegionDispose($hRegion) Local $aResult = DllCall($ghGDIPDll, "uint", "GdipDeleteRegion", "hwnd", $hRegion) If @error Then Return SetError(@error, @extended, False) Return $aResult[0] = 0 EndFunc ;==>_GDIPlus_RegionDispose Func _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight, $iStride = 0, $iPixelFormat = 0x0026200A, $pScan0 = 0) Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $iWidth, "int", $iHeight, "int", $iStride, "int", $iPixelFormat, "ptr", $pScan0, "int*", 0) If @error Then Return SetError(@error, @extended, 0) Return $aResult[6] EndFunc ;==>_GDIPlus_BitmapCreateFromScan0
  4. Yes like that, but instead of the wolf been creating when you press minimap. It should be created before. So it's already done. So you don't see when the pixels loads.
  5. Hmm, it doesn't do what i want.When i click on the minimap it should open the minimap and close when i click the 2nd time. (Also hide/show the label) But before the opening it should generate the GDI. So it's already done. Now it's just like before. I got it to work if i use this method, ugly but works. Edit: Now i can't have it smaller, ooh this is so bad. #include <GuiConstantsEx.au3> #include <GDIPlus.au3> #include <misc.au3> #include <file.au3> Opt('MustDeclareVars', 1) Global $hGUI, $hWnd, $hGraphic, $hPen,$s,$lines,$s1,$x,$color,$ss Global $s2,$file,$label,$msg,$button1 $file = "test.txt" $hGUI = GUICreate("Test", 500, 200) guisetbkcolor("0x181717") $label = guictrlcreatelabel("",400,100,84,62) guictrlsetbkcolor(-1,"0x000000") $button1 = guictrlcreatebutton("Minimap",5,170,50,21) $hwnd = guictrlgethandle($label) GUISetState() while 1 $msg = GUIGetMsg() switch $msg case $GUI_EVENT_CLOSE _GDIPlus_Shutdown () Exit case $button1 $s= controlgetpos($hgui,"",$hwnd) if $s[0] == 5 and $s[1] == 100 then controlmove($hgui,"",$label,400,100,84,62) Else update() controlmove($hgui,"",$label,5,100,84,62) EndIf EndSwitch WEnd func update() _GDIPlus_Startup () $hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hwnd) _GDIPlus_GraphicsClear($hgraphic,0x000000) $hpen = _GDIPlus_PenCreate(0xFF696969) _GDIPlus_GraphicsDrawRect ($hGraphic, 0, 0, 83,61,$hPen) $hpen = _GDIPlus_PenCreate(0xFF00FF00,1,2) $lines = _FileCountLines($file) $s1 = stringsplit(filereadline($file,1),chr(32)) for $i = 2 to $lines $s = stringsplit(filereadline($file,$i),chr(32)) $ss = $s[1] $color = iniread("colors.ini","colors",$s1[$ss],0) if stringinstr($color,chr(44)) then $s2 = stringsplit($color,chr(44)) $s2 = "0xFF"&hex($s2[1],2)&hex($s2[2],2)&hex($s2[3],2) _GDIPlus_PenSetColor($hpen,$s2) Else _GDIPlus_PenSetColor($hpen,0x00000000) EndIf _GDIPlus_GraphicsDrawRect ($hGraphic, $s[2]*2, $s[3]*2, 1,1,$hPen) Next _GDIPlus_PenDispose ($hPen) _GDIPlus_GraphicsDispose ($hGraphic) EndFunc
  6. So i have a problem to load GDI graphic before the label has been shown. How do i fix so it works? Here is the code + extra files. #include <GuiConstantsEx.au3> #include <GDIPlus.au3> #include <misc.au3> #include <file.au3> Opt('MustDeclareVars', 1) Global $hGUI, $hWnd, $hGraphic, $hPen,$s,$lines,$s1,$x,$color,$ss Global $s2,$file,$label,$msg,$button1 $file = "test.txt" $hGUI = GUICreate("Test", 300, 200) guisetbkcolor("0x181717") $label = guictrlcreatelabel("",5,100,84,62) guictrlsetbkcolor(-1,"0x000000") guictrlsetstate(-1,$GUI_HIDE) $button1 = guictrlcreatebutton("Minimap",5,170,50,21) $hwnd = guictrlgethandle($label) GUISetState() _GDIPlus_Startup () while 1 $msg = GUIGetMsg() switch $msg case $GUI_EVENT_CLOSE _GDIPlus_Shutdown () Exit case $button1 $s= WinGetState(GUICtrlGetHandle($label)) if bitand($s,2) then GUICtrlSetState($label, $GUI_hide) _GDIPlus_PenDispose ($hPen) _GDIPlus_GraphicsDispose ($hGraphic) Else update() ; <- add this after gui_show works. But before, It doesn't. GUICtrlSetState($label, $GUI_show) EndIf EndSwitch WEnd func update() $hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hwnd) _GDIPlus_GraphicsClear($hgraphic,0x000000) $hpen = _GDIPlus_PenCreate(0xFF696969) _GDIPlus_GraphicsDrawRect ($hGraphic, 0, 0, 83,61,$hPen) $hpen = _GDIPlus_PenCreate(0xFF00FF00,1,2) $lines = _FileCountLines($file) $s1 = stringsplit(filereadline($file,1),chr(32)) for $i = 2 to $lines $s = stringsplit(filereadline($file,$i),chr(32)) $ss = $s[1] $color = iniread("colors.ini","colors",$s1[$ss],0) if stringinstr($color,chr(44)) then $s2 = stringsplit($color,chr(44)) $s2 = "0xFF"&hex($s2[1],2)&hex($s2[2],2)&hex($s2[3],2) _GDIPlus_PenSetColor($hpen,$s2) Else _GDIPlus_PenSetColor($hpen,0x00000000) EndIf _GDIPlus_GraphicsDrawRect ($hGraphic, $s[2]*2, $s[3]*2, 1,1,$hPen) Next EndFuncfiles.zip
  7. Thanks for all help and examples guys. I using the guiaccelerator. And it works perfect now.
  8. Does it need button or something to work? Because i use pictures instead. And does it work with array? I tested with a array there the picture-id is stored, but didn't work at all. I don't want two scripts with hotkeyset. I just want one with they keys. But if i use hotkey in one, i need to use it in the other script. The first using 0-9 to change stuff. The other one is going to send 0-9. So if i close the first one, then open the other it works perfect. But if i have the script with hotkey binded and then open the other one, it doesn't work because it's going to disable the sending keys.
  9. It works, but it destroying the 0-9 keys for my other script. And if i do a hotkeyset on the other script, it will destroy for the recent script.
  10. @ChrisL, isn't that going to destroy another script? I mean i use those numbers for one script, then run another that sending the keys 0-9. I think it's not going to work so good.
  11. So i need to have 10 ispressed, and that is just too many. Any better way for a workaround to create for the numbers 0-9? And hotkeyset is just going to take over 0-9 on the keyboard for later use. This is the code, just overkill to use 10 of them. I think it's going to slow down my script a lot. If _IsPressed("30") Then consolewrite("yeh") While _IsPressed("30") Sleep(10) WEnd Else Sleep(10) EndIf
  12. Thanks for the ideas and help guys.
  13. Hmm, that one is bugging a bit, when i drag the image to the slot. It's using the picture i used before. And if i select another pic in the listview, it select to that picture in the slot. And that one is only crashing for me when i hover the mouse. But that looks good, but not possible to drag and drop from the combo?
  14. I will thank you all for the help, but it's me that didn't explain good. Here is the whole code, with the editor and the buttons. It's just the list to drag and drop the textures to the 10 slots pictures. I have tested with the @drag_drop, but that didn't work good. So wm_notify and $nm_click should be the right ones? It doesn't look good at all in the GUI, but yeh The package http://www.sendspace.com/file/6i7h9l
  15. I think i have wrote wrong question. This is how i meant. It's should be dropped to the slots. Use the pictures i linked before. Found some of the code at #Include <GDIPlus.au3> #Include <GUIImageList.au3> #Include <GUIListView.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> _GDIPlus_Startup() local $pic[11] $inc = 12 $Form1 = GUICreate('MyGUI', 380, 230, 302, 218) for $i = 1 to 10 $Pic[$i] = GUICtrlCreatePic("null.jpg", $inc, 180, 16, 16, BitOR($SS_NOTIFY,$WS_GROUP)) $inc += 18 Next $hListView = GUICtrlCreateListView('', 250, 10, 100, 150) _GUICtrlListView_AddColumn($hListView, 'Items', 100) $hImageList = _GUIImageList_Create(16, 16, 5, 10) _GUICtrlListView_SetImageList($hListView, $hImageList, 1) for $i = 0 to 9 _GUIImageList_AddImage($hImageList, -1, @ScriptDir & "\"&$i&".jpg") _GUICtrlListView_AddItem($hListView, '', $i) Next $label1 = guictrlcreatelabel("",12,130,50,16) GUISetState() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit case $gui_event_primarydown $aInfo = GUIGetCursorInfo($form1) for $i = 1 to 10 If $aInfo[4] = $pic[$i] Then guictrlsetdata($label1,$i) $slot = $i EndIf Next EndSwitch WEnd Func _GUIImageList_AddImage($hWnd, $iIndex, $sFile) Local $Size = _GUIImageList_GetIconSize($hWnd) If (Not $Size[0]) Or (Not $Size[1]) Then Return -1 EndIf Local $W, $H, $hGraphic, $hPic, $hImage, $hIcon _GDIPlus_Startup() $hPic = _GDIPlus_ImageLoadFromFile($sFile) $W = _GDIPlus_ImageGetWidth($hPic) $H = _GDIPlus_ImageGetHeight($hPic) If ($W < 0) Or ($H < 0) Then _GDIPlus_Shutdown() Return -1 EndIf If $W < $H Then $W = $Size[0] * $W / $H $H = $Size[1] Else $H = $Size[1] * $H / $W $W = $Size[0] EndIf $hImage = DllCall($ghGDIPDll, 'int', 'GdipGetImageThumbnail', 'ptr', $hPic, 'int', $Size[0], 'int', $Size[1], 'ptr*', 0, 'ptr', 0, 'ptr', 0) $hGraphic = _GDIPlus_ImageGetGraphicsContext($hImage[4]) _GDIPlus_GraphicsClear($hGraphic, 0) _GDIPlus_GraphicsDrawImageRect($hGraphic, $hPic, ($Size[0] - $W) / 2, ($Size[1] - $H) / 2, $W, $H) $hIcon = DllCall($ghGDIPDll, 'int', 'GdipCreateHICONFromBitmap', 'ptr', $hImage[4], 'ptr*', 0) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_ImageDispose($hImage[4]) _GDIPlus_ImageDispose($hPic) _GDIPlus_Shutdown() If Not $hIcon[2] Then Return -1 EndIf $iIndex = _GUIImageList_ReplaceIcon($hWnd, $iIndex, $hIcon[2]) _WinAPI_DestroyIcon($hIcon[2]) Return $iIndex EndFunc ;==>_GUIImageList_AddImag
  16. Ok, we are doing it this way then. Here is the sourcecode. Inside those pictures that is "null". There should the pictures 1-10 be dropable/drag & drop to. So you can add them in any places. But i don't know what i should use to list the pictures, and then how i can drop them to the slots. #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> local $pic[11] $inc = 12 $Form1 = GUICreate("Form1", 329, 247, 389, 170) for $i = 1 to 10 $Pic[$i] = GUICtrlCreatePic("null.jpg", $inc, 180, 16, 16, BitOR($SS_NOTIFY,$WS_GROUP)) $inc += 18 Next GUISetState() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit case $gui_event_primarydown $ppic = GUIGetCursorInfo($form1) for $i = 1 to 10 If $ppic[4] = $pic[$i] Then $slot = $i Next EndSwitch WEnd The pictures http://www.sendspace.com/file/ov67rf
  17. Yes that is one way. But now is it pictures that is going to be changeable. I have a list with 256 16x16 pictures that you can choose between. And then should it be possible to add them in each slot. That's what the problem is. I don't know a good way to do it.
  18. So i have created a Editor to create art inside. But now is the problem, i don't know the best way to use 10 slot colors. And a fast way to change them. It's should be 10 slots colors in the GUI. And then an easy way to change between 256 textures. I have been thinking about a drop control, there you drop the texture inside each slot. But then, i don't know how to do it. So any ideas would be nice to fix my "thinking" problem. Here is how it looks like now. The 10 slot colors is just added with paint. It's a example how i want it to look like. But i can't get any good ideas to change each slot with new colors/textures. http://img199.imageshack.us/img199/5973/heplz.png
×
×
  • Create New...