Sign in to follow this  
Followers 0
epicfail

imagesearch reading from resources

5 posts in this topic

hi i wanted to know how to make it so that i can read the images from the resources using ImageSearch and resources UDF

resources UDF: http://www.autoitscript.com/forum/index.php?showtopic=51103

ImageSearch UDF: http://www.autoitscript.com/forum/index.php?showtopic=65748

#AutoIt3Wrapper_useupx=n
#AutoIt3Wrapper_run_after=ResHacker.exe -add %out%, %out%, image1.bmp, bitmap, TEST_BMP_1, 0
#AutoIt3Wrapper_run_after=upx.exe --best --compress-resources=0 "%out%"



#include <ImageSearch.au3>
#include<Constants.au3>
#include <WinAPI.au3>
;
;~ DllOpen("C:\Programme\Microsoft Visual Studio 9.0\VC\redist\Debug_NonRedist\x86\Microsoft.VC90.DebugCRT\msvcr90d.dll")
; Demo on the functions of ImageSearch
; Assumes that you have a Recycle Bin icon at the top left of your screen
; Assumes that you have IE6 or 7 icon visible
; Please make the icon visible or we won't be able to find it
;

Dim $x1, $y1
$HBMP = _WinAPI_LoadImage(0,@ScriptDir & "\folder_search.bmp", $IMAGE_BITMAP, 0, 0, $LR_LOADFROMFILE)
_ResourceSetImageToCtrl($HBMP, "TEST_BMP_1", $RT_BITMAP)

; I guess most people should at least have an Folder icon on the desktop
$result = _ImageSearch("folder.bmp", 0, $x1, $y1, 0, $HBMP)
If $result = 1 Then
    MsgBox(0, "Found", "Found a Folder icon here: x:" & $x1 & "y:" & $y1 )
EndIf

should that work?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I'm not sure about parameters of ImageSearch changed by ProgAndy

But I think first parameter is ignored when last hBmp is given.

Here is link to ImageSearch modified by ProgAndy:

#609286

Try this:

and don't forget to use modified version of ImageSearch

#AutoIt3Wrapper_useupx=n
#AutoIt3Wrapper_run_after=ResHacker.exe -add %out%, %out%, image1.bmp, bitmap, TEST_BMP_1, 0
#AutoIt3Wrapper_run_after=upx.exe --best --compress-resources=0 "%out%"

#include "resources.au3"
#include "ImageSearch.au3"

Dim $x1, $y1

$hBmp = _ResourceGetAsBitmap("TEST_BMP_1", $RT_BITMAP)
$result = _ImageSearch("", 0, $x1, $y1, 0, $HBMP)
If $result = 1 Then
    MsgBox(0, "Found", "Found a bitmap from resource here: x:" & $x1 & "y:" & $y1 )
EndIf
Edited by Zedna

Share this post


Link to post
Share on other sites

i cant get that to work. its not finding my pic.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I'm not sure about parameters of ImageSearch changed by ProgAndy

But I think first parameter is ignored when last hBmp is given.

I was wrong in my hope.

Now I looked at sources of modified ImageSearch and it's clear (code is in util.cpp).

Newly added last parameter HBMP is not for image to be searched

but it's for image where to search.

First parameter stay the same as in original unmodified version of DLL so it could be only file name (image located on disc).

So you can't search for image stored in resources directly (without extracting it to disc) with ImageSearch DLL

neither with original nor with modified one.

As I said in PM you could make small modification to this DLL to be able to achieve this.

But I'm not so familiar with C++ so maybe someone else could do it.

Such modification will be very useful.

Edited by Zedna

Share this post


Link to post
Share on other sites

any1 been able to work this out?

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
Sign in to follow this  
Followers 0