CreateThread(0, 0, ThreadFunc, 0, 0, 0);

이렇게 하면 ThreadFunc를 시작 함수로 하는 쓰레드가 하나 생성 되는데 이 함수를

클래스의 메서드로 대체 하려고 하니

f:내 문서study2005_22005_2.cpp(41) : error C2664: 'CreateThread' : cannot convert parameter 3 from 'DWORD' to 'LPTHREAD_START_ROUTINE'
        Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast

위와 같은 에러 메시지가 뜨면서 안 됩니다.

어떻게 방법이 없을까요?

#pragma comment(linker, "/subsystem:windows")
//#pragma comment(lib, "")

#include <windows.h>
#include <tchar.h>

class Thread
{
        HWND hwnd;
public:
        Thread(HWND hwnd) { this->hwnd = hwnd; }
        DWORD WINAPI ThreadFunc(PVOID arg) {
                HDC hdc = GetDC(hwnd);
                for ( ;; )
                TextOut(hdc, 10, 10, _T("쓰레드"), 6);
                ReleaseDC(hwnd, hdc);

                return 0;
        }
};



LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
        Thread* thread;
        switch ( msg )
        {
        case WM_CREATE:
                thread = new Thread(hwnd);

        //     이 부분.
                CreateThread(0, 0, thread->ThreadFunc(hwnd), 0, 0, 0);
        //        CreateThread(0, 0, thread->ThreadFunc, 0, 0, 0);

                return 0;

        case WM_DESTROY:
                PostQuitMessage(0);
                return 0;
        }

        return DefWindowProc(hwnd, msg, wParam, lParam);
}



int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrev, PSTR lpCmdLine, int iCmdShow)
{
        TCHAR szAppName[] = _T("HelloWin");
        HWND                hwnd;
        MSG                        msg;
        WNDCLASS        wndclass;

        wndclass.style                        = CS_HREDRAW | CS_VREDRAW;
        wndclass.lpfnWndProc        = WndProc;
        wndclass.cbClsExtra                = 0;
        wndclass.cbWndExtra                = 0;
        wndclass.hInstance                = hInstance;
        wndclass.hIcon                        = LoadIcon(NULL, IDI_APPLICATION);
        wndclass.hCursor                = LoadCursor(NULL, IDC_ARROW);
        wndclass.hbrBackground        = (HBRUSH)GetStockObject(WHITE_BRUSH);
        wndclass.lpszMenuName        = NULL;
        wndclass.lpszClassName        = szAppName;

        if ( !RegisterClass(&wndclass) ) {
                MessageBox(NULL, _T("This program requires Windows NT!"), szAppName, MB_ICONERROR);
                return 0;
        }

        // WM_CREATE 발생
        hwnd = CreateWindowEx(0, szAppName,                                // 윈도우 클래스 이름
                                                  _T("The Hello Program"),        // 윈도우 캡션
                                                  WS_OVERLAPPEDWINDOW,                // 윈도우 스타일
                                                  CW_USEDEFAULT,                        // 초기 X 위치
                                                  CW_USEDEFAULT,                        // 초기 Y 위치
                                                  CW_USEDEFAULT,                        // 초기 X 크기
                                                  CW_USEDEFAULT,                        // 초기 Y 크기
                                                  NULL,                                                // 부모 윈도우 핸들
                                                  NULL,                                                // 윈도우 메뉴 핸들
                                                  hInstance,                                // 프로그램 인스턴스 핸들
                                                  NULL);                                        // 생성 매개변수

        ShowWindow(hwnd, SW_SHOW);                // WM_SIZE 발생                // 윈도우를 화면에 표시한다.
        UpdateWindow(hwnd);                                // WM_PAINT 발생        // 윈도우가 자기 자신을 그리도록(paint) 명령한다.

        while ( GetMessage(&msg, NULL, 0, 0) ) {
                TranslateMessage(&msg);
                DispatchMessage(&msg);
        }

/*
        while ( TRUE ) {
                if ( PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) ) {
                        if ( msg.message == WM_QUIT )        break;

                        TranslateMessage(&msg);
                        DispatchMessage(&msg);
                } else {
                }
        }
*/
        return static_cast<int>(msg.wParam);
}