Cancelled

Capture screenshot Google Chrome window

As all you know, PrintWindow api give us a black image when us want a capture screenshot of Google Chrome window. So, a friend said me that a possible solution for this problem is:

Reduce Google Chrome window for -1px in both sides and after this, reset to original size. And so, will repaint again.

Based on code below, someone could help me make this? sincerely I don't know where begin.

==================================================================

[DllImport("[url removed, login to view]", SetLastError = true)]

static extern IntPtr FindWindow(string lpClassName, string lpWindowName);

[DllImport("[url removed, login to view]", SetLastError = true)]

static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow);

[DllImport("[url removed, login to view]")]

private static extern IntPtr GetDC(IntPtr WindowHandle);

[DllImport("[url removed, login to view]")]

private static extern void ReleaseDC(IntPtr WindowHandle, IntPtr DC);

[DllImport("[url removed, login to view]")]

private static extern IntPtr GetWindowRect(IntPtr WindowHandle, ref Rect rect);

[DllImport("[url removed, login to view]", SetLastError = true)]

[return: MarshalAs([url removed, login to view])]

static extern bool PrintWindow(IntPtr hwnd, IntPtr hDC, uint nFlags);

[StructLayout([url removed, login to view])]

private struct Rect

{

public int Left;

public int Top;

public int Right;

public int Bottom;

}

public static Bitmap Capture(IntPtr handle)

{

Rect rect = new Rect();

GetWindowRect(handle, ref rect);

Bitmap Bmp = new Bitmap([url removed, login to view] - [url removed, login to view], [url removed, login to view] - [url removed, login to view]);

Graphics memoryGraphics = [url removed, login to view](Bmp);

IntPtr dc = [url removed, login to view]();

bool success = PrintWindow(handle, dc, 0);

[url removed, login to view](dc);

return Bmp;

}

private void button1_Click(object sender, EventArgs e)

{

IntPtr WindowHandle = FindWindowEx([url removed, login to view], [url removed, login to view], "Chrome_WidgetWin_1", null);

Bitmap BMP = Capture(WindowHandle);

[url removed, login to view]("C:\\[url removed, login to view]");

[url removed, login to view]();

}

Evner: C programmering, C# Programmering, Software Arkitektur

Se mere: user32, window capture, google image code, findwindowex chrome, dllimport, null software, printwindow, dll return image, chrome api, api google image, window handle, top hdc, make screenshot, dll api return, window top, bool dll, google api top, graphics window, image capture google, reset public

Om arbejdsgiveren:
( 3 bedømmelser ) bruklin, Brazil

Projekt ID: #7564838

3 freelancere byder i gennemsnit $26 på dette job

ramyrafik

Hello, I'm an expert C# developer with 10 years of experience. I've read and understood your requirements. I've already made the changes to the code and it's working. Please contact me.

$24 USD på 1 dag
(51 bedømmelser)
5.8
mananraja

A proposal has not yet been provided

$25 USD på 1 dag
(14 bedømmelser)
3.9
swapnilmj20056

A proposal has not yet been provided

$30 USD på 1 dag
(8 bedømmelser)
2.8
GoodHelper

Hello, sir. I read your job posting with interest. I am very interested in your job. I am a excellent software developer and have rich experiences in c/c++ for 10+ years. I can help you complete your job perfectly Flere

$100 USD på 1 dag
(0 bedømmelser)
0.0
farshidahmadi

i hope you wait until i send my proposal because i did not want to do the work this way and i did not worked with this api but if you only want to capture the screen from a application there may be easier ways to do th Flere

$25 USD på 1 dag
(1 bedømmelse)
0.0