Scan info from screen

This forum is for general support of Xbase++
Post Reply
Message
Author
Victorio
Posts: 620
Joined: Sun Jan 18, 2015 11:43 am
Location: Slovakia

Scan info from screen

#1 Post by Victorio »

This is not just Xbase problem, but I want know, if is possible read info from screen ?

I have some utility (i mean in C,C++) ,that have user window, and on this is some info. Utility do not generate any report.
I need use this info for my application.

Reading info pixel by pixel wil be very complicated, also do not know, where will be windows positioning.

Good way will be run this utility but redirect output not to screen, but to file, where will be easyer analyze it.

User avatar
rdonnay
Site Admin
Posts: 4722
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Scan info from screen

#2 Post by rdonnay »

Code: Select all

oWindow := AppDeskTop()
oScreenDump := GraSaveScreen( oWindow, {0,0}, o:Window:currentSize() )
oScreenDump:saveFile( 'screendump.jpg', XBPBMP_FORMAT_JPG )
The eXpress train is coming - and it has more cars.

Victorio
Posts: 620
Joined: Sun Jan 18, 2015 11:43 am
Location: Slovakia

Re: Scan info from screen

#3 Post by Victorio »

Thank you Roger !

I must try it. So analyzing image will be more complicated because screen resolution...
if no other option I must work on it.

Cliff Wiernik
Posts: 605
Joined: Thu Jan 28, 2010 9:11 pm
Location: Steven Point, Wisconsin USA
Contact:

Re: Scan info from screen

#4 Post by Cliff Wiernik »

I use a similar technique in my program, using the code from the 1.9 documents. You it to print out the current window, not necessarily the application window, to a printer. I could just as easy save to a file. It does not require any special considerations for screen resolution. I did not compare my code to Roger's example, but it looks similar.

User avatar
Auge_Ohr
Posts: 1405
Joined: Wed Feb 24, 2010 3:44 pm

Re: Scan info from screen

#5 Post by Auge_Ohr »

Victorio wrote:This is not just Xbase problem, but I want know, if is possible read info from screen ?
depends on Windows Control / Part if you get Result with WM_GETTEXT
https://msdn.microsoft.com/en-us/librar ... s.85).aspx

first you need Handle of Windows , next Handle of Control inside ( e.g. "edit" = SLE )

Code: Select all

LOCAL nTextLen:=512
LOCAL Buffer:=Space(nTextLen)+Chr(0)
LOCAL nWin
LOCAL nHandle 
LOCAL nDLL := DllLoad("User32.dll")

  // API "FindWindowA" ( Dialog - Titlebar )
  nWin:= DllCall(nDLL, DLL_STDCALL, "FindWindowA", "#32770"+ Chr(0), "FRITZ!fax - send by Xbase++" + Chr(0))

  // API "FindWindowExA" ( Edit-Control inside )
  nHandle := DllCall(nDLL, DLL_STDCALL, "FindWindowExA", nWin, 0,"edit"+Chr(0),nil)

  // "read" from Edit-Control 
  DllCall(nDll,DLL_STDCALL,"SendMessageA", nHandle, WM_GETTEXT, nTextLen, @Buffer)
  // "write" to Edit Control
  DllCall(nDll,DLL_STDCALL,"SendMessageA", nHandle, WM_SETTEXT, LEN(cFaxNo),cFaxNo )
i use WinID.EXE to find those Information about a Control
http://www.dennisbabkin.com/winid/
greetings by OHR
Jimmy

Post Reply