Fix C# Console Application
Budget $30-250 USD
Hello all,
I have a C# console application that needs fixing. It nearly works. However, its not saving an application window as an image. I don't want to use the usual screenshot methods, I need to be able to render any window to an image even when windows UI is not running. Its nearly there but I can't figure the last bit out.
Everyone can have a look at this class, WHEN you fix it only bid then and that person will get the money straight away. Here is the class:
using System;
using [url removed, login to view];
using [url removed, login to view];
using [url removed, login to view];
using [url removed, login to view];
using [url removed, login to view];
using [url removed, login to view];
using [url removed, login to view];
using [url removed, login to view];
namespace Testing
{
class Program
{
private const uint WM_PRINT = 0x0317;
private const uint WM_PRINTCLIENT = 0x0318;
private const uint PRF_NON_CLIENT = 0x00000002;
private const uint PRF_CLIENT = 0x00000004;
private const uint PRF_ERASEBKGND = 0x00000008;
private const uint PRF_CHILDREN = 0x00000010;
[DllImport("[url removed, login to view]", SetLastError = true)]
private static extern bool SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, uint lParam);
[DllImport("[url removed, login to view]")]
static extern IntPtr GetWindowDC(IntPtr hWnd);
[DllImport("[url removed, login to view]")]
[return: MarshalAs([url removed, login to view])]
static extern bool GetWindowRect(IntPtr hWnd, ref RECT lpRect);
[DllImport("[url removed, login to view]", SetLastError = true)]
[return: MarshalAs([url removed, login to view])]
public static extern int WTSGetActiveConsoleSessionId();
[DllImport("[url removed, login to view]")]
public static extern IntPtr OpenProcess(int dwDesiredAccess, bool bInheritHandle, int dwProcessId);
[DllImport("[url removed, login to view]", SetLastError = true)]
static extern IntPtr CreateCompatibleDC(IntPtr hdc);
static void Main(string[] args)
{
Process window = new Process();
[url removed, login to view] = "[url removed, login to view]";
[url removed, login to view]();
[url removed, login to view]();
IntPtr handle = [url removed, login to view];
Bitmap image = new Bitmap(500, 500, [url removed, login to view]);
using (Graphics graphics = [url removed, login to view](image))
{
IntPtr hDC = [url removed, login to view]();
if(SendMessage(handle, WM_PRINT, hDC, PRF_NON_CLIENT | PRF_CHILDREN))
{
//[url removed, login to view]("Success!");
}
else
{
//[url removed, login to view]("Exception: " + [url removed, login to view]() + ", Error: " + [url removed, login to view]());
}
[url removed, login to view](hDC);
}
[url removed, login to view]("C:\\[url removed, login to view]", [url removed, login to view]);
[url removed, login to view](15000);
[url removed, login to view]();
//[url removed, login to view]();
}
[StructLayout([url removed, login to view])]
public struct RECT
{
public int Left; // x position of upper-left corner
public int Top; // y position of upper-left corner
public int Right; // x position of lower-right corner
public int Bottom; // y position of lower-right corner
}
}
}
The first person to do it will get the money and only the cheapest price.
PLEASE FIX THEN BID! It shouldn't take long for a pro to do it.
Décerné à:
21 freelance font une offre moyenne de $33 pour ce travail
Hello! I can solve your problem in just a couple of minutes. Please check private message for my sample work.
Hi, Can you please let me know that this question still open or not. So that I can proceed further on this. Thanks
we have a team of 25 members with expertise in their profession. We have made a similar kind of projects. For further information please view your PMB. Ready to work with you Regards
Hi, did you try to use [url removed, login to view](@"C:\[url removed, login to view]", [url removed, login to view]); instead of [url removed, login to view]("C:[url removed, login to view]", [url removed, login to view]); ?