Jump to content
AdminC

DllStructGetData() How can get Color BGR?

Recommended Posts

AdminC

#RequireAdmin
#include <SendMessage.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
#include <WinAPIGdi.au3>
#include <Array.au3>
#include <WinAPIDiag.au3>

$Imglocation = @ScriptDir&"\Image\testimg.bmp"

_GDIPlus_Startup()
Local $Bitmap = _GDIPlus_BitmapCreateFromFile($Imglocation)
Local $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($Bitmap)

Local $imgSize = _WinAPI_GetBitmapDimension($hBitmap)
Local $imgBits = DllStructCreate('dword[' & ($imgSize.X * $imgSize.Y) & ']')

_WinAPI_GetBitmapBits($hBitmap, DllStructGetSize($imgBits), DllStructGetPtr($imgBits))
_WinAPI_DisplayStruct($imgBits)
MsgBox(0, "", DllStructGetData($imgBits, 1, 1)) 
_GDIPlus_Shutdown()

DllstructGetData can't get data color B, G, R value. Who's know that? teach me plz

 

Share this post


Link to post
Share on other sites
AdminC

#RequireAdmin
#include <SendMessage.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
#include <WinAPIGdi.au3>
#include <Array.au3>
#include <WinAPIDiag.au3>

$Imglocation = @ScriptDir&"\Image\testimg.bmp"

_GDIPlus_Startup()
Local $Bitmap = _GDIPlus_BitmapCreateFromFile($Imglocation)
Local $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($Bitmap)

Local $imgSize = _WinAPI_GetBitmapDimension($hBitmap)
Local $imgBits = DllStructCreate('dword[' & ($imgSize.X * $imgSize.Y) & ']')

_WinAPI_GetBitmapBits($hBitmap, DllStructGetSize($imgBits), DllStructGetPtr($imgBits))
_WinAPI_DisplayStruct($imgBits)
MsgBox(0, "", DllStructGetData($imgBits, 1, 1)) 
_GDIPlus_Shutdown()

DllstructGetData can't get data color B, G, R value. Who's know that? teach me plz

Share this post


Link to post
Share on other sites
water

You know that this is the wrong forum to post a question?
BTW: Please use the AutoIt code tags (the "<>" button in the editor) when posting code.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
AdminC
$Imglocation = @ScriptDir&"\Image\testimg.bmp"

_GDIPlus_Startup()
Local $Bitmap = _GDIPlus_BitmapCreateFromFile($Imglocation)
Local $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($Bitmap)

Local $imgSize = _WinAPI_GetBitmapDimension($hBitmap)
Local $imgBits = DllStructCreate('dword[' & (DllStructGetData($imgSize, 'X') * DllStructGetData($imgSize, 'Y')) & ']')

_WinAPI_GetBitmapBits($hBitmap, DllStructGetSize($imgBits), DllStructGetPtr($imgBits))
;_WinAPI_DisplayStruct($imgBits)
MsgBox(0, "", DllStructGetData($imgBits, 1, 1))
_GDIPlus_Shutdown()

 

Edited by AdminC

Share this post


Link to post
Share on other sites
JLogan3o13

@AdminC the Examples forum very, very clearly states:

Quote

Do not post general support questions here, instead use the AutoIt Help and Support forums.

Please pay attention to where you're posting in the future.


√-1 2^3 ∑ π, and it was delicious!

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

    • autotin
      By autotin
      Hello I am a first time user of AutoIT with little coding experience and I would REALLY really appreciate your help.
      I work in a warehouse where I am responsible for data entry along with a slew of other different tasks such as auditing and managing paperwork. Most of my time is tied up entering info to close receipts of product orders (8-12+ hours for thousands of products). The quantity actually produced by the warehouse is sometimes different from the quantity listed on the reciept (in this case 20). I need to change all the build qty for sublocation "1-WIP" from 20 to the actual quantity 22 and set all other numbers as 0. The form is an iframe coded with jQuery and freezes for 1-2 seconds after every entry and refreshes. As such, it doesn't allow me to use tab and I need to click and type every incorrect field.
      I have attached an image as an example from the webapp, FinaleInventory.
      I'm thinking that I probably need a macro that has a message box entry where I can type the corrected number entry I want. Then it uses image/character recognition (Tesseract?) to find "WIP" sublocation =,   Move the mouse over to the right to "Quantity" relative to location of WIP If quantity number = entry, then move to next "WIP" image (Not quite sure how to make Tesseract "find next") Elseif quantity number ≠ entry then click quantity number of "WIP" and type corrected entry Scroll down Loop until bottom of page I would greatly appreciate any help, ideas or pointers for this project. Thank you!
      -A newbie scripter

    • Pagi
      By Pagi
       
      <a href="index.php=4143b27b41db0a40c499202865c3e24d" class="menuitem " target="\_self"> "Menu Item 1" </a>
      Can you tell me if it´s possible to click this menu button? If yes, how? Cause I have no idea, I think i should use _IETagNameGetCollection
    • mar3011
      By mar3011
      hello, I want to set in the inputbox field random key from the keyboard to which the function will be assigned, for example F4 function start notepad ALT + A function start notepad for one function. Thank you for any help.  
    • JuanFelipe
      By JuanFelipe
      Cambiar a español Hello friends, I need help with a problem I have, I want to know if there is any way to update a GUI already running, that is I have a GUI of a certain size and with a button I would like to enlarge it:
      example: $ form1 = GUICreate ("", 200,100,0,0)   When you press the button, the gui increases its size, and actuates the new size.
    • BogdanNicolescu
      By BogdanNicolescu
      While 1 / / / A whole bunch of codes found in help and here: https://www.autoitscript.com/autoit3/docs/ / / / WEnd OR:

       
      HotKeySet("{ESC}", "Terminate") While 1 MouseClick("Right",674,422) MouseClick("Left",673,447) Sleep(2000) / / / A whole bunch of codes found in help and here: https://www.autoitscript.com/autoit3/docs/ / / / MouseClick("Left",675,339) SLeep(3000) WEnd Func Terminate()     Exit 0 EndFunc  
      Sorry if i should't let this here to be found by newbies like me -.-'
×