Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8686603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:53:40+00:00 2026-06-12T22:53:40+00:00

I saw another post addressing this issue however the asker was apparently including winnt.h

  • 0

I saw another post addressing this issue however the asker was apparently including winnt.h instead of windows.h (which supposedly includes winnt.h)

I’m using windows.h but still getting this issue.

I’ve tried using Visual Studio 2010 Express and Ultimate and both produce this error.

Has anyone encountered this before?

Here is the code:

#include<Windows.h>
#include<d3d9.h>
#include<time.h>
#include<d3dx.h>

#define APPTITLE "Create Surface"

#define KEY_DOWN(vk_code)((GetAsyncKeyState(vk_code) & 0x8000) ? 1 : 0)
#define KEY_UP(vk_code)((GetAsyncKeyState(vk_code) & 0x8000) ? 1 : 0)

#define SCREEN_WIDTH 640
#define SCREEN_HEIGHT 480

LRESULT WINAPI WinProc(HWND, UINT, WPARAM, LPARAM);
ATOM MyRegisterClass(HINSTANCE);
int Game_Init(HWND);
void Game_Run(HWND);
void Game_End(HWND);

LPDIRECT3D9 d3d = NULL;
LPDIRECT3DDEVICE9 d3ddev = NULL;

LPDIRECT3DSURFACE9 backbuffer = NULL, surface = NULL;

LRESULT WINAPI WinProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam){
    switch(msg){
    case WM_DESTROY:
        Game_End(hWnd);
        PostQuitMessage(0);
        return 0;
    }
    return DefWindowProc(hWnd, msg, wParam, lParam);
}

ATOM MyRegisterClass(HINSTANCE hInstance){
    WNDCLASSEX wc;
    wc.cbSize = sizeof(WNDCLASSEX);

    wc.style = CS_HREDRAW | CS_VREDRAW;
    wc.lpfnWndProc = (WNDPROC)WinProc;
    wc.cbWndExtra = 0;
    wc.cbClsExtra = 0;
    wc.hInstance = hInstance;
    wc.hIcon = NULL;
    wc.hCursor = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
    wc.lpszMenuName = NULL;
    wc.lpszClassName = APPTITLE;
    wc.hIconSm = NULL;

    return RegisterClassEx(&wc);
}

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow){
    MSG msg;

    MyRegisterClass(hInstance);

    HWND hWnd;

    hWnd = CreateWindow(
        APPTITLE,
        APPTITLE,
        WS_EX_TOPMOST | WS_VISIBLE | WS_POPUP,
        CW_USEDEFAULT,
        CW_USEDEFAULT,
        SCREEN_WIDTH,
        SCREEN_HEIGHT,
        NULL,
        NULL,
        hInstance,
        NULL);

    if(!hWnd)
        return FALSE;

    ShowWindow(hWnd, nCmdShow);
    UpdateWindow(hWnd);

    if(!Game_Init(hWnd))
        return 0;

    int done = 0;
    while(!done){
        if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)){
            if(msg.message == WM_QUIT)
                done = 1;
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
        else
            Game_Run(hWnd);
    }
    return msg.wParam;
}

int Game_Init(HWND hWnd){
    HRESULT result;

    d3d = Direct3DCreate9(D3D_SDK_VERSION);
    if(d3d == NULL){
        MessageBox(hWnd, "Failed to initialise d3d", "Error", MB_OK);
        return 0;
    }

    D3DPRESENT_PARAMETERS d3dpp;
    ZeroMemory(&d3dpp, sizeof(d3dpp));

    d3dpp.Windowed = FALSE;
    d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
    d3dpp.BackBufferFormat = D3DFMT_X8R8G8B8;
    d3dpp.BackBufferCount = 1;
    d3dpp.BackBufferHeight = SCREEN_HEIGHT;
    d3dpp.BackBufferWidth = SCREEN_WIDTH;
    d3dpp.hDeviceWindow = hWnd;

    d3d->CreateDevice(
        D3DADAPTER_DEFAULT,
        D3DDEVTYPE_HAL,
        hWnd,
        D3DCREATE_SOFTWARE_VERTEXPROCESSING,
        &d3dpp,
        &d3ddev);

    if(d3ddev == NULL){
        MessageBox(hWnd, "Failed to initialise Direct3D device", "Error", MB_OK);
        return 0;
    }

    srand(time(NULL));

    d3ddev->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0);

    d3ddev->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &backbuffer);

    result = d3ddev->CreateOffscreenPlainSurface(
        100,
        100,
        D3DFMT_X8R8G8B8,
        D3DPOOL_DEFAULT,
        &surface,
        NULL);

    if(!result)
        return 1;

    return 1;
}

void Game_Run(HWND hWnd){
    RECT rect;
    int r,g,b;

    if(d3ddev == NULL)
        return;

    if(d3ddev->BeginScene()){
        r = rand() % 255;
        g = rand() % 255;
        b = rand() % 255;
        d3ddev->ColorFill(surface, NULL, D3DCOLOR_XRGB(r,g,b));

        rect.left = rand() % SCREEN_WIDTH / 2;
        rect.right = rect.left + rand() % SCREEN_WIDTH / 2;
        rect.top = rand() % SCREEN_HEIGHT;
        rect.bottom = rect.top + rand() % SCREEN_HEIGHT / 2;

        d3ddev->StretchRect(surface, NULL, backbuffer, &rect, D3DTEXF_NONE);

        d3ddev->EndScene();
    }

    d3ddev->Present(NULL, NULL, NULL, NULL);

    if(KEY_DOWN(VK_ESCAPE))
        PostMessage(hWnd, WM_DESTROY, 0, 0);
}

void Game_End(HWND hWnd){
    surface->Release();

    if(d3ddev != NULL)
        d3ddev->Release();

    if(d3d != NULL)
        d3d->Release();
}

And the link for the post I mentioned above:
syntax error : missing ';' before identifier 'PVOID64' when compiling winnt.h

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T22:53:41+00:00Added an answer on June 12, 2026 at 10:53 pm

    So I think I stumbled across a solution when trying to sort this on a different laptop.

    There’s something that seems to get installed with the Windows SDK called Windows SDK Configuration Tool. Running that detects which versions of the SDK you have installed then allows you to select which one to use. It then configures all versions of Visual Studio you have to use the selected version.

    I think that solved the issue – not had a proper chance to fully check yet – I also uninstalled all versions of Visual Studio I had with all related components and reinstalled just the one I needed (for the time being – might install other versions later to see if that potentially cause a conflict of sorts).

    Anyway, just figured I’d leave a possible solution on here for anyone that happens across this thread.

    \,,/[>.<]\,,/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I recently saw this code on another post ( jQuery Set Cursor Position in
I saw this list of major version numbers for Java in another post: Java
Before you mark this as answered in another post (I already saw those). But
I saw another post suggesting using this statement to trim string variables contained in
I saw this syntax on another StackOverflow post and was curious as to what
I saw this code in another SO post: jQuery UI Autocomplete with ASP MVC
I'm writing bug tracking software in PHP, and today I saw this in another
So I saw an answer in another question saying that this should work: using
So I saw this post here and read it and it seems like bulk
So I saw this great blog post, Experimenting with Node.js . I decided to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.