gdi

GDI handles in a DotNET application

走远了吗. 提交于 2019-12-04 06:31:01
My pure DotNET library runs as a plugin inside an unmanaged desktop application. I've been getting a steady (though low) stream of crash reports that seem to indicate a problem with GDI handles (fonts in error messages etc. revert to the system font, display of all sorts of controls break down, massive crash shortly after). My Forms have few controls, but I do a lot of GDI+ drawing in User controls. What's a good way to tell how many handles I'm using, or even leaking? Thanks, David I've had to deal with the same kind of problem in the past. In order to inspect how many GDI objects your

What is the best way to resize a Bitmap in Windows?

穿精又带淫゛_ 提交于 2019-12-04 05:13:07
问题 So, I am working on a text editor. I use double buffering to paint on to the screen. So basically I have an offscreen bitmap, which I paint on, and then copy it to the screen. Now, when the window for the text editor resizes, I need to resize the offscreen bitmap as well. So what would be a good way to resize the bitmap? I was thinking to maybe delete the old object and create a new bitmap using CreateCompatibleBitmap , but I'm wondering if it's the correct way to do it. Language : C++ using

Do I need a WOW64 dump for GDI Handle analysis?

三世轮回 提交于 2019-12-04 05:04:05
I'm debugging a potential GDI Handle Leak. Thanks to @Alois Kraus , there is a WinDbg script which performs a handle count. From my debugging sessions, especially for .NET , I find that usually, it's better to have 32-bit dumps of 32-bit processes and 64-bit dumps of 64-bit processes. Unfortunately, with 2 crash dumps I received, the script does not work. Looking deeper into it, I found out that the GdiSharedHandleTable is null in those dumps: 0:000> dt ntdll!_PEB GdiSharedHandleTable @$peb +0x094 GdiSharedHandleTable : (null) Now, on his website , Alois mentions Important: If you are running

Black highlight bar with GDI

房东的猫 提交于 2019-12-04 04:58:18
问题 I got some nice splitter code for my GUI but I can't get the pen/brush/whatever it is I need to do proper highlighting. You know how in visual studio 10, the splitter bars can be dragged and there's a beautiful black transparent bar letting you know where the split will happen when you lift up your mouse button. Here's a picture: http://www.freeimgshost.com/fullsize/efmcxyyu1wbyb1r7mz0.png How can I achieve that black highlight bar using solely GDI and c++? 回答1: The Visual Studio UI is

GDI has been accelerated. Does anyone know when this happened?

末鹿安然 提交于 2019-12-04 04:54:35
To sketch the background of this question : at work we use Dell Precision workstations. My current one has got an NVidia Quadro FX1700. My team is developing the graphics components for a real time data acquisition system. So we are always looking out to see if the graphics operations don't use up too much CPU time. For quick checks, we have a couple of test programs that we run, which draw scenes at a specified rate ( e.g. 10 fps ) and we use plain old Task Manager to see where CPU usage is at. One of these programs is heavy on GDI DrawRectangle calls ( which are filled ). This program always

Windows fonts not immediately useable in application after installing?

拥有回忆 提交于 2019-12-04 00:08:16
Whenever I install a new font on a Windows 2003 server, I can't use it immediately in my asp.net web application. The application gets the font through the CreateFontIndirect gdi32.dll win api, and then use this font to create a dynamic text image in my asp.net application. It seems like fonts get cached somewhere, because I will just get the default font returned. The font cache gets updated after a reboot, and then I get the correct font, but obviously I wouldn't like to do a reboot on a production server just for getting a new font to work. Is there a way to flush the font cache? By default

GDI fails conversion to indexed color with exact palette?

有些话、适合烂在心里 提交于 2019-12-03 20:20:52
Summary Using Windows GDI to convert 24-bit color to indexed color, it seems GDI chooses colors which are "close enough" even though there are exact matches in the supplied palette. Can anyone confirm this as a GDI issue or am I making a mistake somewhere? Maybe there's a "please check the whole palette for color matches" flag which I've failed to find? Note: This is not about quantizing. The source is 24-bit but contains 256 or fewer colors so an exact palette is trivial to calculate. The problem is GDI doesn't use the full palette. Workaround I've worked around the problem by mapping the

Capture screenshot of hidden desktop

风流意气都作罢 提交于 2019-12-03 20:07:18
问题 I am using virtual desktops on Windows using simple app that i coded myself in C++, i was wondering if there is way to capture screenshot of secondary/hidden desktop ? I know that i can do SwitchDesktop -> capture screenshot -> SwitchDesktop, but it doesnt sound like good solution.... Maybe i run some window in the hidden desktop, to get its hwnd and SOMEHOW to use it to capture the entire screen ? I have run Spy++ but seems it not finding windows that dont belong to currently active desktop.

Hunting down EOutOfResources

北城以北 提交于 2019-12-03 17:58:20
问题 Question: Is there an easy way to get a list of types of resources that leak in a running application? IOW by connecting to an application ? I know memproof can do it, but it slows down so much that the application won't even last a minute. Most taskmanager likes can show the number, but not the type. It is not a problem that the check itself is catastrophic (halts the app process), since I can check with a taskmgr if I'm getting close (or at least I hope) Any other insights on resource leak

How to color blend (colorize by specified alpha value) the canvas area using pure GDI?

江枫思渺然 提交于 2019-12-03 17:50:36
问题 I'd like to color blend (colorize by specified alpha value) the area of a canvas using pure Windows GDI (so without GDI+, DirectX or similar, no OpenGL, no assembler or a 3rd party libraries). I've created the following function and I'd like to know if there is a more efficient or easier way to do this: procedure ColorBlend(const ACanvas: HDC; const ARect: TRect; const ABlendColor: TColor; const ABlendValue: Integer); var DC: HDC; Brush: HBRUSH; Bitmap: HBITMAP; BlendFunction: TBlendFunction;