TropicalSky
BitBlt Not returning image
I am using the Windows API to call bitblt from gdi32.dll and when I call it it doesn't return an image just an empty bit map
public Bitmap GetScreenShot()
{
try
{
Screen.BitBlt(_hdcDest, 0, 0, CaptureWidth, CaptureWidth, _hdcSrc, _zones[0], _zones[1], 0x00CC0020);
return (Bitmap)_bitmap.Clone(); // Return a copy to avoid threading issues
}
catch (Exception ex)
{
Debug.WriteLine($"Capture Error: {ex.Message}");
return null;
}
}
public Bitmap GetScreenShot()
{
try
{
Screen.BitBlt(_hdcDest, 0, 0, CaptureWidth, CaptureWidth, _hdcSrc, _zones[0], _zones[1], 0x00CC0020);
return (Bitmap)_bitmap.Clone(); // Return a copy to avoid threading issues
}
catch (Exception ex)
{
Debug.WriteLine($"Capture Error: {ex.Message}");
return null;
}
}
public Grabber() {
// Takes half of the screen width and height and makes box in the middle
_zones = CalculateGrabZone(HalfScreenX, HalfScreenY, GrabZone);
CaptureHeight = _zones[3] - _zones[1];
CaptureWidth = _zones[2] - _zones[0];
_Enabled = true;
_bitmap = new Bitmap(CaptureWidth, CaptureHeight);
_gDest = Graphics.FromImage(_bitmap);
_hdcDest = _gDest.GetHdc();
_hdcSrc = Screen.GetDC(IntPtr.Zero);
}
public Grabber() {
// Takes half of the screen width and height and makes box in the middle
_zones = CalculateGrabZone(HalfScreenX, HalfScreenY, GrabZone);
CaptureHeight = _zones[3] - _zones[1];
CaptureWidth = _zones[2] - _zones[0];
_Enabled = true;
_bitmap = new Bitmap(CaptureWidth, CaptureHeight);
_gDest = Graphics.FromImage(_bitmap);
_hdcDest = _gDest.GetHdc();
_hdcSrc = Screen.GetDC(IntPtr.Zero);
}
1 replies
✅ ASP.NET CORE Web Application
I am using ASP.NET CORE in my web application and when I am trying to upload a file to an input field even if I don't upload a file and just click the upload button my iis express server just crashes does anyone have any idea?
<div class="row">
<div class="col-md-4">
<form asp-action="Create">
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<div class="form-group">
<label asp-for="JobName" class="control-label">Job Name</label>
<input asp-for="JobName" class="form-control" />
<span asp-validation-for="JobName" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="JobDescription" class="control-label">Job Description</label>
<input asp-for="JobDescription" class="form-control" />
<span asp-validation-for="JobDescription" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="JobStatus" class="control-label">Job Status</label>
<input asp-for="JobStatus" class="form-control" />
<span asp-validation-for="JobStatus" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Invoice" class="control-label"></label>
<input asp-for="Invoice" class="form-control" type="file" accept=".pdf" />
</div>
<div class="form-group">
<label asp-for="Customer" class="control-label"></label>
<input asp-for="Customer" class="form-control" />
</div>
<div class="form-group">
<input type="submit" value="Create" class="btn btn-primary" />
</div>
</form>
</div>
</div>
<div class="row">
<div class="col-md-4">
<form asp-action="Create">
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<div class="form-group">
<label asp-for="JobName" class="control-label">Job Name</label>
<input asp-for="JobName" class="form-control" />
<span asp-validation-for="JobName" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="JobDescription" class="control-label">Job Description</label>
<input asp-for="JobDescription" class="form-control" />
<span asp-validation-for="JobDescription" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="JobStatus" class="control-label">Job Status</label>
<input asp-for="JobStatus" class="form-control" />
<span asp-validation-for="JobStatus" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Invoice" class="control-label"></label>
<input asp-for="Invoice" class="form-control" type="file" accept=".pdf" />
</div>
<div class="form-group">
<label asp-for="Customer" class="control-label"></label>
<input asp-for="Customer" class="form-control" />
</div>
<div class="form-group">
<input type="submit" value="Create" class="btn btn-primary" />
</div>
</form>
</div>
</div>
27 replies