weird screen zooming in when a window is created bug

I’m trying to use SDL and for some reason when it creates a window the monitor blacks out and shows a zoomed in version of what was on my monitor before window creation until the program is stopped by closing the console
I’m using visual studio 2022 with SDL2-devel-2.24.0-VC
this is the code in main.cpp which is the only file in the project

#include  <stdio.h>
#include <SDL.h>
#include <iostream>

int main(int argc, char* args[])
{
	SDL_Window* window = nullptr;
	int* tim = nullptr;
	int bill;
	bill = 9;
	tim = &bill;
	*tim += 9;
	std::cout << bill;
	if (SDL_Init(SDL_INIT_VIDEO) < 0)
		std::cout << "Video initialization Error: " << SDL_GetError() << std::endl;
	else
	{
		window = SDL_CreateWindow("SDL Engine", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 640, 480, SDL_WINDOWEVENT_SHOWN);
		if(window == NULL)
		std::cout << "Window Error: " << SDL_GetError() << std::endl;
		else {
			SDL_UpdateWindowSurface(window);
			SDL_Delay(200000);
		}


	}

	SDL_DestroyWindow(window);
	SDL_Quit();

	return 0;
}

sorry if this isn’t the correct way of posting about this but I have never used a forum before and have no idea how this works

I think the main problem here is passing SDL_WINDOWEVENT_SHOWN as flags to SDL_CreateWindow() - flags are supposed to be from these values: SDL_WindowFlags - SDL Wiki.
The integer value of SDL_WINDOWEVENT_SHOWN is 1 - the same as SDL_WINDOW_FULLSCREEN (which is a valid window flag), which means that’s you’re creating a 640x480 fullscreen window (=> your screen resolution is changed to 640x480 and the SDL_Window is fullscreen).
As you’re not drawing anything, I guess that the window just shows some random garbage, in this case apparently a 640x480 part of what was on your screen (“zoomed” because that small part is stretched all over the screen now).

The window flag you probably meant to use is SDL_WINDOW_SHOWN, but it’s not needed (newly created Windows are automatically shown, unless you set SDL_WINDOW_HIDDEN, see SDL_CreateWindow - SDL Wiki), so you can just pass 0 for the flags.

yeah that fixed it thanks