gdi

Screen Capture Under Win7 of JOGL Applet

Hi I'm trying to take a screen shot of an applet running inside a browser. The applet is using JOGL (OpenGL for Java) to display 3D models. (1) The screen shots always come out either black or white.The current solution uses the usual GDI calls. Screen shots of applets not running OpenGL are fine. A few examples of JOGL apps can be foun...

Associating System.Drawing.Graphics with a device context?

Is there a way of attaching a System.Drawing.Graphics class to a device context (HDC) for another window which was retrieved via GetDC API function? It is easier than using GDI+ directly. ...

Hunting down EOutOfResources.

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 ch...

GDI+ DrawPolygon() excludes points outside viewable area and draws shape incorrectly.

I'm developing an application in MSVC++ 2003 (not using .Net at all) it's an older application uses GDI primarily. A lot of our function prototypes include a reference or pointer to a deviceContext in the parameter list. I figured that within any of those functions I can create a Grpahics object using Graphics.FromHDC(dc) and draw my s...

how do I do print preview in win32 c++?

I have a drawing function that just takes an HDC. But I need to show an EXACT scaled version of what will print. So currently, I use CreateCompatibleDC() with a printer HDC and CreateCompatibleBitmap() with the printer's HDC. I figure this way the DC will have the printer's exact width and height. And when I select fonts into this HDC,...

Drawing real coordinates

Hi to all, i've encountered a little problem that i can't find answer to, so i hope to find someone here to help me. So this is the problem. I have a buffer with real numbers (float) that i need to draw on my scope. I implemented a class that can draw integers only and i really don't know how to do that with float numbers as i don't kn...

C++ Win32, easiest way to show a window with a bitmap.

Hi, It's only for 'debugging' purposes, so I don't want to spend a lot of time with this, nor it is very important. The program exports the data as a png, jpg, svg, etc... -so it's not a big deal, though it could be good to see the image while it is being generated. Also, the program is going to be used in a Linux server; but I'll limit...

Drawing video with text on top

I am working on an application and I have a problem I just cant seem to find a solution for. The application is written in vc++. What I need to do is display a YUV video feed with text on top of it. Right now it works correctly by drawing the text in the OnPaint method using GDI and the video on a DirectDraw overlay. I need to get rid ...

QT (4) equivalent macros/methods/constants for their Win32 API counterparts?

I am converting some GUI code I originally wrote using the win32 API, to use QT. I have come accross some items for which I cant find any direct equivalents. They are: GetRValue GetGValue GetBValue PS_SOLID PS_DASH PS_DOT PS_DASH_DOT PS_NULL MulDiv HBITMAP Any help? [Edit] I am building on Ubuntu 9.10 ...

QPixmap from QBitmap

I am converting a win32 api graphing library to use the qt library instead. I have managed to compile succesfully on XP, now to test true cross-platform capability of the new and improved graphing library, I am attempting to build it on Ubuntu (9.10). I have encountered a couple of compile time erros - because some of the classes are Wi...

Thread type for background drawing to a bitmap in MFC

I have a MFC document/view C++ graphics application that does all its drawing to an off screen bitmap, and then copys that to the supplied CDC pointer in the OnDraw method. Over the last couple of days I've been looking to place the drawing component in a seperate worker thread, so it doesn't stall the GUI. I seem to get a fair number ...

How to create Bitmap from (Compressed format) Bitmap Info Header and Scanlines in WPF?

I am using SampleGrabber in DirectShow on windows 7, I noticed that the Code supplied by Microsoft and many other providers dont work because the Bitmap data header reports that bitmap data is compressed, however the new Bitmap(width, height, stride, pixelformat, scanlines) doesnt have any parameters to specify that the buffer has compre...

Font in 'GraphicsPath.AddString' is smaller than usual font

For some reason if I add a string to GraphicsPath using AddString the font is going to be smaller than it looks like in the Font Dialog. SizeF sz = g.MeasureString(Text, new Font(Font.FontFamily, (int)(Font.Size - (Font.Size / 7)), Font.Style), new PointF(0, 0), StringFormat.GenericDefault); this.Size = new Size((int)sz.Width, (int...

(Windows API) WM_PAINT Mouse problems.

Hello, I created a window with the following flags to overlay a d3d application: WS_EX_TOPMOST | WS_EX_COMPOSITED | WS_EX_TRANSPARENT | WS_EX_LAYERED I proceeded with colorkeying the window for transperacy and all worked well. However once I began drawing on it using GDI an unforeseen problem occurred: For some reason the mouse events (...

How to flash the desktop when I'm receiving an email ?

Hi, I'm developing a email client and I want the screen to flash briefly when I receive a mail. I searched anywhere I could in .NET documentation, but the only way I found to achieve it was to use DirectX functions which is of course impossible : I don't want my users to install DirectX only for a mail client :) Is there a way to do th...

About GDI/GDI+ coordinate compatibility?

Hi all, I have a problem while drawing with both GDI and GDI+ interchangably. The page transformationin particular scalingseems to be a little bit off between the two. Which properties of the GDI context affects the scaling of the output other than SetViewportExt and SetWindowExt? The code uses almost exclusively GDI for its drawing, b...

Use DrawText to update label

Hey folks, I am currently writing a program in c++ (no MFC) and want to update a label (win32 static control) using the win32 DrawText function. However when i call the function nothing is written to the label. I use the following code: HDC devCon = ::GetDC(GetDlgItem(IDC_TITLE).m_hWnd); RECT rect = {10, 10, 100, 15}; ::Dra...

Get all windows which overlap my window

I want to find all windows which entirely or partly overlap my window (are on top of it). As a special case, if I have two window handles (hWnd1 and hWnd2), I want to find if hWnd2 partly or completely overlaps hWnd1. The windows in question are desktop windows (not children/siblings in the same process). ...

How to solve this potentially dispose related file overwrite issue?

I am loading a 50x50 Bitmap file and then filling it a single random color at program startup. Then save the result onto the same file and assign it to a PictureBox, but running into file write problems and "A generic error occurred in GDI+", etc. How to do this properly so that I can continually repeat this, (open bitmap, paint it rand...

Memory/Handle/Gdi leak utility

Hi all, I remember from past having a utility that would allow to leak various system resources, such as memory, handles and gdi. It had a small dialog where one would choose what to leak, it was nice for system stress testing.. I don't remember whether it was part of VC6 or I got it from somewhere else. If you know such tool, please l...