Question:
C++ help error c1010070: Failed to load and parse the manifest. The system cannot find the file specified?
guitar_freak110
2008-12-30 17:52:23 UTC
I keep getting this error for this code:

// Beginning Game Programming, Second Edition
// Chapter 4
// GameLoop project

#include
#include
#include
#include
#include

#define APPTITLE "Game Loop"

//function prototypes
LRESULT CALLBACK WinProc(HWND,UINT,WPARAM,LPARAM):
ATOM MyRegisterClass(HINSTANCE);
BOOL InitInstance(HINSTANCE,int);
void DrawBitmap(HDC,char*,int,int);
void Game_Init();
void Game_Run();
void Game_End();

//local variables
HWND global_hwnd;
HDC global_hdc;

//the window event callback function
LRESULT CALLBACK WinProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
global_hwnd = hWnd;
global_hdc = GetDC(hWnd);

switch (message)
{
case WM_DESTROY:
PostQuitMessage(0);
break;
}
return DefWindowProc(hWnd, message, wParam, lParam);
}

//helper function to set up the window properties
ATOM MyRegisterClass(HINSTANCE hInstance)
{
//create the window class structure
WNDCLASSEX wc;
wc.cbSize = sizeof(WNDCLASSEX);

//fill the struct with info
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = (WNDPROC)WinProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = NULL;
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
wc.lpszMenuName = NULL;
wc.lpszClassName = APPTITLE;
wc.hIconSm = NULL;

//set up the window with the class info
return RegisterClassEx(&wc);
}

//helper function to create the window and refresh it
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
HWND hWnd;

//create a new window
hWnd = CreateWindow(
APPTITLE, //window class
APPTITLE, //title bar
WS_OVERLAPPEDWINDOW, //windowstyle
CW_USEDEFAULT, //x position of window
CW_USEDEFAULT, //y position of window
500, //width of the window
400, //height of the window
NULL, //parent window
NULL, //menu
hInstance, //application instance
NULL); //window parameters

//was there an error creating the window?
if (!hWnd)
return FALSE;

//display the window
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);

return TRUE;
}

//entry point for a Windows program
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
int done = 0;
MSG msg;

// register the class
MyRegisterClass(hInstance);

// initialize application
if (!InitInstance (hInstance, nCmdShow))
return FALSE;

//initialize the game
Game_Init();

// main message loop
while (!done)
{
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
//look for quit message
if (msg.message == WM_QUIT)
done = 1;

//decode and pass messages on to WndProc
TranslateMessage(&msg);
DispatchMessage(&msg);
}

//process game loop
Game_Run();
}

//do cleanup
Game_End();

return msg.wParam;
}
void Game_Init()
{
//initialize the game...
//load bitmaps, meshes, textures, sounds, etc.

//initialize the random number generator
srand(time(NULL));
}
void Game_Run()
{
//this is called once every frame
//do not include your own loop here!

int x = 0, y = 0;
RECT rect;
GetClientRect(global_hwnd, &rect);

if (rect.right > 0)
{
x = rand() % (rect.right - rect.left);
y = rand() % (rect.bottom - rect.top);
DrawBitmap(global_hdc, "c.bmp", x, y);
}
}

void Game_End()
{
}
void DrawBitmap(HDC hdcDest, char *filename, int x, int y)
{
HBITMAP image;
BITMAP bm;
HDC hdcMem;

//load the bitmap image
image = (HBITMAP)LoadImage(0,"c.bmp",IMAGE_BITMAP,0,0,LR_LOADFROMFILE);

//read the bitmap's properties
GetObject(image, sizeof(BITMAP), &bm);

//create a device context for the bitmap
hdcMem = CreateCompatibleDC(global_hdc);
SelectObject(hdcMem, image);

//draw the bitmap to the window (bit block transfer)
BitBlt(
global_hdc, //destination device context
x, y, //x,y location on destination
bm.bmWidth, bm.bmHeight //width, height of source bitmap
hdcMem, //source bitmap device context
0, 0, //start x,y on source bitmap
SRCCOPY); //blit method

//delete the device context and bitmap
DeleteDC(hdcMem);
DeleteObject((HBITMAP)image);
}

What am I doing wrong?
Four answers:
2009-01-01 08:48:46 UTC
The core problem is that Visual Studio is being asked to incorporate a manifest file but it cannot seem to find it.



From research the problem appears to stem from a possible number of sources, most related to the project itself. Some potential causes:



1) Numbers or spaces in the project name

2) Project name too long

3) Started creating the project from a blank project that doesn't have all of the parts.



I'd suggest trying each of the following to see if it fixes the issue- but backup your project/solution directory first.



A) Clean and rebuild the solution



B) Right click on the solution for the project (in Solution Explorer) and rename the solution to a very simple name (e.g., soln). Then do the same for the project (e.g., rename to proj). Do a rebuild all and see if the problem goes away. If it does you can rename the solution and project to something more meaningful.



C) Right click on the project and open it's properties. Go To Link | Manifest and turn off use of the manifest. Rebuild.



D) Create a new Win32 console project. Have Visual Studio create the initial CPP and .H files you need. Open your old source files and copy the code from those into the new files. Rebuild the new project.



Good luck.
?
2016-11-06 21:14:48 UTC
1
Baluchistan
2016-02-03 20:34:34 UTC
The system cannot find the file specified..please help me
2016-04-02 03:47:58 UTC
For the best answers, search on this site https://shorturl.im/aycCM



im not too btight on this matter, but try downloading "hijackthis: and copy your log onto their forums and see if anyone can help you


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...