Frage

Ich schrieb eine Anwendung, die zum Öffnen von Dateien von bestimmten Erweiterung der Lage sein wird, und teilen Sie Ihre Nutzer. Jetzt möchte ich, dass die Benutzer in der Lage sein, nur doppelt auf die Datei und haben es mit meiner Anwendung öffnen. Ich habe versucht, die „Verwenden Sie immer das ausgewählte Programm ...“ Option in den Fenstern „Öffnen mit“ Dialogfeld zu setzen, aber weiß nicht, wie Sie die Dateinamen erhalten, dass Windows auf meine Anwendung sendet. Wie dies zu tun?

Danke ...

War es hilfreich?

Lösung

The file name will be passed to your application as an argument. For example, in c#, you will get it like this:

static class Program

[STAThread]
static void Main(string[] args)
{
  if (args.Length > 0)
  {
    string filename = args[0];
  }
}

Andere Tipps

if i understand well. u need to make something like

~ Notpad test.txt

so u need to make optional argument in ur application so if it is exist than will open the file , if not open new file.

You should receive the filename in your application's startup parameters

Windows passes the filename as a startup parameter to your application. You will need to handle this in your WinMain or application entry point.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top