![]() |
Wie bekomme ich den TEXT eines Fensters und nicht nur den TITLE des Fensters.
Hallo leute.
:?: ALso unter ![]() Kann mir da wer sagen, wie das geht? DANKE |
AW: Wie bekomme ich den TEXT eines Fensters und nicht nur den TITLE des Fensters.
Garnicht?
Das Fenster hat keinen TEXT. (der "Text" des Fenster ist dessen Caption) Auf dem Fenster sind aber vielleicht Komponenten, von denen man den Text auslesen könnte. Falls es in dem Fenster eingebaut ist, dann könntest du eventuell etwas nutzen. Dialoge reagieren auf ein Kopieren mit Strg+C und übergeben den Fensterinhalt als TEXT an die Zwischenablage. |
AW: Wie bekomme ich den TEXT eines Fensters und nicht nur den TITLE des Fensters.
Danke für Deine hilfreiche Antwort.
Gibt es irgw. Spy Programme die ein Fenster analysieren und mir sagen welche Komponenten da dann drauf sind? Es sieht nach einem LABEL aus, dessen TEXT ich in ASCII bräuchte. Oder kann man das Bitmap mittels OCR in einen TEXT umwandeln? Wenn das Fenster immer gleich ist, kann ich es bytemäßig mit einem Template vergleichen und so auf den Inhalt schliessen (ISt nur eine Error INfo) Aber bei manchen Fenster steht noch ein String drin, der sich ändert. Dann geht mein Bytevergleich der BMP baden. Danke für jeden RAT. mfg Walter |
AW: Wie bekomme ich den TEXT eines Fensters und nicht nur den TITLE des Fensters.
Zitat:
![]() |
AW: Wie bekomme ich den TEXT eines Fensters und nicht nur den TITLE des Fensters.
Zitat:
![]() |
AW: Wie bekomme ich den TEXT eines Fensters und nicht nur den TITLE des Fensters.
Zitat:
|
AW: Wie bekomme ich den TEXT eines Fensters und nicht nur den TITLE des Fensters.
Danke Uli, ja das kann natürlich der Fall sein, aber ich möchte ja nur wenige BMP als BIN vergleichen die im Prozessablauf am Screen aufscheinen und die immer die gleichen sind.
(Error Meldungen - damit ich mit meiner Postkey32 routine entsprechend darauf reagieren kann) Hab mir EDA angesehen, sieht gut aus, doch erkenne ich da nicht ob LAbels oder andere Komponenten im Window drin sind, die ich ja gern lesen möchte. Jetzt hab ich es, man muss mit dem TARGET Icon auf das Fenster klicken, und dann steht genau der TEXT von dem Err screen im Assoz. TEXT Feld. Muss ich mir noch den Source angucken, damit ich das bei mir einbauen kann. SUPPPPERR Besten DANK Also ich versuche es in Berin V310 einzubauen: habe das hier bei den compiler Swithes dazugegeben: {$UNDEF DELPHI7}{$IFDEF VER310}{$DEFINE DELPHI7}{$ENDIF} doch Kommt bei if ReadProcessMemory(proc, pc, @x, 1, PDWORD(nil)^) then Der Error E2033, Die Typen der ta. und formalen VAR-Parameter müssen übereinstimmen. Hat Berlin vielleicht auch eine andere Routine mit Readprocessmemory? Kann mir da wer Sagen wie ich es in Berlin einbauen kann? laut google mag er als letzten Parameter einen NativeUInt, doch hier ist ein PDWORD(nil)^ wie kann man das kompatible machen? also wenn ich statt PDWORD PNativeUInt schreibe kann ich es kompilieren doch es stürtz nach dem Anwahl des windwos und doch anzeige der Texte im cliüpboard ab. DANKE |
AW: Wie bekomme ich den TEXT eines Fensters und nicht nur den TITLE des Fensters.
Hallo
Ich habe die Ursache gefunden: :-D Erstens: DWORD bzw PDWORD bei
Delphi-Quellcode:
in NativeUInt bzw PNativeUInt
ReadProcessMemory
ersetzen:
Delphi-Quellcode:
und in diesem Part:
if ReadProcessMemory(proc, pc, @x, 1, PNativeUInt(nil)^) then
Delphi-Quellcode:
Und:
// Reading a DWORD at the position hData points to if casted into a Pointer type
ReadProcessMemory(proc, PDWORD(hData), @valu, sizeof(DWORD), myreadbytes); finally // If successful, set flag else flag becomes false (this will report Invalid Pointer) sett := myreadbytes = sizeof(NativeUInt); end; Man muss den type vor der Implementation schreiben:
Delphi-Quellcode:
PS: Leider nein, es crashed in WIN 10 mit Berlin immer noch. Die originale EDA.EXE (die ja Delphi 7 zu Grunde hat) klappt einwandfrei.
******************************************************************************
****************************************************************************** *** *** *** Copyright (c) 1995 - 2002 by -=Assarbad [GoP]=- *** *** Portions Copyright (c) 1991 -2000 by Microsoft Corp. *** *** ____________ ___________ *** *** /\ ________\ /\ _____ \ UIN: 281645 *** *** / \ \ / __________/ \ \ \ \ AIM: nixlosheute *** *** \ \ \ __/___ /\ _____ \ \ \____\ \ nixahnungnicht *** *** \ \ \ /\___ \ \ \ \ \ \ _______\ *** *** \ \ \ / \ \ \ \ \ \ \ \ / Assarbad@gmx.info *** *** \ \ \_____\ \ \ \____\ \ \ \____/ *** *** \ \___________\ \__________\ \__\ *** *** \ / / / / / / *** *** \/___________/ \/__________/ \/__/ *** *** *** *** May the source be with you, stranger ... ;) *** *** Snizhok, eto ne tolko fruktovij kefir, snizhok, eto stil zhizn. *** *** Privet iz Germanij *** *** *** *** Greets from -=Assarbad=- fly to YOU =) *** *** Special greets fly 2 Nico, Casper, SA, Pizza, Navarion, Eugen, Zhenja, *** *** Xandros, Melkij, Strelok etc pp. *** *** *** *** Thanks to: *** *** W.A. Mozart, Vivaldi, Beethoven, Poeta Magica, Kurtzweyl, Manowar, *** *** Blind Guardian, Weltenbrand, In Extremo, Wolfsheim, Carl Orff, Zemfira *** *** ... most of my work was done with their music in the background ;) *** *** *** *** [for questions/proposals drop me a mail] *** *********************************************************** ASCII by Assa **** ******************************************************************************) {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ _\\|//_ (` * * ') ______________________________ooO_(_)_Ooo_____________________________________ LEGAL STUFF: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Copyright (c) 1995-2002, -=Assarbad=- ["copyright holder(s)"] All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The name(s) of the copyright holder(s) may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .oooO Oooo. ____________________________( )_____( )___________________________________ \ ( ) / \_) (_/ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} (****************************************************************************** Version History: ---------------- v.1.1 [30.10.2002] - added to lower level functions that split the functionality of the function ScreenShotThis() into two parts. -> ScreenShotThisInit() -> ScreenShotThisFinit() v.1.0 [14.10.2002] - Initial release. This is roughly speaking a conversion of big parts of an example from the August 2002 PSDK. Since writing BMP is very tricky (mostly because of the bit depth below 16), this was the easiest to do. ******************************************************************************) unit ScreenShot; interface uses Windows; {$INCLUDE .\Include\CompilerSwitches.Pas} {$IFNDEF DELPHI4UP} {$INCLUDE .\Include\Delphi3compat.pas} {$ENDIF} type LPSTR = PChar; const PALVERSION = $300; //* Print Area selection */ PW_WINDOW = 1; PW_CLIENT = 2; const // Dib Header Marker - used in writing DIBs to files DIB_HEADER_MARKER = (ord('M') shl 8) or ord('B'); //------------------------------------------------------------------------------ function ScreenShotThis(hwnd: HWND; fname: string; noCompress: Boolean): Boolean; function ScreenShotThisInit(hwnd: HWND; noCompress: Boolean): THandle; function ScreenShotThisFinit(DIB:THandle; fname: string): Boolean; //------------------------------------------------------------------------------ function WIDTHBYTES(bits: Integer): Integer; function IS_WIN30_DIB(lpbi: PChar): BOOL; function RECTWIDTH(Rect: TRect): Integer; function RECTHEIGHT(Rect: TRect): Integer; //------------------------------------------------------------------------------ function MyDIBNumColors(lpDIB: LPSTR): WORD; function MyPaletteSize(lpDIB: LPSTR): WORD; function MyFindDIBBits(lpDIB: LPSTR): LPSTR; function MyDIBWidth(lpDIB: LPSTR): DWORD; function MyDIBHeight(lpDIB: LPSTR): DWORD; function CreateDIB(dwWidth: DWORD; dwHeight: DWORD; wBitCount: WORD): THandle; function CreateDIBPalette(DIB: THandle): HPALETTE; function DIBToBitmap(DIB: THandle; hPal: HPALETTE): HBITMAP; function BitmapToDIB(hbmp: HBITMAP; hPal: HPALETTE): THandle; function PalEntriesOnDevice(DC: HDC): Integer; function GetSystemPalette: HPALETTE; function AllocRoomForDIB(bi: BITMAPINFOHEADER; hBmp: HBITMAP): THandle; function ChangeDIBFormat(DIB: THandle; wBitCount: WORD; dwCompression: DWORD): THandle; function ChangeBitmapFormat(hBmp: HBITMAP; wBitCount: WORD; dwCompression: DWORD; hPal: HPALETTE): THandle; function CopyWindowToDIB(Wnd: HWND; fPrintArea: WORD): THandle; function CopyScreenToDIB(const Rect: TRect): THandle; function CopyWindowToBitmap(Wnd: HWND; fPrintArea: WORD): HBITMAP; function CopyScreenToBitmap(Rect: TRect): HBITMAP; function PaintDIB(DC: HDC; DCRect: TRect; DIB: THandle; DIBRect: TRect; hPal: HPALETTE): BOOL; function PaintBitmap(DC: HDC; DCRect: TRect; hDDB: HBITMAP; DDBRect: TRect; hPal: HPALETTE): BOOL; //function MyLoadDIB(lpFileName: LPSTR): THandle; //function MySaveDIB(hDib: THandle; lpFileName: LPSTR): DWORD; function DestroyDIB(hDib: THandle): WORD; function ReadDIBFile(hFile: THandle): THandle; //------------------------------------------------------------------------------ implementation (* DIB Macros*) // WIDTHBYTES performs DWORD-aligning of DIB scanlines. The "bits" // parameter is the bit count for the scanline (biWidth * biBitCount), // and this macro returns the number of DWORD-aligned bytes needed // to hold those bits. function WIDTHBYTES(bits: Integer): Integer; begin result := (((bits) + 31) div 32 * 4) end; function IS_WIN30_DIB(lpbi: PChar): BOOL; begin result := PDWORD(lpbi)^ = sizeof(BITMAPINFOHEADER); end; function RECTWIDTH(Rect: TRect): Integer; begin result := Rect.right - Rect.left; end; function RECTHEIGHT(Rect: TRect): Integer; begin result := Rect.bottom - Rect.top; end; (************************************************************************* * * MyDIBNumColors() * * Parameter: * * LPSTR lpDIB - pointer to packed-DIB memory block * * Return Value: * * WORD - number of colors in the color table * * Description: * * This function calculates the number of colors in the DIB's color table * by finding the bits per pixel for the DIB (whether Win3.0 or OS/2-style * DIB). If bits per pixel is 1: colors=2, if 4: colors=16, if 8: colors=256, * if 24, no colors in color table. * ************************************************************************) function MyDIBNumColors(lpDIB: LPSTR): WORD; var wBitCount: WORD; // DIB bit count dwClrUsed: DWORD; begin result := 0; if Assigned(lpDIB) then begin // If this is a Windows-style DIB, the number of colors in the // color table can be less than the number of bits per pixel // allows for (i.e. lpbi->biClrUsed can be set to some value). // If this is the case, return the appropriate value. if (IS_WIN30_DIB(lpDIB)) then begin dwClrUsed := PBITMAPINFOHEADER(lpDIB)^.biClrUsed; if (dwClrUsed) <> 0 then begin result := dwClrUsed; exit; end; end; // Calculate the number of colors in the color table based on // the number of bits per pixel for the DIB. case IS_WIN30_DIB(lpDIB) of TRUE: wBitCount := PBITMAPINFOHEADER(lpDIB)^.biBitCount; else wBitCount := PBITMAPCOREHEADER(lpDIB)^.bcBitCount; end; // return number of colors based on bits per pixel case wBitCount of 1: result := 2; 4: result := 16; 8: result := 256; else result := 0; end; end; end; (************************************************************************* * * MyPaletteSize() * * Parameter: * * LPSTR lpDIB - pointer to packed-DIB memory block * * Return Value: * * WORD - size of the color palette of the DIB * * Description: * * This function gets the size required to store the DIB's palette by * multiplying the number of colors by the size of an RGBQUAD (for a * Windows 3.0-style DIB) or by the size of an RGBTRIPLE (for an OS/2- * style DIB). * ************************************************************************) function MyPaletteSize(lpDIB: LPSTR): WORD; begin result := 0; if assigned(lpDIB) then begin // calculate the size required by the palette case IS_WIN30_DIB(lpDIB) of TRUE: result := MyDIBNumColors(lpDIB) * sizeof(RGBQUAD); else result := MyDIBNumColors(lpDIB) * sizeof(RGBTRIPLE); end; end; end; ... und soweiter Kann mir da jemand helfen? |
AW: Wie bekomme ich den TEXT eines Fensters und nicht nur den TITLE des Fensters.
Hallo,
vielleicht type LPSTR = PChar; durch type LPSTR = PAnsiChar; ersetzen? |
AW: Wie bekomme ich den TEXT eines Fensters und nicht nur den TITLE des Fensters.
Hallo Leute,
also ich hab das EDA sehr abgespeckt. Ich habe gesehen, dass mein Error Window im Window noch ein Tochterfenster hat und mit den Parentcoordinaten habe ich relative dazu um einen TPoint den Cursor positioniert um so in das Tochterfenster per CursorCoordinaten zu gelangen, dann habe ich wie in EDA Source zu finden war das WindowHandle um diese Cursorcoordinaten abgefragt und so dann mit dem GetText von der winapi einfach den Capture Text des Tochterfensters abgefragt bzw in eine Memo geschrieben. Wenn dieser Tochterfestertext dann aus einer Liste bestimmte Errorcodes enthält mache ich mit PostKEy32 bestimmte Tastatureingaben. EDA hat mir sehr geholfen, denn um es zu Analysieren muss man das ErrorWindow mal auf die ParentFesnterCoordinaten analysieren. Anregungen sehr wünschenswert. :thumb: |
Alle Zeitangaben in WEZ +1. Es ist jetzt 05:33 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz