ShellExecute() launch .CHM and PDF file not work in Window 7
-
Yes, you are right, ShellExecuteEx() return true or false. But still cannot solve my problem.
Andraw111 wrote:
Yes, you are right, ShellExecuteEx() return true or false.
But still cannot solve my problem.Okay, but what is it returning? True or False? If false, did you check
GetLastError()
? What was it's value?/* Charles Oppermann */ http://weblogs.asp.net/chuckop
-
Andraw111 wrote:
Yes, you are right, ShellExecuteEx() return true or false.
But still cannot solve my problem.Okay, but what is it returning? True or False? If false, did you check
GetLastError()
? What was it's value?/* Charles Oppermann */ http://weblogs.asp.net/chuckop
-
Andraw111 wrote:
Yes, you are right, ShellExecuteEx() return true or false.
But still cannot solve my problem.Okay, but what is it returning? True or False? If false, did you check
GetLastError()
? What was it's value?/* Charles Oppermann */ http://weblogs.asp.net/chuckop
Finally I found what cause the .CHM file cannot open in Window 7. In my MFC application, I have a project setting: Link -> Output ->Reserve field, I put "0x40000000". I create a testing application, if I don't set "0x40000000" to Reserve field, it works fine, otherwise, it cannot open .CHM file in Window 7. Even I know the reason, I still cannot solve the problem, since our project is very large, if I remove that setting, when I run my application I get "XX MFC application has encountered a problem and needs to close....".
-
Thanks for reply, it return 8. But strange thing is that if I create a brand new MFC project and use the same codes to open .CHM file, it works fine, why?
I strongly suspect that COM initialization is at issue here[^]. Earlier, I mentioned that COM has to be initialized as follows:
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE)
This is why I think you're new project works and the old one doesn't. Is your old project using multithreaded COM? If so, the calls might fail. [Just saw your other post that resolves your issue. I'm posting this for other people who might encounter ShellExecute problems.]
/* Charles Oppermann */ http://weblogs.asp.net/chuckop
-
I strongly suspect that COM initialization is at issue here[^]. Earlier, I mentioned that COM has to be initialized as follows:
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE)
This is why I think you're new project works and the old one doesn't. Is your old project using multithreaded COM? If so, the calls might fail. [Just saw your other post that resolves your issue. I'm posting this for other people who might encounter ShellExecute problems.]
/* Charles Oppermann */ http://weblogs.asp.net/chuckop