AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Sprachen und Entwicklungsumgebungen Sonstige Fragen zu Delphi Delphi Bildschirm nach bestimmten Bitmap absuchen
Thema durchsuchen
Ansicht
Themen-Optionen

Bildschirm nach bestimmten Bitmap absuchen

Ein Thema von Fredyy · begonnen am 5. Okt 2009 · letzter Beitrag vom 16. Nov 2016
 
Benutzerbild von Fredyy
Fredyy

Registriert seit: 31. Mär 2005
Ort: Wilhelmshaven
46 Beiträge
 
Delphi 7 Personal
 
#3

Re: Desktop nach bestimmten Bitmap absuchen

  Alt 5. Okt 2009, 17:37
Das ist die Funktion + Beschreibung und dazu wird noch eine DLL benötigt, hängt im Anhang.

Danke,
Fredyy

Code:
;===============================================================================
;
; Description:     Find the position of an image on the desktop
; Syntax:          _ImageSearchArea, _ImageSearch
; Parameter(s):    
;                  $findImage - the image to locate on the desktop
;                  $tolerance - 0 for no tolerance (0-255). Needed when colors of
;                               image differ from desktop. e.g GIF
;                  $resultPosition - Set where the returned x,y location of the image is.
;                                    1 for centre of image, 0 for top left of image
;                  $x $y - Return the x and y location of the image
;
; Return Value(s): On Success - Returns 1
;                  On Failure - Returns 0 
;
; Note: Use _ImageSearch to search the entire desktop, _ImageSearchArea to specify
;      a desktop region to search
;
;===============================================================================
Func _ImageSearch($findImage,$resultPosition,ByRef $x, ByRef $y,$tolerance)
   return _ImageSearchArea($findImage,$resultPosition,0,0,@DesktopWidth,@DesktopHeight,$x,$y,$tolerance)
EndFunc

Func _ImageSearchArea($findImage,$resultPosition,$x1,$y1,$right,$bottom,ByRef $x, ByRef $y, $tolerance)
   ;MsgBox(0,"asd","" & $x1 & " " & $y1 & " " & $right & " " & $bottom)
   if $tolerance>0 then $findImage = "*" & $tolerance & " " & $findImage
   $result = DllCall("ImageSearchDLL.dll","str","ImageSearch","int",$x1,"int",$y1,"int",$right,"int",$bottom,"str",$findImage)

   ; If error exit
    if $result[0]="0" then return 0
   
   ; Otherwise get the x,y location of the match and the size of the image to
   ; compute the centre of search
   $array = StringSplit($result[0],"|")
   
   $x=Int(Number($array[2]))
   $y=Int(Number($array[3]))
   if $resultPosition=1 then
      $x=$x + Int(Number($array[4])/2)
      $y=$y + Int(Number($array[5])/2)
   endif
   return 1
EndFunc
Angehängte Dateien
Dateityp: dll imagesearchdll_779.dll (92,0 KB, 23x aufgerufen)
Frederick B.
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 18:49 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz