I removed this:
PresentParams.BackBufferWidth = width; // set the width of the buffer PresentParams.BackBufferHeight = height; // set the height of the buffer
Because of PresentParams.windowed = true; the BackBufferWidth and Height is set automatical.
Also I changed the width and height here:
window = CreateWindowEx( 0,"winmain", //window class"test", //title bar WS_EX_TOPMOST|WS_POPUP|WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_CLIPSIBLINGS|WS_VISIBLE,100, 100, //x,y coordinate wr.right - wr.left, // width of the window wr.bottom - wr.top, // height of the window 0, //parent window 0, //menu g_hInstance, //application instance 0); //display the window
to the variables width, and height. Dunno why I made a rectangle there.