problem about gdi-Collection of common programming errors
Jake M
c++ winapi gdi
How do I draw a blue rectangle with a alpha/transparency value of 0.5 (ie, 50% transparency) in Native Win32 C++?Using a macro like RGBA() fails, I’m not sure how I can specify the alpha value of the brush.SetDCPenColor(hdc, RGBA(255,255,0,127)); SetDCBrushColor(hdc, RGBA(255,255,0,127)); Rectangle(hdc, 0, 0, width, height);
Simon Mourier
c++ windows gdi dxgi
I have found 7 different ways to enumerate the monitors attached to the computer. But all solutions give different results (number of the monitors and information on each monitor).These solutions are:Using the famous EnumDisplayDevices Using EnumDisplayMonitors Using the Windows Management Instrumentation (WMI): With the following query: SELECT * FROM WmiMonitorID in the root\\WMI namespace. Again using the WMI: With the new query: SELECT * FROM Win32_DesktopMonitor in the root\\CIMV2 namespace.
joliouscezar
winapi gdi jna
i am beginner in win 32 api . i try use win 32 api for create an onscreen keyboard . I can give handle of window and components by click but how to realize type of these and i want set text only on text box and editable componentsi try to use GetWindowInfo() and try use atomWindowType of window for realize type of that but this is not use full for this goal because this change on each restart of OS.(click is handle of window)WINDOWINFO pwi = new WINDOWINFO(); USER32INST.GetWindowInfo(click, pwi)
iraSenthil
c# .net wpf gdi+ gdi
I want to display an icon [a .ico file] in System tray with some text added to it at runtime. Is there any native WPF way to do it? or snippet for GDI+ also would be grateful.Thank you.
VisaToHell
c++ windows bitmap gdi+ gdi
Someone can give me short explanation how to create bitmap runtime using GDI/GDI+ and to fill it with color ?Thanks in advance.
Buzz
windows winapi visual-c++ gdi+ gdi
I’d like to change a combobox control to owner-draw at runtime. In the resource script the control is layed out as a standard control.I’ve experimented with setting the style bits to CBS_OWNERDRAW | CBS_HASSTRINGS but somehow this does not help.Before doing subclass, set window style..// turn to ownerdraw DWORD dwStyle = ::GetWindowLong(hwnd, GWL_STYLE); dwStyle |= CBS_OWNERDRAWVARIABLE | CBS_HASSTRINGS; SetWindowLong(hwnd, GWL_STYLE, dwStyle);Does anybody know the trick?
Jayson Ragasa
c# gdi
I have a project the put random quotes on desktop wallpapers, you can position them, top or bottom. Anyhow, the text works great when using DrawText, but since it is required to have a custom alignment, LEFT, CENTER, or RIGHT.. I moved to using TextRenderer. below is the screen shot, and if you notice, there is a transparent horizontal box along the screen with text.but since Stackoverflow is crashing everytime I upload a HiRes image, I just resized it and just show this to younotice the black s
Ray Vega
.net memory-leaks count gdi handle
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
Micky
c++ windows-7 gdi
Have an application with a GDI leak that will eventually hit 10,000 allocated GDI objects and crash. I tried increasing the GDIProcessHandleQuota to 20,000, but the program still crashed when it reached 10,000 objects. We’re currently working on patching this leak, but out of curiosity–is there a way to increase the GDI limit for a single process? Or is 10k an individual application’s hard limit?
Agrim
c++ mfc gdi
I’m developing an SDI MFC application where there are some custom buttons which are drawn in a custom way or have images loaded on top of them. When the running application is re-sized continuously for about 5 to 10 minutes, it crashes with the error “A required resource was not found.”I have checked the code thoroughly and all the GetDC() calls are followed by ReleaseDC() calls. Furthermore, I always save the old GDI object (for example, an oldBrush), whenever I do a DC.SelectObject(&newBru
Jack Bolding
windows resources gdi windbg
I have a crash dump of an application that is supposedly leaking GDI. The app is running on XP and I have no problems loading it into WinDbg to look at it. Previously we have use the Gdikdx.dll extension to look at Gdi information but this extension is not supported on XP or Vista. Does anyone have any pointers for finding GDI object usage in WinDbg. Alternatively, I do have access to the failing program (and its stress testing suite) so I can reproduce on a running system if you know of any
Lyubomyr Shaydariv
fonts visual-studio-2010 anti-aliasing wpf gdi
I’ve just installed Visual Studio 2010 Beta 2 onto my Windows XP to evaluate it and check whether it meets my preferences the way it did before. Okay, I’ve temporary defeated an urgent bug with a strange workaround (I could not open any file from the Solution Explorer), and it left bad memories to me. But however, it’s okay. The first thing I’ve seen just opening the code editor was ClearType font rendering. Wow, so unexpectedly. I must note that I do not use standard Windows rendering technique
nbolton
windows-7 gdi nsis
I’m attempting to run NSIS.exe on Windows 7 x64, but it’s crashing on start, and leaving this in the event log:Faulting application name: NSIS.exe, version: 0.0.0.0, time stamp: 0x4b1ae3a1 Faulting module name: GDI32.dll, version: 6.1.7600.16385, time stamp: 0x4a5bdb38 Exception code: 0xc0000005 Fault offset: 0x000150cc Faulting process id: 0x1320 Faulting application start time: 0x01ca932bed85dabf Faulting application path: C:\Program Files (x86)\NSIS\NSIS.exe Faulting module path: C:\Windows\s
c00000fd
c++ windows winapi gdi+ gdi
I have the following C++ line that obtains the GDI+ handle out of GDI’s device context://HDC hDC = device context from GDI if(hDC) {//Obtain graphics handle for GDI++Graphics* pgrpx = new Graphics(hDC); //I get invalid memory exception here//Code continues//…//Free objectdelete pgrpx;pgrpx = NULL; }It works just fine in my tests.But recently I received a crash dump for the app, with the “thread referenced memory location that it has no access to” exception at the line I pointed above in the
Nicol Bolas
windows gdi
Im getting strange access violation from gdi functions. My application is like a graphic engine, multiple threads will request drawing of different graphic objects. A single thread will draw all graphic objects to a memory DC. The synchronization between these threads are correct.When I prepared userdump, access violation is occurred from two threads. Following is the callstack of two threads, GetTextExtentPoint32 and CreateFontIndirect are crashed.// Access violation from Draw Request thread. n
Shenjoku
c++ windows crash gdi stretchdibits
I’m using StretchDIBits to print an image and it is failing when the image is at certain sizes for some unknown reason.The image data is loaded into an unsigned int array from some some other image source in 24-bit BGR format. I’ve already verified that the image and buffer are perfectly fine since, like I said, it works at some sizes but not at all.The current size I’m testing with is 638×1014. If I change the height to 1013 it works fine, but for some reason it just flat out fails if it’s 1014
7 revsAlex Jenter
c++ debugging winapi crash gdi
Please help! I’m really at my wits’ end. My program is a little personal notes manager (google for “cintanotes”). On some computers (and of course I own none of them) it crashes with an unhandled exception just after start. Nothing special about these computers could be said, except that they tend to have AMD CPUs.Environment: Windows XP, Visual C++ 2005/2008, raw WinApi.Here is what is certain about this “Heisenbug”:1) The crash happens only in the Release version.2) The crash goes away as soo
Trev
.net interop struct marshalling gdi
I am getting a System.AccessViolationException on a call to ResetDC when passing my Devmode. I am doing the following..// create and marshall the devmode to a byte array.DEVMODE myDevmode = new DEVMODE {dmSize = (short) Marshal.SizeOf(typeof (DEVMODE))};myDevmode.dmFields = DM.Orientation; myDevmode.dmOrientation = DMORIENT_LANDSCAPE;IntPtr ptDM = Marshal.AllocHGlobal(myDevmode.dmSize); Marshal.StructureToPtr(myDevmode, ptDM, false);byte[] byteDM = new byte[myDevmode.dmSize]; Marshal.Copy(ptDM,
matao
c# winforms fonts gdi
The unhandled exception handler on one of our in-house WinForms apps is regularly reporting this error, and variations of the same, from use in production (we have it configured to email us whenever an unhandled exception occurs). However it’s not reproducible and occurs at random intervals on different users machines, which are all XP SP3. It appears to be related to Masked text boxes in datagrids, but it only seems to appear in the same three controls, out of dozens on many screens. These cont
Yochai Timmer
c++ debugging exception-handling error-handling gdi
I’m trying to catch all unexpected terminations in my process.I’ve used these functions to catch all the unhandled errors and exceptions that i can think of, but still it’s not enough:SetUnhandledExceptionFilter(OnUnhandledNativeException);set_terminate(set_terminateHandler);set_unexpected(set_unexpectedHandler);_set_purecall_handler(set_purecallHandler);_set_new_handler(HandleProgramMemoryDepletion); _set_invalid_parameter_handler(InvalidParameterHandler);signal(SIGABRT, sigabrt_handler);
Gabor Herman
winapi internationalization fonts character-encoding gdi
The code page on my Windows is set to ANSI (Latin1, Windows-1252). I create a font with CreateFont and pass RUSSIAN_CHARSET in fdwCharSetThis is what I experience:Windows controls (like a Static for example) using this font ignore the font’s character set: the string passed to SetWindowTextA is displayed with Latin characters After selecting this font on the DC, GDI text functions (Ext)TextOutA and DrawTextA use the character set of the font. Strings passed to them are displayed with cyrillic le
JBL
c++ windows gdi
#include <iostream> #include <windows.h> #include <string> #include <ctime> #include<stdio.h> using namespace std;int main() {HDC dc = GetDC(NULL); COLORREF color = GetPixel(dc, 10, 10); ReleaseDC(NULL, dc);cout << color;return 0; }There’s a error said : [Linker error] undefined reference to `GetPixel@12′ ld returned 1 exit status [Build Error] [Project1.exe] Error 1I m using Dev-C++ complier
Web site is in building