API - Create window help

Miscellaneous Forums/Win32 Discussion/API - Create window help

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Not sure if this is much use:-

LRESULT APIENTRY WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) 
{ 
    PAINTSTRUCT ps; 
    HDC hdc; 
 
    switch (message) 
    { 
        case WM_PAINT: 
            hdc = BeginPaint(hwnd, &ps); 
            TextOut(hdc, 0, 0, "Hello!", 15); 
            EndPaint(hwnd, &ps); 
            return 0L; 

        // Process other messages.  
    } 
} 
 
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) 
{ 
    HWND hwnd; 
 
    hwnd = CreateWindowEx( 
        // parameters 
        ); 
 
    ShowWindow(hwnd, SW_SHOW); 
    UpdateWindow(hwnd); <--- Call this if you want to update your window!
 
    return msg.wParam; 
} 



Basically, you call a WinAPI (GDI) function called UpdateWindow(hWnd), this sends a WM_PAINT event to your call back function, then you can draw your updated window again!

Dabz