ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 IO.CaptureFromScreen Critical Bug On Windows 8
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

w2m

USA
1990 Posts

Posted - Mar 22 2014 :  10:31:57  Show Profile  Reply
ImageEnView1.IO.CaptureFromScreen(iecsScreen, -1) has a critical bug when running on Windows 8.1. The captured bitmap width is twice as large then it should be. See the screenshot:

My Apprehend Screen Capture component does not have this problem, so there is something wrong with IO.CaptureScreen. I do not have a dual monitor!!!

The problem has a work-around however:
{ ImageEn 5.0.5 desktop capture has a bug that superimposes the image
with two adjacent bitmaps so this is a work-around for the problem }
ImageEnView1.Proc.Crop(0,0, Screen.Width, Screen.Height);

William Miller
Adirondack Software & Graphics
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html
Custom ImageEn Development

xequte

38609 Posts

Posted - Mar 24 2014 :  18:23:43  Show Profile  Reply
Thanks for the report, Bill. I can't reproduce it on Win8 however.

I assume if you right-click the screen and choose resolution, it shows correctly as 1920 x 1080? Perhaps you can step into TImageEnIO.CaptureFromScreen and see where it is failing.



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

w2m

USA
1990 Posts

Posted - Mar 25 2014 :  11:20:41  Show Profile  Reply
I found the problem on windows 8.1:
procedure TImageEnIO.CaptureFromScreen(Source: TIECSSource; MouseCursor: TCursor);
var
  hwin, hdc: THandle;
  x, y, w, h: integer;
  rc: trect;
  vdsk: boolean;
  pt: TPoint;
  xbmp: TIEDibBitmap;
  plc: TWINDOWPLACEMENT;
  hCursor: THandle;
  MousePt: TPoint;
  ClientLeftTop: TPoint;
  IconInfo: TIconInfo;
begin                                     
  // ASYNC MODE
  if (not fIEBitmapCreated) and fAsyncMode and (not IsInsideAsyncThreads) then
  begin
    TIEIOThread.CreateCaptureFromScreen(self, CaptureFromScreen, Source, MouseCursor);
    exit;
  end;
  if not MakeConsistentBitmap([]) then
    exit;
  getcursorpos(MousePt);
  hCursor := Screen.Cursors[-2];
  GetIconInfo(hCursor, IconInfo);
  ClientLeftTop := Point(0, 0);
  { Change this }
  vdsk := (IEGlobalSettings().OpSys <> ieosWin95) and (IEGlobalSettings().OpSys <> ieosWinNT4); // 2.3.1
  { To }
  vdsk := (IEGlobalSettings().OpSys <> ieosWin95) and (IEGlobalSettings().OpSys <> ieosWinNT4) and (IEGlobalSettings().OpSys <> ieosWin8);
  { vdsk should be false for windows 8 so that
   w := Screen.Width;
   h := Screen.Height; 
 }
...

I am not sure if this is the correct fix however, but by using Screen.Width and Screen.Height the capture dimensions are correct at least on my system.

William Miller
Adirondack Software & Graphics
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html
Custom ImageEn Development
Go to Top of Page

xequte

38609 Posts

Posted - Mar 25 2014 :  12:40:47  Show Profile  Reply
Hi Bill

GetSystemMetrics is returning the "Virtual screen", whereas screen.width/height are not multiple-monitor aware. So, for some reason, Windows thinks your system has multiple monitors. Does it give any clues under:

Control Panel\All Control Panel Items\Display\Screen Resolution


BTW, for v5.0.7. I have added a Primary Screen capture option.

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

w2m

USA
1990 Posts

Posted - Mar 25 2014 :  13:07:51  Show Profile  Reply
Yes it shows two monitors with screen 1 being the primary. I have no idea why nor how to get it to show only one, because of course I only have one monitor.
The system is designed to display usb connected monitors on the main monitor by plugging in a secondary monitor like a tablet. I have never tried it however,
but maybe this is the reason.

I guess my 6 month old Dell monitor is unique in that respect, which explains why you do not get the same result as I do.

Follow-up
I changed the Screen Resolution - Multiple Displays to "Show desktop only on 1", then reverted the changes I made to TImageEnIO.CaptureFromScreen and retested.
The control panel change worked... so maybe a primary monitor desktop capture method is not needed.

William Miller
Adirondack Software & Graphics
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html
Custom ImageEn Development
Go to Top of Page

xequte

38609 Posts

Posted - Mar 25 2014 :  13:55:32  Show Profile  Reply
Hi Bill

Thanks for the follow up. Will add the primary monitor option anyway as it is a small change and may be useful.



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: