Window successfully compiling but not showing up

Hello all I hope this isn't a double post of a topic that has already been created. I've searched before on the site but haven't seen this subject in the searches, if it does exist than I'm sorry for double posting it. Ok so here it's what I have to say, I'm having a problem when trying to run the main window of a software. When I run it, the compiler says there are no errors and the application does load but this is where it starts to have issues.More specifically, when I hit debug, it starts to load but the loading never ends, it's like it's stuck in a loading loop or something simmilar, therefore the application never opens up. Does anyone know why is this happening?
Here is the code by the way:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include <windows.h>
#include <d3d11.h>
#include <math.h>

HINSTANCE hInstance;
HWND hWnd;
/*int nCmdShow = SW_SHOWMAXIMIZED;*/

WNDPROC wndProc; LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);			//window procedure

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)				//app entrypoint
{
	
	
	
	WNDCLASSEX wnd;																							//structure declaration
	UINT uMsg = {0};																								//message declaration

	wnd.cbSize = sizeof(WNDCLASSEX);
	wnd.style = CS_HREDRAW | CS_VREDRAW;
	wnd.cbClsExtra = 0;
	wnd.cbWndExtra = 0;
	wnd.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
	wnd.hCursor = LoadCursor(hInstance,IDC_ARROW);
	wnd.hIcon = LoadIcon(hInstance,IDC_ARROW);
	wnd.hInstance = hInstance;
	wnd.lpfnWndProc = wndProc;
	wnd.lpszClassName = L"psiEngineMain";
	wnd.lpszMenuName = L"MainMenu";
	wnd.hIconSm = NULL;

	if(!RegisterClassEx(&wnd))																		//register class with system
		return false;
	
	 HWND main_window =  CreateWindow(L"psiEngineMain",L"Psi Engine v. 0.01 Alpha",WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,		//create the window which will be shown
						CW_USEDEFAULT,0,0,0,0,hInstance,0);

	ShowWindow(main_window,SW_SHOWDEFAULT);																	//show window
				UpdateWindow(main_window);																		//update window		
				
	while(GetMessage((LPMSG)uMsg,hWnd,0,0) != false){
			TranslateMessage((LPMSG)uMsg);
			DispatchMessage((LPMSG)uMsg);
		}

		switch (uMsg){
			case WM_PAINT:
				UpdateWindow(main_window);
				MessageBox(NULL,L"Window opened successfully",L"Welcome!",MB_OKCANCEL);
				break;
			case WM_QUIT:
				PostQuitMessage(true);
				break;
			case WM_DESTROY:
				DestroyWindow(hWnd);																//close window
				break;
		}

		return uMsg;
}
could be an infinite loop

1
2
3
4
	while(GetMessage((LPMSG)uMsg,hWnd,0,0) != false){
			TranslateMessage((LPMSG)uMsg);
			DispatchMessage((LPMSG)uMsg);
		}


are you sure GetMessage eventually returns false so it can exit the while loop?
Can you be more elaborate?
...

1
2
3
4
5
6
7
8
9
10
11
12
13
#include <iostream>

int main()
{
    int i;

    while (true != false)
    {
        i++;
    }

    std::cout << "true is equal to false" << std::endl;
}


compile and run it, does text get printed?
Last edited on
pcristian: You are in bad need of a Windows programming tutorial. Here's mine...

http://www.jose.it-berater.org/smfforum/index.php?topic=3389.0

There may be better ones out there.

To be a little specific, your program architecture is completely wrong. At top you have a prototype for a Window Procedure (the most important topic in Windows Programming), but nowhere visible in the code shown is an implementation of that function.

When DispatchMessage() is called in your message pump, Windows will call the non-existant Window Procedure for the psiEngineMain class and dispatch all messages to that function - which apparently doesn't exist in your program. C or C++ will compile code containing unimplemented procedure declarations, but Windows the operating system can't create windows without Window Procedures.

That business of putting that switch statement under the message pump has to go. Its useless.
Last edited on
Ok everyone now yeah, it seems I've forgot to add code in the window procedure, so I've started to code a new window again. Anyway now everything compiles and builds fine but I'm having a debug error. This is what the debug output prints to the new empty window:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
'tauCeti.exe': Loaded 'D:\programe\tauCeti\Debug\tauCeti.exe', Symbols loaded.
'tauCeti.exe': Loaded 'C:\Windows\SysWOW64\ntdll.dll', Cannot find or open the PDB file
'tauCeti.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll', Cannot find or open the PDB file
'tauCeti.exe': Loaded 'C:\Windows\SysWOW64\KernelBase.dll', Cannot find or open the PDB file
'tauCeti.exe': Loaded 'C:\Windows\SysWOW64\user32.dll', Cannot find or open the PDB file
'tauCeti.exe': Loaded 'C:\Windows\SysWOW64\gdi32.dll', Cannot find or open the PDB file
'tauCeti.exe': Loaded 'C:\Windows\SysWOW64\lpk.dll', Cannot find or open the PDB file
'tauCeti.exe': Loaded 'C:\Windows\SysWOW64\usp10.dll', Cannot find or open the PDB file
'tauCeti.exe': Loaded 'C:\Windows\SysWOW64\msvcrt.dll', Cannot find or open the PDB file
'tauCeti.exe': Loaded 'C:\Windows\SysWOW64\advapi32.dll', Cannot find or open the PDB file
'tauCeti.exe': Loaded 'C:\Windows\SysWOW64\sechost.dll', Cannot find or open the PDB file
'tauCeti.exe': Loaded 'C:\Windows\SysWOW64\rpcrt4.dll', Cannot find or open the PDB file
'tauCeti.exe': Loaded 'C:\Windows\SysWOW64\sspicli.dll', Cannot find or open the PDB file
'tauCeti.exe': Loaded 'C:\Windows\SysWOW64\cryptbase.dll', Cannot find or open the PDB file
'tauCeti.exe': Loaded 'C:\Windows\SysWOW64\msvcr100d.dll', Symbols loaded.
'tauCeti.exe': Loaded 'C:\Windows\SysWOW64\imm32.dll', Cannot find or open the PDB file
'tauCeti.exe': Loaded 'C:\Windows\SysWOW64\msctf.dll', Cannot find or open the PDB file
'tauCeti.exe': Loaded 'C:\Windows\SysWOW64\uxtheme.dll', Cannot find or open the PDB file
'tauCeti.exe': Loaded 'C:\Program Files (x86)\Common Files\microsoft shared\ink\tiptsf.dll', Cannot find or open the PDB file
'tauCeti.exe': Loaded 'C:\Windows\SysWOW64\ole32.dll', Cannot find or open the PDB file
'tauCeti.exe': Loaded 'C:\Windows\SysWOW64\oleaut32.dll', Cannot find or open the PDB file
'tauCeti.exe': Loaded 'C:\Windows\SysWOW64\version.dll', Cannot find or open the PDB file
'tauCeti.exe': Loaded 'C:\Windows\SysWOW64\dwmapi.dll', Cannot find or open the PDB file
The program '[2568] tauCeti.exe: Native' has exited with code 0 (0x0).

I've done some research on this error though I haven't been able to solve it completely, though from what I've understood so far it is a Visual Studio error. How can I get rid of it?
I'm thinking it would be more productive to just post what code you have rather than forcing us to guess how you set up your project, what options you used in setting it up, what the code might look like, so on and so forth, in an effort to help you. The comments I made I determined from a quick look at the code you posted. Do the same again, and I'll look at it again. I don't know where those Visual Studio errors are comping from, and I doubt anyone else does either.
As far as I know PDB files aren't really a big deal. I think the fix is just to download a symbol package from microsoft, but it shouldn't stop you from running. AFAIK
Topic archived. No new replies allowed.