+void MyFrame::OnShowCommandForExt(wxCommandEvent& WXUNUSED(event))
+{
+ static wxString s_ext;
+
+ wxString ext = wxGetTextFromUser
+ (
+ "Enter the extension without leading dot",
+ "Exec sample",
+ s_ext,
+ this
+ );
+ if ( ext.empty() )
+ return;
+
+ s_ext = ext;
+
+ wxScopedPtr<wxFileType>
+ ft(wxTheMimeTypesManager->GetFileTypeFromExtension(ext));
+ if ( !ft )
+ {
+ wxLogError("Information for extension \"%s\" not found", ext);
+ return;
+ }
+
+ const wxString cmd = ft->GetOpenCommand("file." + ext);
+ if ( cmd.empty() )
+ {
+ wxLogWarning("Open command for extension \"%s\" not defined.", ext);
+ return;
+ }
+
+ wxLogMessage("Open command for files of extension \"%s\" is\n%s",
+ ext, cmd);
+}
+