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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 IO.CaptureFromScreen Critical Bug On Windows 8

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
w2m Posted - Mar 22 2014 : 10:31:57
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
5   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Mar 25 2014 : 13:55:32
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
w2m Posted - Mar 25 2014 : 13:07:51
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
xequte Posted - Mar 25 2014 : 12:40:47
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
w2m Posted - Mar 25 2014 : 11:20:41
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
xequte Posted - Mar 24 2014 : 18:23:43
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