XP Problems RRS feed

  • Question

  • Hello,

    I'm trying to open my .exe that I developed using Media Foundation on a Windows XP machine. I know that media foundation isn't supported on XP but I want to be able to run my .exe and have the application check the OS the computer is running and then call certain code depending on the OS. If it's running Windows 7 run the Media Foundation code, but if running XP run DirectShow code. However, when I try to just open my .exe on my XP machine I get an error saying that MF.dll isn't there, which is obvious. Is there a way around this, or would I have to develop a separate application for the XP machines?

    Any help you can provide would be appreciated,



    EDIT: I've tried a few more things without any success. I've tried take the libraries out of the "Additional Dependencies" section of the properties and adding "#pragma comment(lib, "MF.lib")" for all of the libraries that I don't need and only calling that code when the major version of windows is 6. This ensures that MF.dll should be on the computer. However since I'm not using constants (The only way I know of getting the version of windows is using "GetVersion()" or "GetVersionEx()", if there are other ways already predefined in windows it would be a great help to know them.) to determine the version of windows all of my code is greyed out until the code compiles and runs and this is too late for the #pragmas because I'm getting unresolved externals in my build. Hope this helps. Am I totally unable to do this? It's starting to seem so. Thanks.

    Tuesday, July 19, 2011 2:57 PM


All replies

  • Would delay loading the MF dlls work for you?
    • Marked as answer by apipher Wednesday, July 20, 2011 6:41 PM
    Tuesday, July 19, 2011 10:30 PM
  • Not sure, I've never done that before.

    How long does it delay? Will it not load them if I set a parameter before the delay is over? Even if it delays and then loads the library a few seconds later it will still cause the problems I'm running into at the moment.

    EDIT: I tried doing this but I'm getting unresolved external symbols when trying to compile. Is there a way around these errors when I delay load?

    Wednesday, July 20, 2011 1:26 AM
  • IIRC, delay loading does not load a DLL until it is used.  So if you have a code path:

    if(is_xp_os()) { dshow(); } else { mediaFoundation(); }

    It should never try to load the MF dlls on XP.  I have not tried w/ MF and some DLLs you cannot do this with.


    Wednesday, July 20, 2011 4:04 PM
  • That works! Thanks a lot jmorrill!
    Wednesday, July 20, 2011 6:41 PM