mohammadezazi Posted August 3, 2013 Share Posted August 3, 2013 (edited) I have inserted a small picture in a GUI instead of button. I want to do an action when the user clicks on the picture. I don't know what it means. Hotspot or other thing. Thanks for any help. Edited August 3, 2013 by mohammadezazi Link to comment Share on other sites More sharing options...
Edano Posted August 3, 2013 Share Posted August 3, 2013 ah, you do know that we want to see your code so that we know what you mean. a pic control reacts the same as a button when you click it. E. [color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font] Link to comment Share on other sites More sharing options...
czardas Posted August 3, 2013 Share Posted August 3, 2013 #include <GUIConstantsEx.au3> Local $hGUI = GUICreate("My GUI picture", 350, 300) Local $hPic = GUICtrlCreatePic(@ProgramFilesDir & "\AutoIt3\Examples\GUI\merlin.gif", 10 ,10) GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $hPic Then MsgBox(0, "Clicked", "Hi!") WEnd operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
mohammadezazi Posted August 3, 2013 Author Share Posted August 3, 2013 (edited) I've embeded the pic file. So in my case it has problem. Thanks for any help. expandcollapse popupLocal Const $STM_SETIMAGE = 0x0172 Local $hgui = GUICreate("Log On to Application", 411, 265,-1,-1,0) GUICtrlCreatePic("", 0, 0,408,92,$SS_BITMAP) _GDIPlus_Startup() $hHBmp = _GDIPlus_BMPFromMemory(Binary(MyPicBinary()), True) GUICtrlSendMsg(-1, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBmp) ;---- Func _GDIPlus_BMPFromMemory($bImage, $hHBitmap = False) If Not IsBinary($bImage) Then Return SetError(1, 0, 0) Local $aResult Local Const $memBitmap = Binary($bImage) ;load image saved in variable (memory) and convert it to binary Local Const $len = BinaryLen($memBitmap) ;get length of image Local Const $hData = _MemGlobalAlloc($len, $GMEM_MOVEABLE) ;allocates movable memory ($GMEM_MOVEABLE = 0x0002) Local Const $pData = _MemGlobalLock($hData) ;translate the handle into a pointer Local $tMem = DllStructCreate("byte[" & $len & "]", $pData) ;create struct DllStructSetData($tMem, 1, $memBitmap) ;fill struct with image data _MemGlobalUnlock($hData) ;decrements the lock count associated with a memory object that was allocated with GMEM_MOVEABLE $aResult = DllCall("ole32.dll", "int", "CreateStreamOnHGlobal", "handle", $pData, "int", True, "ptr*", 0) ;Creates a stream object that uses an HGLOBAL memory handle to store the stream contents If @error Then Return SetError(2, 0, 0) Local Const $hStream = $aResult[3] $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromStream", "ptr", $hStream, "int*", 0) ;Creates a Bitmap object based on an IStream COM interface If @error Then Return SetError(3, 0, 0) Local Const $hBitmap = $aResult[2] Local $tVARIANT = DllStructCreate("word vt;word r1;word r2;word r3;ptr data; ptr") DllCall("oleaut32.dll", "long", "DispCallFunc", "ptr", $hStream, "dword", 8 + 8 * @AutoItX64, _ "dword", 4, "dword", 23, "dword", 0, "ptr", 0, "ptr", 0, "ptr", DllStructGetPtr($tVARIANT)) ;release memory from $hStream to avoid memory leak $tMem = 0 $tVARIANT = 0 If $hHBitmap Then Local Const $hHBmp = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap) _GDIPlus_BitmapDispose($hBitmap) Return $hHBmp EndIf Return $hBitmap EndFunc ;==>_GDIPlus_BMPFromMemory Edited August 3, 2013 by mohammadezazi Link to comment Share on other sites More sharing options...
mohammadezazi Posted August 3, 2013 Author Share Posted August 3, 2013 (edited) ah, you do know that we want to see your code so that we know what you mean. a pic control reacts the same as a button when you click it. E. I've embeded the pic file. So in my case it has problem. Thanks for any help. expandcollapse popupLocal Const $STM_SETIMAGE = 0x0172 Local $hgui = GUICreate("Log On to Application", 411, 265,-1,-1,0) GUICtrlCreatePic("", 0, 0,408,92,$SS_BITMAP) _GDIPlus_Startup() $hHBmp = _GDIPlus_BMPFromMemory(Binary(MyPicBinary()), True) GUICtrlSendMsg(-1, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBmp) ;---- Func _GDIPlus_BMPFromMemory($bImage, $hHBitmap = False) If Not IsBinary($bImage) Then Return SetError(1, 0, 0) Local $aResult Local Const $memBitmap = Binary($bImage) ;load image saved in variable (memory) and convert it to binary Local Const $len = BinaryLen($memBitmap) ;get length of image Local Const $hData = _MemGlobalAlloc($len, $GMEM_MOVEABLE) ;allocates movable memory ($GMEM_MOVEABLE = 0x0002) Local Const $pData = _MemGlobalLock($hData) ;translate the handle into a pointer Local $tMem = DllStructCreate("byte[" & $len & "]", $pData) ;create struct DllStructSetData($tMem, 1, $memBitmap) ;fill struct with image data _MemGlobalUnlock($hData) ;decrements the lock count associated with a memory object that was allocated with GMEM_MOVEABLE $aResult = DllCall("ole32.dll", "int", "CreateStreamOnHGlobal", "handle", $pData, "int", True, "ptr*", 0) ;Creates a stream object that uses an HGLOBAL memory handle to store the stream contents If @error Then Return SetError(2, 0, 0) Local Const $hStream = $aResult[3] $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromStream", "ptr", $hStream, "int*", 0) ;Creates a Bitmap object based on an IStream COM interface If @error Then Return SetError(3, 0, 0) Local Const $hBitmap = $aResult[2] Local $tVARIANT = DllStructCreate("word vt;word r1;word r2;word r3;ptr data; ptr") DllCall("oleaut32.dll", "long", "DispCallFunc", "ptr", $hStream, "dword", 8 + 8 * @AutoItX64, _ "dword", 4, "dword", 23, "dword", 0, "ptr", 0, "ptr", 0, "ptr", DllStructGetPtr($tVARIANT)) ;release memory from $hStream to avoid memory leak $tMem = 0 $tVARIANT = 0 If $hHBitmap Then Local Const $hHBmp = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap) _GDIPlus_BitmapDispose($hBitmap) Return $hHBmp EndIf Return $hBitmap EndFunc ;==>_GDIPlus_BMPFromMemory Edited August 3, 2013 by mohammadezazi Link to comment Share on other sites More sharing options...
Edano Posted August 3, 2013 Share Posted August 3, 2013 it is still a pic control and reacts like czardas said #include <GUIConstantsEx.au3> Local $hGUI = GUICreate("My GUI picture", 350, 300) Local $hPic = GUICtrlCreatePic(@ProgramFilesDir & "\AutoIt3\Examples\GUI\merlin.gif", 10 ,10) GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $hPic Then MsgBox(0, "Clicked", "Hi!") WEnd [color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font] Link to comment Share on other sites More sharing options...
czardas Posted August 3, 2013 Share Posted August 3, 2013 Can you show me how you would make a GUI with a button you can click on and then make something happen? I would like to see how you would write the code for that. The code will not be so much different to what you need to answer your original question. When you understand how this works you can start to find the answers for many more questions. Read the help file about creating GUIs and adding button controls and try to make your own. If you are still struggling after trying this then show us what you tried. operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
mohammadezazi Posted August 5, 2013 Author Share Posted August 5, 2013 It is my Code: expandcollapse popup#include <GuiConstants.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <WindowsConstants.au3> #include <Constants.au3> #include <Process.au3> #include <GDIPlus.au3> #include <StaticConstants.au3> #include <Misc.au3> #include <GUIConstantsEx.au3> Local Const $STM_SETIMAGE = 0x0172 Local $hgui = GUICreate("Log On to Application", 411, 265,-1,-1,0) Local $hPic = GUICtrlCreatePic("", 50, 50, 30, 30,$SS_BITMAP) _GDIPlus_Startup() $hHBmp = _GDIPlus_BMPFromMemory(Binary(OkTik()), True) GUICtrlSendMsg(-1, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBmp) GUISetState() Do $msg = GUIGetMsg() Until $msg = $hPic GUIDelete() ;========================================= Func OkTik() Local _ $OkTik = '0x424D8E0900000000000036000000280000001E0000001A00000001001800000000000000000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFEFEFFFEFFFEFEFEFAFCF9FFFFFFB5D8B2DCECDDFCFDFCFCFDFCFEFEFEFEFEFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFCFDFCFFFFFFE7F2E6208C1F6EB468FFFFFFFBFCFBFEFEFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFEFEFCFDFCFFFEFFF0F7EF399E34018100048201B7DBB4FFFFFFFBFDFBFEFEFEFFFFFFFEFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFFFFFFFFFFFFFFFFFEFEFEFFFEFEFEFFFEFCFDFCFEFEFEF6FBF548A9410086001490040889001F9318E7F3E6FEFEFEFCFDFCFEFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFCFDFCFEFEFEF9FCF953B14A018B0016940310910014930202890051AE49FFFEFFFBFDFBFDFEFDFEFEFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF' $OkTik &= 'FF0000FFFFFFFEFFFEFFFFFFFEFEFEFCFDFBFFFFFFF8FBF756B64D049200189A03139700139700129600179703008C008BCA83FFFFFFFAFCFAFEFEFEFFFFFFFEFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFFFFFFFFFFFEFFFEFBFDFBFFFFFFF3FAF252B7470698001BA003169D00169C00159C00159A00159A001599020B9401BDE2B8FFFFFFFBFDFBFEFEFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FEFFFFFEFFFEFAFDFAFFFFFFEBF7E848B83A0B9E001EA60319A30018A20019A1001AA102179F00179F00199F01119B0023A216E1F2DFFFFFFFFCFDFCFEFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FDFEFDFAFDFAFFFFFFDCF2D83AB62810A50020AB031BA9001BA8001CA7001AA6000FA1001BA50119A30019A2001CA4020C9C0045B337F7FBF6FCFDFCFDFEFCFEFEFEFEFEFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FEFEFEFFFFFFC5EBBD2CB51715AD0023B1031EAE001EAD001FAD001AAB0020AC0666C55617A7001DA9001BA8001AA6001FA8030A9F006AC45CFFFFFFFBFDFAFDFDFDFFFFFFFEFEFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000F1FAEFA1E0951EB5051DB40025B60221B40021B30021B30021B20211AC00A1DD98FFFFFF47BD3113AA0020AD021DAC001D' $OkTik &= 'AB0020AC030BA3008DD482FFFFFFFAFDFAFEFEFEFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000095DE851CB90022BA0027BB0223BA0023B90024B80025B80313B10096DB87FFFFFFFEFEFECFEEC91CB10420B10220B1001FB0001FAF0020AF0311A900ABE0A1FFFFFFFAFDFAFEFEFEFEFFFEFEFFFEFFFFFFFFFFFFFFFFFFFFFFFF0000FDFEFD94DF8318BD002AC00326BF0027BE0027BD0216B80092DD82FFFFFFFBFDFBFBFDFBFFFFFF93DB8411B10026B70321B50021B40022B3001FB2011AAF05BFE8B7FFFFFFFAFDFAFEFEFEFFFFFFFEFEFEFFFFFFFFFFFFFFFFFF0000FBFDFAFFFFFF76DA601AC1002EC50428C2011ABF0097E186FFFFFFFBFDFAFDFEFDFDFEFDFCFEFBFEFEFE5FCD4816B70028BB0323B80022B80025B8011EB50025B60DCEEEC7FFFFFFFAFDFAFEFEFEFFFFFFFFFFFFFFFFFFFFFFFF0000FCFDFBFDFEFCF8FDF653D3351BC50024C602A5E795FFFFFFFBFDFAFDFDFDFFFFFFFEFFFEFDFDFCFDFEFDECF9E93DC6211EBC0028BF0225BD0025BC0027BC011EB8002EBD14D7F2D1FFFFFFFAFDFAFEFEFEFFFFFFFEFEFEFFFFFF0000FEFEFEFCFDFCFFFFFFDFF7D941D229B9EEADFFFFFFFBFDFAFEFEFEFEFEFFFFFEFFFFFFFFFEFEFEFCFDFBFFFFFFD4F3CD2BC40C25C2002AC20127C10026C0002AC1021FBC0033C11AD8F3D3FFFFFFFAFDFAFEFEFEFFFFFFFEFFFE0000FFFFFFFFFEFFFEFEFE' $OkTik &= 'FFFFFFF7FDF4FFFFFFFCFEFCFEFEFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFEFEFEFBFDFBFFFFFFBDEDB122C5012AC7022BC60029C50028C4002BC40220C00034C519D5F2CFFFFFFFFAFDF9FEFEFEFFFFFF0000FEFEFEFFFFFFFFFFFFFDFEFDFFFFFFFDFEFCFEFFFEFFFFFFFEFEFEFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFEFEFEFBFDFAFFFFFFAAEA9B1FC9002DCB022CCA002BC9002AC8002DC80223C50031C713C9F0BFFFFFFFFAFDFAFEFEFE0000FFFFFFFEFEFEFFFFFFFEFEFEFEFEFEFEFEFEFFFEFFFEFEFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFEFEFFFFFFFEFEFDFBFDFAFFFFFF9EE88A1FCD0030CF032ECE002DCD002CCC002FCC0227C9002AC908B2EBA4FFFFFFFDFEFC0000FFFFFFFFFFFFFFFFFFFEFFFEFEFFFEFFFFFFFEFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFEFEFEFEFEFEFEFDFBFDFAFFFFFF96E97F21D10032D30330D2002FD1002ED00030D0012CCE0023CB0092E580FFFEFF0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFDFEFDFBFDFBFFFFFF94EA7C23D50033D70332D60030D50030D40031D40131D3011FCF006CDF4D0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFEFFFFFFFFFDFEFDFBFDFBFF' $OkTik &= 'FFFF97ED7F26D90035DB0234DA0032D90032D80033D8012FD60339D70C0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFDFEFDFCFEFBFFFFFF9FF0872ADE0035DF0136DE0134DD0037DD0227D900B2F1A10000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFDFEFDFBFDFAFFFFFFABF3952FE30035E3003CE3042ADF0074EA51FFFFFF0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFEFFFFFFFDFEFDFBFDFAFFFFFFBAF7A938E8092FE6003FE70FE6FBE0FEFEFE0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFEFEFBFEFAFFFFFFCDFABF43EC1C9BF57FFFFFFFFCFEFB0000' Return $OkTik EndFunc ;========================================= Func _GDIPlus_BMPFromMemory($bImage, $hHBitmap = False) If Not IsBinary($bImage) Then Return SetError(1, 0, 0) Local $aResult Local Const $memBitmap = Binary($bImage) ;load image saved in variable (memory) and convert it to binary Local Const $len = BinaryLen($memBitmap) ;get length of image Local Const $hData = _MemGlobalAlloc($len, $GMEM_MOVEABLE) ;allocates movable memory ($GMEM_MOVEABLE = 0x0002) Local Const $pData = _MemGlobalLock($hData) ;translate the handle into a pointer Local $tMem = DllStructCreate("byte[" & $len & "]", $pData) ;create struct DllStructSetData($tMem, 1, $memBitmap) ;fill struct with image data _MemGlobalUnlock($hData) ;decrements the lock count associated with a memory object that was allocated with GMEM_MOVEABLE $aResult = DllCall("ole32.dll", "int", "CreateStreamOnHGlobal", "handle", $pData, "int", True, "ptr*", 0) ;Creates a stream object that uses an HGLOBAL memory handle to store the stream contents If @error Then Return SetError(2, 0, 0) Local Const $hStream = $aResult[3] $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromStream", "ptr", $hStream, "int*", 0) ;Creates a Bitmap object based on an IStream COM interface If @error Then Return SetError(3, 0, 0) Local Const $hBitmap = $aResult[2] Local $tVARIANT = DllStructCreate("word vt;word r1;word r2;word r3;ptr data; ptr") DllCall("oleaut32.dll", "long", "DispCallFunc", "ptr", $hStream, "dword", 8 + 8 * @AutoItX64, _ "dword", 4, "dword", 23, "dword", 0, "ptr", 0, "ptr", 0, "ptr", DllStructGetPtr($tVARIANT)) ;release memory from $hStream to avoid memory leak $tMem = 0 $tVARIANT = 0 If $hHBitmap Then Local Const $hHBmp = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap) _GDIPlus_BitmapDispose($hBitmap) Return $hHBmp EndIf Return $hBitmap EndFunc ;==>_GDIPlus_BMPFromMemory Why it does not work? Link to comment Share on other sites More sharing options...
mohammadezazi Posted August 5, 2013 Author Share Posted August 5, 2013 Can you show me how you would make a GUI with a button you can click on and then make something happen? I would like to see how you would write the code for that. The code will not be so much different to what you need to answer your original question. When you understand how this works you can start to find the answers for many more questions. Read the help file about creating GUIs and adding button controls and try to make your own. If you are still struggling after trying this then show us what you tried. Hi It is my Code. Link to comment Share on other sites More sharing options...
Edano Posted August 5, 2013 Share Posted August 5, 2013 expandcollapse popup;http://www.autoitscript.com/forum/topic/153271-how-i-can-create-a-hotspot-area/#entry1103367 ;Post #8 ;D:\DOKUME~1\ADMINI~1\LOKALE~1\Temp\SLICER\Avatar\default_large.png ;by mohammadezazi ;Script grabbed by SLICER by Edano here: http://www.autoitscript.com/forum/topic/152402-slicer-autoit-forum-script-grabber/?p=1093575 #include <GuiConstants.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <WindowsConstants.au3> #include <Constants.au3> #include <Process.au3> #include <GDIPlus.au3> #include <StaticConstants.au3> #include <Misc.au3> #include <GUIConstantsEx.au3> #include <Memory.au3> Global Const $STM_SETIMAGE = 0x0172 $hgui = GUICreate("Log On to Application", 411, 265,-1,-1,0) $hPic = GUICtrlCreatePic("", 50, 50, 30, 30,$SS_BITMAP) GUICtrlSetState(-1,128);$GUI_DISABLE _GDIPlus_Startup() $hHBmp = _GDIPlus_BMPFromMemory(Binary(OkTik()), True) _GDIPlus_Shutdown() GUICtrlSendMsg(-1, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBmp) $lab=GUICtrlCreateLabel("",50,50,30,30) GUICtrlSetBkColor(-1,-2);$GUI_BKCOLOR_TRANSPARENT GUISetState() Do $msg = GUIGetMsg() Until $msg = $lab GUIDelete() ;========================================= Func OkTik() Local _ $OkTik = '0x424D8E0900000000000036000000280000001E0000001A00000001001800000000000000000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFEFEFFFEFFFEFEFEFAFCF9FFFFFFB5D8B2DCECDDFCFDFCFCFDFCFEFEFEFEFEFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFCFDFCFFFFFFE7F2E6208C1F6EB468FFFFFFFBFCFBFEFEFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFEFEFCFDFCFFFEFFF0F7EF399E34018100048201B7DBB4FFFFFFFBFDFBFEFEFEFFFFFFFEFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFFFFFFFFFFFFFFFFFEFEFEFFFEFEFEFFFEFCFDFCFEFEFEF6FBF548A9410086001490040889001F9318E7F3E6FEFEFEFCFDFCFEFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFCFDFCFEFEFEF9FCF953B14A018B0016940310910014930202890051AE49FFFEFFFBFDFBFDFEFDFEFEFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF' $OkTik &= 'FF0000FFFFFFFEFFFEFFFFFFFEFEFEFCFDFBFFFFFFF8FBF756B64D049200189A03139700139700129600179703008C008BCA83FFFFFFFAFCFAFEFEFEFFFFFFFEFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFFFFFFFFFFFEFFFEFBFDFBFFFFFFF3FAF252B7470698001BA003169D00169C00159C00159A00159A001599020B9401BDE2B8FFFFFFFBFDFBFEFEFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FEFFFFFEFFFEFAFDFAFFFFFFEBF7E848B83A0B9E001EA60319A30018A20019A1001AA102179F00179F00199F01119B0023A216E1F2DFFFFFFFFCFDFCFEFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FDFEFDFAFDFAFFFFFFDCF2D83AB62810A50020AB031BA9001BA8001CA7001AA6000FA1001BA50119A30019A2001CA4020C9C0045B337F7FBF6FCFDFCFDFEFCFEFEFEFEFEFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FEFEFEFFFFFFC5EBBD2CB51715AD0023B1031EAE001EAD001FAD001AAB0020AC0666C55617A7001DA9001BA8001AA6001FA8030A9F006AC45CFFFFFFFBFDFAFDFDFDFFFFFFFEFEFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000F1FAEFA1E0951EB5051DB40025B60221B40021B30021B30021B20211AC00A1DD98FFFFFF47BD3113AA0020AD021DAC001D' $OkTik &= 'AB0020AC030BA3008DD482FFFFFFFAFDFAFEFEFEFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000095DE851CB90022BA0027BB0223BA0023B90024B80025B80313B10096DB87FFFFFFFEFEFECFEEC91CB10420B10220B1001FB0001FAF0020AF0311A900ABE0A1FFFFFFFAFDFAFEFEFEFEFFFEFEFFFEFFFFFFFFFFFFFFFFFFFFFFFF0000FDFEFD94DF8318BD002AC00326BF0027BE0027BD0216B80092DD82FFFFFFFBFDFBFBFDFBFFFFFF93DB8411B10026B70321B50021B40022B3001FB2011AAF05BFE8B7FFFFFFFAFDFAFEFEFEFFFFFFFEFEFEFFFFFFFFFFFFFFFFFF0000FBFDFAFFFFFF76DA601AC1002EC50428C2011ABF0097E186FFFFFFFBFDFAFDFEFDFDFEFDFCFEFBFEFEFE5FCD4816B70028BB0323B80022B80025B8011EB50025B60DCEEEC7FFFFFFFAFDFAFEFEFEFFFFFFFFFFFFFFFFFFFFFFFF0000FCFDFBFDFEFCF8FDF653D3351BC50024C602A5E795FFFFFFFBFDFAFDFDFDFFFFFFFEFFFEFDFDFCFDFEFDECF9E93DC6211EBC0028BF0225BD0025BC0027BC011EB8002EBD14D7F2D1FFFFFFFAFDFAFEFEFEFFFFFFFEFEFEFFFFFF0000FEFEFEFCFDFCFFFFFFDFF7D941D229B9EEADFFFFFFFBFDFAFEFEFEFEFEFFFFFEFFFFFFFFFEFEFEFCFDFBFFFFFFD4F3CD2BC40C25C2002AC20127C10026C0002AC1021FBC0033C11AD8F3D3FFFFFFFAFDFAFEFEFEFFFFFFFEFFFE0000FFFFFFFFFEFFFEFEFE' $OkTik &= 'FFFFFFF7FDF4FFFFFFFCFEFCFEFEFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFEFEFEFBFDFBFFFFFFBDEDB122C5012AC7022BC60029C50028C4002BC40220C00034C519D5F2CFFFFFFFFAFDF9FEFEFEFFFFFF0000FEFEFEFFFFFFFFFFFFFDFEFDFFFFFFFDFEFCFEFFFEFFFFFFFEFEFEFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFEFEFEFBFDFAFFFFFFAAEA9B1FC9002DCB022CCA002BC9002AC8002DC80223C50031C713C9F0BFFFFFFFFAFDFAFEFEFE0000FFFFFFFEFEFEFFFFFFFEFEFEFEFEFEFEFEFEFFFEFFFEFEFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFEFEFFFFFFFEFEFDFBFDFAFFFFFF9EE88A1FCD0030CF032ECE002DCD002CCC002FCC0227C9002AC908B2EBA4FFFFFFFDFEFC0000FFFFFFFFFFFFFFFFFFFEFFFEFEFFFEFFFFFFFEFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFEFEFEFEFEFEFEFDFBFDFAFFFFFF96E97F21D10032D30330D2002FD1002ED00030D0012CCE0023CB0092E580FFFEFF0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFDFEFDFBFDFBFFFFFF94EA7C23D50033D70332D60030D50030D40031D40131D3011FCF006CDF4D0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFEFFFFFFFFFDFEFDFBFDFBFF' $OkTik &= 'FFFF97ED7F26D90035DB0234DA0032D90032D80033D8012FD60339D70C0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFDFEFDFCFEFBFFFFFF9FF0872ADE0035DF0136DE0134DD0037DD0227D900B2F1A10000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFDFEFDFBFDFAFFFFFFABF3952FE30035E3003CE3042ADF0074EA51FFFFFF0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFEFFFFFFFDFEFDFBFDFAFFFFFFBAF7A938E8092FE6003FE70FE6FBE0FEFEFE0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFEFEFBFEFAFFFFFFCDFABF43EC1C9BF57FFFFFFFFCFEFB0000' Return $OkTik EndFunc ;========================================= Func _GDIPlus_BMPFromMemory($bImage, $hHBitmap = False) If Not IsBinary($bImage) Then Return SetError(1, 0, 0) Local $aResult Local Const $memBitmap = Binary($bImage) ;load image saved in variable (memory) and convert it to binary Local Const $len = BinaryLen($memBitmap) ;get length of image Local Const $hData = _MemGlobalAlloc($len, $GMEM_MOVEABLE) ;allocates movable memory ($GMEM_MOVEABLE = 0x0002) Local Const $pData = _MemGlobalLock($hData) ;translate the handle into a pointer Local $tMem = DllStructCreate("byte[" & $len & "]", $pData) ;create struct DllStructSetData($tMem, 1, $memBitmap) ;fill struct with image data _MemGlobalUnlock($hData) ;decrements the lock count associated with a memory object that was allocated with GMEM_MOVEABLE $aResult = DllCall("ole32.dll", "int", "CreateStreamOnHGlobal", "handle", $pData, "int", True, "ptr*", 0) ;Creates a stream object that uses an HGLOBAL memory handle to store the stream contents If @error Then Return SetError(2, 0, 0) Local Const $hStream = $aResult[3] $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromStream", "ptr", $hStream, "int*", 0) ;Creates a Bitmap object based on an IStream COM interface If @error Then Return SetError(3, 0, 0) Local Const $hBitmap = $aResult[2] Local $tVARIANT = DllStructCreate("word vt;word r1;word r2;word r3;ptr data; ptr") DllCall("oleaut32.dll", "long", "DispCallFunc", "ptr", $hStream, "dword", 8 + 8 * @AutoItX64, _ "dword", 4, "dword", 23, "dword", 0, "ptr", 0, "ptr", 0, "ptr", DllStructGetPtr($tVARIANT)) ;release memory from $hStream to avoid memory leak $tMem = 0 $tVARIANT = 0 If $hHBitmap Then Local Const $hHBmp = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap) _GDIPlus_BitmapDispose($hBitmap) Return $hHBmp EndIf Return $hBitmap EndFunc ;==>_GDIPlus_BMPFromMemory [color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font] Link to comment Share on other sites More sharing options...
mohammadezazi Posted August 5, 2013 Author Share Posted August 5, 2013 Thank you very much. It works fine. My problem resolved by it. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now