Qt how to check if openUrl() is already open ? in windows
-
in Qt app im opening chm help file using this function :
@void ToolBar::OpenHelp() { QDesktopService::openUrl(QUrl("my_help_file.chm")) ; }@
the problem is when i click it i want it to open only one instance of my_help_file.chm
now i can open how many instances i click the open button.
can if somehow done? -
You can enumerate processes and look for window title, there should be your filename.
Or maybe better way: Use QProcess and start chm reader with your file as argument. When user closes chm reader you will be signaled from your QProcess about that.... -
Thanks ! i will try with the process ,
can you give me hint on how i can enumerate processes , if the QProcess will not work
thanks! -
My mistake, I mean enumerate all windows and check titles. It can be done with WINAPI http://msdn.microsoft.com/en-us/library/windows/desktop/ms633497(v=vs.85).aspx function. click on EnumWindowsProc link on the page to see example.