Áú¹®°ú ´äº¯

À©µµ¿ìÁîAPI 2±Ç 1474pÁú¹®µå¸³´Ï´Ù. ³¯Â¥:2024-8-16 10:48:43 Á¶È¸¼ö:528
ÀÛ¼ºÀÚ : Ȳ±Ý°¡¹°Ä¡
Æ÷ÀÎÆ® : 86
°¡ÀÔÀÏ : 2022-05-06 15:33:18
¹æ¹®È½¼ö : 68
±Û 12°³, ´ñ±Û 13°³
¼Ò°³ : ¾È³çÇϼ¼¿ä. À©µµ¿ìÁîapi¸¦ °øºÎÇϱâÀ§ÇÏ¿© °¡ÀÔÇß½À´Ï´Ù. Àß ºÎʵ右´Ï´Ù.
ÀÛ¼º±Û º¸±â
ÂÊÁö º¸³»±â
LRESULT CALLBACK WndProc(HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam) {
    HDC hdc{};
    PAINTSTRUCT ps{};
    int i{};
    int* ptr = NULL;
    TCHAR str[128]{};

    switch (iMessage) {
    case WM_PAINT:
        hdc = BeginPaint(hWnd, &ps);
        ptr = (int*)VirtualAlloc(NULL, sizeof(int) * 10, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
        if (ptr != NULL) {
            for (i = 0; i < 10; i++) {
                wsprintfW(str, TEXT("%d"), ptr[i] = i * 2);
                TextOut(hdc, 10, i * 20, str, lstrlenW(str));
            }
            VirtualFree(ptr, _msize(ptr), MEM_DECOMMIT); // C6250°æ°í Ç¥½Ã
            VirtualFree(ptr, 0, MEM_RELEASE);
        }
        EndPaint(hWnd, &ps);
        return(0);
    case WM_DESTROY:
        PostQuitMessage(0);
        return(0);
    }
    DefWindowProcW(hWnd, iMessage, wParam, lParam);
}

¹ØÁÙ±×Àº ºÎºÐ¿¡¼­ ÀÚ²Ù¸¸ C6250 ¸Þ¸ð¸® ´©¼ö °æ°í°¡ ¶ß´Âµ¥ ÇØ°á¹æ¹ýÀ» ¾Ë°í½Í½À´Ï´Ù. ºÐ¸í Ã¥¿¡´Â È®Á¤µÈ ¸Þ¸ð¸®¸¦ ÇØÁ¦ÇÏ·Á¸é È®Á¤ ÇØÁ¦ ÈÄ ¿¹¾àÇØÁ¦¶ó°í ½á Àִµ¥ ¿Ö ¸Þ¸ð¸® ´©¼ö °æ°í°¡ ¶ß´ÂÁö ¾Ë°í½ÍÀ¸¸ç, ÇØ°á¹æ¹ýÀ» ¹«¾ùÀÎÁö ¾Ë°í½Í½À´Ï´Ù.
´äº¯ºÎʵ右´Ï´Ù.
 



±è¹Î¼ö
403 Forbidden403 Forbidden

¸ñ·Ïº¸±â »èÁ¦ ¼öÁ¤ ½Å°í ½ºÅ©·¦

Program 9¿ù22ÀÏ 6:32:04  

VirtualAlloc À» »ç¿ëÇÏÁö ¸»°í GlobalAlloc À» »ç¿ëÇØ º¸¼¼¿ä
TCHAR * ptr;
int i;

HGLOBAL hmem;
hmem=GlobalAlloc(GHND,128);//
if(hmem==NULL)
{
//MessageBox(L"ÅØ½ºÆ®ÆÄÀÏ ÀÛ¾÷À» ÇÒ ¼ö ¾øÀ¾´Ï´Ù ¸Þ¸ð¸®ÇÒ´ç ½ÇÆÐ");
}
else
{
ptr=(TCHAR *)GlobalLock(hmem);
lstrcpy(ptr,L"");
for (i = 0; i < 10; i++)
{
wsprintfW(str, TEXT("%d"), ptr[i] = i * 2);
TextOut(hdc, 10, i * 20, str, lstrlenW(str));
}

GlobalUnlock(hmem);
GlobalFree(hmem);
}


·Î±×ÀÎÇÏ¼Å¾ß ´ñ±ÛÀ» ´Þ ¼ö ÀÖ½À´Ï´Ù.