Click here to Skip to main content
15,617,242 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
When I press a button I open a PDF, BUT PDF opens under dialog, how can I do?

In my program I have a dialog and when I press a button PDF opens, but PDF opens under dialog, so I can't see it, I would like see PDF in the foreground

What I have tried:

I used
ShellExecute(NULL, _T("open"), str_FilePathPDF, NULL, NULL, SW_SHOWNORMAL);
Updated 5-Aug-21 2:48am
OriginalGriff 5-Aug-21 4:49am    
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind - we only get exactly what you type to work with. And I have no idea at all what you mean by "BUT PDF opens under dialog".
Use the "Improve question" widget to edit your question and provide better information.
Richard MacCutchan 5-Aug-21 5:27am    
I have deleted your repost of this question. If you have additional information then please use the Improve question link below your question, and add complete details.
Member 14594285 5-Aug-21 5:28am    
ok, I hope this question is clear
Richard MacCutchan 5-Aug-21 5:31am    
I just tried that and the PDF was opened in the foreground, hiding the dialog. You need to provide more information.
Member 14594285 5-Aug-21 5:55am    
bool b = this->GetForegroundWindow(), b is true, so how I can put false setForegroundWindow? For my dialog I mean

1 solution

You can use this:

system("start \"C:\\your.pdf\"");
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900