-2
當我學習的C線程編程,我得到一個樣本:
VOID Thread(PVOID pvoid) {
HBRUSH hBrush;
HDC hdc;
int xLeft, xRight, yTop, yBottom, iRed, iGreen, iBlue;
while (TRUE) {
if (cxClient != 0 || cyClient != 0) {
Sleep(50);
xLeft = rand() % cxClient;
xRight = rand() % cxClient;
yTop = rand() % cyClient;
yBottom = rand() % cyClient;
iRed = rand() & 255;
iGreen = rand() & 255;
iBlue = rand() & 255;
hdc = GetDC(hwnd);
hBrush = CreateSolidBrush(RGB (iRed, iGreen, iBlue));
SelectObject(hdc, hBrush);
Rectangle(hdc, min (xLeft, xRight), min (yTop, yBottom),
max (xLeft, xRight), max (yTop, yBottom));
ReleaseDC(hwnd, hdc);
DeleteObject(hBrush);
}
}
}
這個代碼可以創建一些隨機抽取,我想把這些矩形保存到一個文件中,怎麼樣我這樣做?
感謝
我沒有看到艾米C++或線程編程 - 它看起來像Windows C代碼? –
好吧,我只是想知道如何將這些rects保存到一個文件中。順便說一下,這是代碼的一部分 – Neff