gdi

A crash in injected / hooked target application.

I have injected my DLL into a target application where I've hooked few WINAPI-functions as well. One of them is DrawTextExW. I'm trying to replace all 'l' letters to '!' before it prints it out. My solution works fine for a few seconds, but then the target application crashes. I really don't understand why. Here's the function: Edit - ...

How to detect if loading an image will throw an OutOfMemory exception in .NET?

I have an application written using .NET 3.5 SP1 that downloads images from an external site and displays them to end users. On rare ocassions, my users are experiencing OutOfMemory errors because they are downloading enormous images. Sometimes the raw data associated with these images are large, but more often, the dimensions of the ima...

How many Bitmaps can I create in .NET?

.NET Bitmap class uses GDI+ I want to know how many Bitmaps I can create. Will memory leak when create too many Bitmaps? ...

WinAPI/GDI: why snapshot of large windows includes taskbar?

Hello people. I am using GDI+ to take window snapshot, the code is: CComBSTR bstrfname (fname); HDC hdc = CreateCompatibleDC (hDC); HBITMAP hbmp = CreateCompatibleBitmap (hDC, CFG_WIDTH, CFG_HEIGHT); HBITMAP hbmp0 = (HBITMAP)SelectObject (hdc, hbmp); BitBlt (hdc, 0, 0, CFG_WIDTH, CFG_HEIGHT, hDC, 0, 0, SRCCOPY); Gdiplus::Bitmap ...

Forcing windows to redraw the entire screen

I am currently drawing graphics with GDI but I need to be able to redraw the entire desktop/screen. My graphics are drawn on the screen but when I would move a plotted pixel it would become a line because I am not redrawing the screen ( well windows isn't ). I need something to force it to redraw the entire screen, I've tried the followi...

CreateCompatibleBitmap failing on Windows mobile 6

I'm porting an application from Windows Mobile 2003 to Windows Mobile 6, under Visual Studio 2008. The target device has a VGA resolution screen, and I was surprised to find that the following code fails; CClientDC ClientDC(this); CRect Rect; GetClientRect(&Rect); int nWidth = Rect.Width(),nHeight = Rect.Height(); CBitmap Temp; i...

C# examples for hooking GDI (in particular TEXTOUT).

i'm looking for C# samples code for hooking GDI (in particular TEXTOUT). Probably similar to what thetextcapturex, textgrabsdk libraries are doing These libraries must be hooking something, but what, and how? Is there any way to do this in the .net world? ...

My control is awfully slow. Anybody know an EASY-to-USE, FREE profiler for c# development?

Possible Duplicate: Any Good Free .NET Profiler? I am currently developping a control that is supposed to draw a heatmap in realtime at about 20Hz. This consumes an awful lot of CPU resources and I would like to know which function calls are slowing it down that much, sine I got the impression that I am already using a fairly ...

Firefox Pagespeed reporting image size can be reduced on ASP.NET/GDI encoded image?

I have a method that takes a bitmap image: foo(Bitmap bmp){} Im calling bmp.Save(Stream stream, ImageCodecInfo encoder, EncoderParameters encoderParams); Essentially encoder is set with the following pseudo code: foreach (var _encoder in ImageCodecInfo.GetImageEncoders()) { if (_encoder.mimetype=="image/png") { encoder = _encod...

Problem with colors

I was coding a snake game, and i got an apple image to use in the game, so i created a DC and then loaded the apple to this DC, when the game is running, it should copy the apple to the buffer and then the buffer to the screen, but the apple ends black and white in the screen, any1 has idea why? here is some of my code, might help... ...

Set a transparent color

I was drawing a bitmap on the screen, and i wanted to set a transparent color on this bitmap (0xFFFFFF White) i wanted to know if its possible, and if it is, how to do so xP I use this code to load the bitmap invoke LoadBitmap,eax,10 push eax invoke GetDC,0 invoke CreateCompatibleDC,eax pop ecx mov [mapple],eax invoke SelectObject,[ma...

Change GDI pen colour

Is it possible to change the custom pen colour attribute after creating it using this call? HPEN hPen = CreatePen(PS_SOLID, 1, RGB(0, 0, 0)); //Create a solid pen. or how should i create a pen whose colour colour can be changed. ...

c++ gdi drawing ellipse problem

ok i can draw ellipse the problem is this, im trying to draw one ellipse but change its x value to different one. like this i draw one ellipse and the x value is 1 after ten seconds i want it the x value to be 10 but it seems that im creating new ellipse with x value 10. here is my code while(sd==1)//sd equal 1 { sf++;//sf equals 1...

c++ gdi animation not working

im trying to create ball animation using gdi but i can't get it working. i created a ball using this Graphics graphics(hdc); Pen pen(Color(255, 0, 0, 255)); graphics.DrawEllipse(&pen, sf , 0, 10, 10); i have while loop that loops and adds 1 to sf value basicly like this sf++; than i try to repaint the window(it doesn't work...

Help with double-buffering

I have created an animation which works fine, but it flicks. I need help with double-buffering since I don't know anything about it. This is the code in my onPaint(): VOID onPaint(HDC hdc) { Graphics graphics(hdc); Pen pen(Color(255, 0, 0, 255)); graphics.DrawEllipse(&pen, sf , 0, 10, 10); } It works fine but with ...

c++ use custom cursor gdi

ok im trying to create cursor using gdi. i can't even find tutorial how to use customize cursor, i can find so many tutorials for c#. all i know that i use these two functions to set cursor,setcursor and loadcursor that is it thanks Rami ...

Enumerating active fonts in C# using DLL call to EnumFontFamiliesEx has me schtumped

My ultimate goal is to list all active fonts on a windows computer. For example, if you start WordPad or Word, you will see them all. Some of these fonts comes from the windows\fonts folder, but not all. Some are registered dynamically using the gdi32.dll call AddFontResource(...). Now, you would think C# had support for retrieving this ...

visual studio c++ 2010 express gets errors using gdi

ok i just upgrade it to visual studio c++ 2010 express. when i use gdi+ i get errors not in my file but in the gdi+ header file one of the errors is this c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gdiplusimaging.h(74): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int here is the ...

C# PrintDocument PaperSize / FontSize

in the constructor of PaperSize, what unit are the numbers in? var ps = new PaperSize( "Custom Size", XX , YY ); I'm using PrintDocument to do some print out and need to create a page size (w x h) of 9.79cm by 14.75cm. I'm using e.Graphics.PageUnit = GraphicsUnit.Millimeter; I want to crate a font of 24 points, Font titleFont = new...

Floodfill replace with GDI?

My application has a static control which inside has a tab control. It looks like this: and I want to handle the topbar's paint event so that after it has drawn itself (and its children), have it floodfill to look more like this: Given that I'v subclassed the topbar and can override any of its events, how could I do this? Thanks ...