can someone help me about creating a window in turbo c??
because i can't find anything about creating a window in turbo c!
is there a site explaining or about creating a window in turbo c??

Dani AI

Generated

Short answer for : the old Turbo C people usually refer to is a DOS/16‑bit compiler and cannot create native Win32/Win64 GUI windows. It produces DOS executables and doesn’t provide the Win32 headers/libs required to register window classes or run a Windows message loop. On modern (64‑bit) Windows those 16‑bit programs won’t run natively, so a compiler that targets Windows is needed.

Both directions mentioned in the thread are valid. As noted, Windows programming needs a Win32-capable toolchain; as suggested, upgrading from Turbo C is the usual path. Two practical approaches: (1) switch to a Win32/Win64 toolchain (Visual Studio, MinGW/GCC, or a Borland Win32 compiler) and learn the Win32 API, or (2) use a higher-level GUI library (Qt, wxWidgets, SDL) so the toolchain and platform details are mostly hidden.

A minimal Win32 skeleton (for a modern compiler) shows the basics — register a window class, create a window, run the message loop:

#include <windows.h>

LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) {
    if (msg == WM_DESTROY) { PostQuitMessage(0); return 0; }
    return DefWindowProc(hWnd, msg, wParam, lParam);
}

int WINAPI WinMain(HINSTANCE hInst, HINSTANCE, LPSTR, int nCmdShow) {
    const char CLASS[] = "MyWinClass";
    WNDCLASS wc = {0};
    wc.lpfnWndProc = WndProc;
    wc.hInstance = hInst;
    wc.lpszClassName = CLASS;
    RegisterClass(&wc);

    HWND h = CreateWindow(CLASS, "Simple Window", WS_OVERLAPPEDWINDOW,
                          CW_USEDEFAULT, CW_USEDEFAULT, 640, 480, NULL, NULL, hInst, NULL);
    if (!h) return 0;
    ShowWindow(h, nCmdShow);
    MSG m;
    while (GetMessage(&m, NULL, 0, 0)) { TranslateMessage(&m); DispatchMessage(&m); }
    return (int)m.wParam;
}

Notes and troubleshooting: compile as a Windows application (not plain DOS/console). With MinGW: gcc win.c -o win.exe -mwindows. Common mistakes include forgetting to register the class, compiling/linking as the wrong subsystem, or expecting Turbo C’s DOS output to work on modern Windows (use DOSBox if the goal is to run DOS programs).

Recommended Answers

All 2 Replies

Windows Programming is a bit advanced. Decide yourself if you have a solid programming background. Take a look at this tutorial. See if you understand the code. If you can't understand that code, learn C a bit more. Just being able to compile and execute will not be enough. You should be able to make changes when necessary.

You will probably need to download the Borland 5.5 compiler at the very least.

can someone help me about creating a window in turbo c??
because i can't find anything about creating a window in turbo c!
is there a site explaining or about creating a window in turbo c??

That's because you can't do it with that compiler -- Turbo C is just too ancient. Upgrade to a more modern compiler such as Borland C++ or .

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.