开发者

Is it possible to check for the Visual C++ runtime at startup of an MFC application?

开发者 https://www.devze.com 2023-02-20 20:56 出处:网络
When an MFC application starts, is it possible to check for the Visual C++ runtime before the \"application开发者_如何学编程 configuration\" error is displayed?

When an MFC application starts, is it possible to check for the Visual C++ runtime before the "application开发者_如何学编程 configuration" error is displayed?

I assume it must be done via pure Win32 API at some point before the CRT loads.


The error is coming from the operating system, before your program is even finished loading. There is no part of the program, not even initialization, which has run yet. Thus no way your program can eliminate the error message by itself.

Edit: You might be able to set the runtime DLL as a delay-loaded DLL to get your program loaded in the absence of the runtime. Then you'd have to substitute your own function for the .exe entry point and have it check for the existence of the runtime library. There are many technical difficulties associated with this approach, and I'm not even sure it would work at all - but it might be possible.


Well, you get that error because you're missing the redistributables. So instead of trying something like that, you should rather install the VC++ redistributables from Microsoft (as prerequisite for your application). I used to keep a list of the downloads here.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号