Wednesday, 15 May 2013

multithreading - WinAPI text output in C -


I am quite new to WINAPI, and I need some help in text output. I have an array of pixels that I type in with the function and then from time to time I bluetooth on the screen using the following functions:

  DWORD WINAPI tickThreadProc (handle handle) {ShowWindow ( Hwnd, SW_SHOW); HDC HDC = GETDESSY (HWD); HDCMM = Content compatible DC (HDC); HBITMAP HBMeld = (HBITMAP) Selection Object (HDCMM, HBMP); Int delay = 1000 / fps; InitPhys (); LoadIMGs (); For (;;) {onFrame (pixel); Bitblatt (HDC, GLIFT, GTOP, width, height, HDCM, 0, 0, SRCCOPI); // Wait slept (delay); // Physics Symphies (); } Select Object (HDCMM, HBMold); DeleteDC (hdc); Return 0; } Vs. MacSaPhase (HWNH HWD) {bitmapinfo BMI; Bmi.bmiHeader.biSize = sizeof (BITMAPINFO); Bmi.bmiHeader.biWidth = width; Bmi.bmiHeader.biHeight = HEIGHT; // Top pixels from top to bottom bmi.bmiHeader.biPlanes = 1; Bmi.bmiHeader.biBitCount = 32; // Not using previous bytes, 32 bit bmi.bmiHeader.biCompression = BI_RGB for alignment; Bmi.bmiHeader.biSizeImage = 0; Bmi.bmiHeader.biXPelsPerMeter = 0; Bmi.bmiHeader.biYPelsPerMeter = 0; Bmi.bmiHeader.biClrUsed = 0; Bmi.bmiHeader.biClrImportant = 0; BMI.BM color [0]. RGb 0 = 0; Bmi.bmiColors [0] .rgbGreen = 0; BMI B.B.Colver [0]. RGBRED = 0; BMI.BMI collar [0]. RGB reserved = 0; HDC HDC = GETDESSY (HWD); // Always create a box compartment to dial. Direct access to pixels HBMP = playback (HDC, BMI, DIB_RGGOLAS, (zero **) and pixels, faucet, 0); DeleteDC (hdc); // Create a new thread to use as a timer hTickThread = CreateThread (NULL, 0, and TickThreadProc, NULL, 0, NULL); }   

Some codes found on the Internet have been modified. I have 4 ints for R, G, B, and A in pixel structure.

It is impractical to output text and load images for text. Any help?

First of all, if you use GetDC to handle the device reference, you should Use ReleaseDC when you will do it with DeleteDC for only for device references created by you.

To draw text in this window, you can use the function before using that DC or using it.

Painting is meant to handle WM_PAINT messages (which is a more common way to attract in a window) It seems that you are trying to draw directly from another thread on a regular basis instead Are there. GDI is not very good in dealing with multiple threads, so you may have some problems with this approach, but if your bitsbets are working then one textot should also work.

No comments:

Post a Comment