   weird access violation when trying to render video file
  As the title suggests, i'm having trouble loading a video file using DirectShow. for some reason, when i run the program, it gives me an access violation but it doesn't point to anything. i removed the line where i load the video and it works fine. any ideas what's wrong?here's my code for reference.#include "stdafx.h"using namespace std;IGraphBuilder* g_pGraph;IMediaControl* g_pMedia;IMediaEvent*   g_pEvent;IVideoWindow* g_pVideoWindow;HWND g_pMainWindow = 0;Cor_Direct3D9Renderer* g_pRenderer = new Cor_Direct3D9Renderer();int _tmain(int argc, _TCHAR* argv[]){//Create Window.g_pMainWindow = g_pRenderer->CreateWindowDX("Media",0,0,800,600);CoInitialize(NULL);CoCreateInstance(CLSID_FilterGraph,NULL,CLSCTX_INPROC_SERVER,IID_IGraphBuilder,(void**)&g_pGraph);g_pGraph->QueryInterface(IID_IMediaControl,(void**)&g_pMedia);g_pGraph->QueryInterface(IID_IMediaEvent,(void**)&g_pEvent);g_pGraph->QueryInterface(IID_IVideoWindow,(void**)&g_pVideoWindow);g_pVideoWindow->put_AutoShow(SW_SHOW);g_pVideoWindow->put_WindowStyle(WS_CHILD | WS_CLIPSIBLINGS);g_pVideoWindow->put_Owner((OAHWND)g_pMainWindow);g_pMedia->RenderFile(L"Video//Video.avi");while(g_pRenderer->MessagePump(g_pMainWindow)){}return 0;}I appreciate any advice, suggestions.   
  Why are you putting that double slash in "Video//Video.avi"? is the backlash '\' which should be doubled.Besides, you aren't doing any error checking, does everything return S_OK?Edit: Another thing: have you tried to render the file from graphedit? Does it work?   ;  I tried to render it to the window but it doesn't render at all. i wonder why. I also removed the // in the function and it works great. but like i said, it doesn't render to the window. my new code is this:#include "stdafx.h"using namespace std;IGraphBuilder* g_pGraph;IMediaControl* g_pMedia;IMediaEvent*   g_pEvent;IVideoWindow* g_pVideoWindow;HWND g_pMainWindow = 0;Cor_Direct3D9Renderer* g_pRenderer = new Cor_Direct3D9Renderer();int _tmain(int argc, _TCHAR* argv[]){//Create Window.g_pMainWindow = g_pRenderer->CreateWindowDX("Media",0,0,800,600);HRESULT HR = CoInitialize(NULL);if(FAILED(HR)){MessageBoxA(NULL,"Could not create instance",NULL,MB_OK);return 1;}HR = CoCreateInstance(CLSID_FilterGraph,NULL,CLSCTX_INPROC_SERVER,IID_IGraphBuilder,(void**)&g_pGraph);if(FAILED(HR)){MessageBoxA(NULL,"Could not create Instance of IGraphBuilder",NULL,MB_OK);return 1;}else{g_pGraph->QueryInterface(IID_IMediaControl,(void**)&g_pMedia);g_pGraph->QueryInterface(IID_IMediaEvent,(void**)&g_pEvent);g_pGraph->QueryInterface(IID_IVideoWindow,(void**)&g_pVideoWindow);g_pVideoWindow->put_AutoShow(SW_SHOW);g_pVideoWindow->put_WindowStyle(WS_CHILD | WS_CLIPSIBLINGS);g_pVideoWindow->put_Owner((OAHWND)g_pMainWindow);}g_pGraph->RenderFile(L"Video\Video.avi",NULL);while(g_pRenderer->MessagePump(g_pMainWindow)){g_pMedia->Run();}return 0;}in theory, it should render to the window i choose no? but for some reason it doesn't render. maybe it can't find the file?   ;  Shouldn't you have a double backslash in your string for the path separator?"Video\\Video.avi"Also why are you calling 'Run' in a loop? You only need to call it once. Remove the loop entirely, start putting in event handling when it starts working [smile]. You could also add the bit about registering the graph in the registry so you can see it in graphedit (you can find this in the samples).Moreover, check the result of both 'RenderFile()' and 'Run()' - that's where it's most probably going wrong   ;  Ok, i noticed somethning strange. when i put one "\" in the renderfile function it works but it doesn't load the movie. when i put two of them it gives me an access violation. wth? Windows Media player opens it. so i don't know why it's not loading it.   ;Quote:Original post by EnerjakOk, i noticed somethning strange. when i put one "\" in the renderfile function it works but it doesn't load the movie. when i put two of them it gives me an access violation. wth? Windows Media player opens it. so i don't know why it's not loading it.You definitely need '\\' in your path string. Otherwise it won't do anything since it's not finding the file - \V will be treated as an escape character and probably ignored. ;Quote:Original post by EnerjakOk, i noticed somethning strange. when i put one "\" in the renderfile function it works but it doesn't load the movie. when i put two of them it gives me an access violation. wth? Windows Media player opens it. so i don't know why it's not loading it.Hello,Linux path separator is "/".Windows is, usually, "\", although you can use "/", too."\" is the C/C++ string escape character; if you want a line feed you have to put "\n", and for a tab you use "\t".So, how you tell the compiler you want to open the file "C:\temp"?You have to use the double backslash to inform the compiler that you don't want to escape anything, you just want a plain backslash.: "C:\\temp"You also could use "C:/temp", but "C://temp" or "C:\temp" are both plain wrong.Now, about your original question, first I would try to open GraphEdit and drag the file you want to render. If it doesn't work, then you don't have an appropiate filter or your filters' priorities are fucked up. If it does work in graphedit, then it's something in your code. In this last case I would use the full path, not a local one. Anyway, it shouldn't crash if the file doesn't exist. What codec is the video compressed with?;  What does your Cor_Direct3D9Renderer class look like? When you get the access violation, what does your call stack look like (It'll break to the debugger)? And what is the exact access violation message? That can help in tracking the problem down a lot - An access violation reading near 0x00000000 is usually a null pointer, near 0xbaadf00d is usually from a Release()'d interface, and so on.I had odd problems in my VMR9 code (Link to thread - my source code is linked there if it's any use) because I was screwing up a QueryInterface call.EDIT: In the source linked in that thread, you can replace TextureRendererVMR.h and .cpp with TextureRenderer .h and .cpp in the project and it's an almost working DirectShow render-to-texture sample (I'll be doing a tutorial about this at some point in my GameDev.Net journal).As far as paths go, most Win32 functions are pretty robust and will accept double slashes and a mix of both forward and back slashes. When you're writing the string in code, you should always use either a forward slash or two backslashes - since the first is an escape code, the compiler converts the double backslash into a single one.If you don't get an access violation when you pass in an invalid file path, then that just tells you that the error is coming from something to do with the rendering or file loading, and not from the first few lines, but it doesn't tell you much else.   ;  @Evil Steve. it gives me the 0x00000000 access violation type when i try to load the file. >02b4b5ed()it points to this in the stack window. also, it says that no symbols are loaded or something. So i don't know what to do, hope someone has some suggestions   ;Quote:Original post by EnerjakSo i don't know what to do, hope someone has some suggestionsI've got a couple but you don't seem very interested :-pRemove all the IVideoWindow stuff and tell us what happens.   