hdc

How to get pixels from window using Direct2D

人走茶凉 提交于 2019-12-24 16:26:10
问题 My problem is getting the pixels in a window. I can't find a way to do this. I using standard windows functions and Direct2D (not DirectDraw). I am using standard initialization of new window: WNDCLASS wc; wc.style = CS_OWNDC; wc.lpfnWndProc = WndProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = hInstance; wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = (HBRUSH)(6); wc.lpszMenuName = 0; wc.lpszClassName = L"WINDOW";

Plotting Euler Integration using Polyline(), C++

◇◆丶佛笑我妖孽 提交于 2019-12-23 05:38:17
问题 So I'm trying to plot the output of this Euler integration function: typedef double F(double,double); using std::vector; void euler(F f, double y0, double a, double b, double h,vector<POINT> Points) { POINT Pt; double y_n = y0; double t = a; for (double t = a; t != b; t += h ) { y_n += h * f(t, y_n); Pt.x = t; // assign the x value of the point to t. Pt.y = y_n; // assign the y value of the point to y_n. Points.push_back(Pt); } } // Example: Newton's cooling law double newtonCoolingLaw(double

Displaying HBITMAP

强颜欢笑 提交于 2019-12-13 16:28:30
问题 I apologize upfront; I'm new to c and I really don't know what I'm doing. I am trying to capture and display a screen shot using Windows 7 and c. I know it sounds dumb, eventually I will need each of these functions in different programs, the one that captures the screen will send the image to the one that displays it but for now I am just trying to get them both to work in one program. Here is the code I've put together so far: #include <windows.h> bool ScreenCapture(int x, int y, int width,

Create a QPaintDevice from HDC handle

爱⌒轻易说出口 提交于 2019-12-10 22:44:02
问题 I have a Windows HDC handle from an external library that I'd like to use QPainter functionality to draw on. Is there any way in Qt to create a QPaintDevice from a HDC handle? 回答1: One way of doing this: Using the Windows API, get the HWND from the HDC. HWND handle = WindowFromDC(hdc); assert(handle != NULL); Then subclass QWidget to get access to the protected member convert. Using this, create the QWidget using this member as described in this solution: How to create a qwidget with a hwnd

WindowsFromDc return null

纵饮孤独 提交于 2019-12-07 11:09:00
问题 I need some help about the win32 api and especially WindowsFromDc. I have a application which hook a another application. This two application communicate by a NamedPipe. In the second application, I have hook the DrawTextExW function and I get a HDC from this function. But when I do a WindowsFromDC with the DC returned by the DrawTextEx function, i got a null return. So, I have some question about that : -Is it possible a HDC don't have a HDWN with ? -How I can get the HWND of the window

WindowsFromDc return null

别等时光非礼了梦想. 提交于 2019-12-05 18:13:47
I need some help about the win32 api and especially WindowsFromDc. I have a application which hook a another application. This two application communicate by a NamedPipe. In the second application, I have hook the DrawTextExW function and I get a HDC from this function. But when I do a WindowsFromDC with the DC returned by the DrawTextEx function, i got a null return. So, I have some question about that : -Is it possible a HDC don't have a HDWN with ? -How I can get the HWND of the window which call DrawTextEx ? There are other way do to that ? Thank you. Ps : Sorry for my bad english...

Alpha channel in DeviceContext (HDC)

拥有回忆 提交于 2019-12-05 08:14:12
Please help me with alpha channel in HDC. I make HDC dc throw CreateCompatibleDC. Than call CreateDIBSection and can find bytes of image in memory. Than call DrawFrameControl to this dc. All works, but in memory there are 4 bytes per pixel and alpha channel fills by 00. Even if there were FF before. But I need alpha channel. How can I make DrawFrameControl set real alpha values or just don't touch them. Thank you. And sorry for bad english :( You can't make GDI not write to the alpha / reserved byte of a four-byte-per-pixel bitmap. GDI is not really alpha-aware, with the exception of a couple

copy hdc contents to bitmap

做~自己de王妃 提交于 2019-11-30 22:39:13
How could you copy the contents of an HDC to a bitmap? Off the top of my head I think you need to: Create a new DC compatible with the source DC. Call this the memory DC. Create a new bitmap of the correct size. Select the bitmap into the memory DC. BitBlt the source DC into the memory DC. The bitmap should now contain a copy of the source DC. I'm at home so can't give you any code, so I hope this is enough to get you started. There is a good GDI section on Code Project. http://www.codeproject.com/KB/graphics/ There is a good piece of sample code here that does just that (amongst other things)

copy hdc contents to bitmap

北战南征 提交于 2019-11-30 17:23:53
问题 How could you copy the contents of an HDC to a bitmap? 回答1: Off the top of my head I think you need to: Create a new DC compatible with the source DC. Call this the memory DC. Create a new bitmap of the correct size. Select the bitmap into the memory DC. BitBlt the source DC into the memory DC. The bitmap should now contain a copy of the source DC. I'm at home so can't give you any code, so I hope this is enough to get you started. There is a good GDI section on Code Project. http://www

Sharing HDC between different processes

拟墨画扇 提交于 2019-11-28 10:16:35
I am writing some kind of IPC functionality and need to pass certain resources from one process to another. This works well for Pipe handles etc. which can be duplicated via DuplicateHandle. Now I need to pass a HDC from one process to the other. Is this even possible? If yes: how? Sub-Question: I am assuming passing window handles (HWND) from one process to the other is safe. Is this assumption correct? All GDI handles are stored in a table that is mapped into every process. The entries in the table contain the process id of the owning process, and this is checked on every GDI access to the