Thread View: be.comp.programming
1 messages
1 total messages
Started by Ork Snork
Sat, 12 Jun 2004 15:17
Windows ShellExecuteEx: file openen met hun default viewer
Author: Ork Snork
Date: Sat, 12 Jun 2004 15:17
Date: Sat, 12 Jun 2004 15:17
35 lines
2245 bytes
2245 bytes
Hallo,
Ik zou de onderstaande code willen gebruiken om vanuit een applicatie XML-files te openen met de
default viewer voor textfiles (de default text editor). Deze code opent echter altijd de default
editor voor XML-files, en negeert gewoon de verwijzing naar de registry key txtfile in
HKEY_CLASSES_ROOT.
Iemand een idee? Ik weet dat ik ook zelf het path naar de default text editor uit de registry kan
prullen en dan die applicatie opstarten, maar ik wou eerst de 'propere' manier proberen.
----------
SHELLEXECUTEINFO sei;
::ZeroMemory(&sei, sizeof(SHELLEXECUTEINFO));
sei.cbSize = sizeof(SHELLEXECUTEINFO);
sei.fMask = SEE_MASK_CLASSNAME|SEE_MASK_FLAG_NO_UI;
sei.lpVerb = "Edit";
sei.lpClass = "txtfile"; // Open the default editor associated with .txt files.
sei.nShow = SW_SHOWNORMAL;
sei.lpFile = filename;
sei.lpDirectory = fname.GET_DIR_PART();
::ShellExecuteEx(&sei);
if(int(sei.hInstApp) < 32)
{
// Editing did not succeed -> try the Open action
sei.fMask = 0;
sei.lpVerb = "Open";
::ShellExecuteEx(&sei);
}
----------
Alvast een enorm dankjewel voor de redder!
Ork.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads