Failed to load and parse the manifest

Error while building a C++ Windows API program

Page 1 of 1

2 Replies - 10671 Views - Last Post: 15 September 2008 - 09:42 AM Rate Topic: -----

#1 xavier20xg6  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 4
  • Joined: 14-September 08

Failed to load and parse the manifest

Post icon  Posted 14 September 2008 - 11:45 AM

Hey everyone, sorry if this is a noob question but am having trouble getting my code to compile. When I build the project I get an error saying "Failed to load and parse the manifest. The system cannot find the file specified."

This is my code so far:

#include <windows.h>
#include <stdafx.h>
#include <iostream>

using namespace std;

const char g_szClassName[] = L"myWindowClass";

// Step 4: the Window Procedure
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch(msg)
	{
		case WM_CLOSE:
			DestroyWindow(hwnd);
		break;
		case WM_DESTROY:
			PostQuitMessage(0);
		break;
		default:
			return DefWindowProc(hwnd, msg, wParam, lParam);
	}
	return 0;
}

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
	LPSTR lpCmdLine, int nCmdShow)
{
	WNDCLASSEX wc;
	HWND hwnd;
	MSG Msg;

	//Step 1: Registering the Window Class
	wc.cbSize		= sizeof(WNDCLASSEX);
	wc.style		 = 0;
	wc.lpfnWndProc   = WndProc;
	wc.cbClsExtra	= 0;
	wc.cbWndExtra	= 0;
	wc.hInstance	 = hInstance;
	wc.hIcon		 = LoadIcon(NULL, IDI_APPLICATION);
	wc.hCursor	   = LoadCursor(NULL, IDC_ARROW);
	wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
	wc.lpszMenuName  = NULL;
	wc.lpszClassName = g_szClassName;
	wc.hIconSm	   = LoadIcon(NULL, IDI_APPLICATION);

	if(!RegisterClassEx(&wc))
	{
		MessageBox(NULL, L"Window Registration Failed!", L"Error!",
			MB_ICONEXCLAMATION | MB_OK);
		return 0;
	}

	// Step 2: Creating the Window
	hwnd = CreateWindowEx(
		WS_EX_CLIENTEDGE,
		g_szClassName,
		L"The title of my window",
		WS_OVERLAPPEDWINDOW,
		CW_USEDEFAULT, CW_USEDEFAULT, 240, 120,
		NULL, NULL, hInstance, NULL);

	if(hwnd == NULL)
	{
		MessageBox(NULL, L"Window Creation Failed!", L"Error!",
			MB_ICONEXCLAMATION | MB_OK);
		return 0;
	}

	ShowWindow(hwnd, nCmdShow);
	UpdateWindow(hwnd);

	// Step 3: The Message Loop
	while(GetMessage(&Msg, NULL, 0, 0) > 0)
	{
		TranslateMessage(&Msg);
		DispatchMessage(&Msg);
	}
	return Msg.wParam;
}



Any help would be greatly appreciated.

Is This A Good Question/Topic? 0
  • +

Replies To: Failed to load and parse the manifest

#2 perfectly.insane  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 70
  • View blog
  • Posts: 644
  • Joined: 22-March 08

Re: Failed to load and parse the manifest

Posted 14 September 2008 - 05:34 PM

Is there a resource file associated with your program (a .rc file?). If this is happening during the build phase (as opposed to the execution of your program), it almost seems like there's a resource file trying to include a manifest file that does not exist. A manifest file is used to modify how the operating system treats your executable when it is loaded. A very common use of this is to indicate that your application should link against the comctl32.dll version 6 that comes with Windows XP (which supports the new visual styles introduced with XP). I suppose if one used a tool like Visual Studio to create a Windows application, it's possible that it adds some files like this to your program by default, but something has broken (possibly using the project on different versions of Visual Studio). I don't use Visual Studio, so I don't know for sure.

It would help if you could give details as to the tools you're using to compile the program, and the exact compiler output (at least all of the error messages).

This post has been edited by perfectly.insane: 14 September 2008 - 05:39 PM

Was This Post Helpful? 0
  • +
  • -

#3 xavier20xg6  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 4
  • Joined: 14-September 08

Re: Failed to load and parse the manifest

Posted 15 September 2008 - 09:42 AM

The problem seems to have solved itself, I restarted my computer and now the code is compiling and running fine. Thanks for the input.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1