ok, i'm workin' on my scripting engine, still.....
and what I'm doing is trying to make it so that the file passed to the exe will run (ie: you click and drag a file on top of the exe and it runs it.....)
now, thing is, I am right now just testing something out, and i've noticed that I am forcing the program to open VARS.ost, which is in the same folder as the exe. Now, when I run the program straight without dragging anything on to it, it runs fine, but when I drag something on to it, for some really stupid reason, the program thinks that the file is in a whole new freaking directory and says it "can't find it".
i'm getting really po'ed at windows
but yah, here's the code that really has to do with the opening and closing.......
Code:
bool scripting(char* filename)
{
ifstream script; //Our file variable
script.open(filename,ios::nocreate); //Open the file
int line=-1;
if(script.is_open()) //If it opened successfully
{
.....//blah blah, all the code for testing the program goes here....
}
else
{
Error("Missing File","empty",-1,MB_OK | MB_ICONINFORMATION,"Couldn't Find %s",filename);
return false;
}
openedonce=true;
return true;
}
and here is the main code for the WinMain loop:
Code:
int WINAPI WinMain( HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
MSG msg;
if(!main.CreateGLWindow("OpenScript",640,480,16,true,IDI_ICON1))
return 0;
while(!done)
{
if(PeekMessage(&msg,NULL,0,0,PM_REMOVE))
{
if(msg.message==WM_QUIT)
done=TRUE;
else
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
else
{
if(main.active)
{
if(main.keys[VK_ESCAPE])
done=TRUE;
else
{
DrawScene("vars.ost");
SwapBuffers(main.hDC);
}
}
}
}
main.KillGLWindow();
return(msg.wParam);
}
now see above? i'm FORCING it to open vars.ost, but when i pass a file to it, it freaks out for NO reason whatsoever
aaaaaaaaaaaaaarggg!!!!!!!!!!!