AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Win32/Win64 API (native code) Delphi Programm in Kontextmenü eintragen
Thema durchsuchen
Ansicht
Themen-Optionen

Programm in Kontextmenü eintragen

Ein Thema von -=IOI=- · begonnen am 15. Aug 2005 · letzter Beitrag vom 19. Aug 2005
 
-=IOI=-

Registriert seit: 5. Mär 2005
54 Beiträge
 
#5

Re: Programm in Kontextmenü eintragen

  Alt 18. Aug 2005, 18:23
so dieses problem konnte ich nun lösen un hab sogar winamp wieder installieren können.

leider hören die probleme damit nicht auf, sondern scheinen erst richtig loszugehen.

also den parameter übergeb ich meinem prog mit diesem registrywert: "D:\Desktop\Desktop.exe""%1"

mein programmcode sieht so aus:

Delphi-Quellcode:
var
   ExtendedStyle : Integer;
   dwMutex : DWORD;
   hWindow : DWORD;
   cdWork : TcsCopyDataStruct;

begin
  dwMessage := RegisterWindowMessage('{0F08433D-ADFB-4918-AE2D-8839BAC93392}');
  dwMutex := CreateMutex(nil,true,'Desktop');
  try
    if GetLastError <> ERROR_ALREADY_EXISTS then
    begin
      Form16 := TForm16.Create(Application);
      try
        ExtendedStyle := GetWindowLong(Application.Handle, GWL_EXSTYLE);
        SetWindowLong(Application.Handle, GWL_EXSTYLE, ExtendedStyle OR WS_EX_TOOLWINDOW
                                                    AND NOT WS_EX_APPWINDOW);

        Form16.Show;
        Form16.Refresh;

        Application.Initialize;
        Application.Title := 'Desktop';
        Application.CreateForm(TForm1, Form1);
        Application.CreateForm(TForm2, Form2);
        Application.CreateForm(TForm3, Form3);
        Application.CreateForm(TForm4, Form4);
      finally
        Form16.InitializationDone := True;
      end;
      Application.Run;
    end
    else
    begin
      hWindow := FindWindow(nil,'Desktop');
      if hWindow <> 0 then
      begin
        if (paramcount > 0) and FileExists(paramstr(1)) then
        begin
          cdWork.dwData := dwMessage;
          cdWork.cbData := Length(paramstr(1))+1;
          cdWork.lpData := AllocMem(cdWork.cbData);
          try
            CopyMemory(cdWork.lpData,@paramstr(1)[1],cdWork.cbData-1);
            SendMessage(hWindow,WM_COPYDATA,0,lParam(@cdWork));
          finally
            FreeMem(cdWork.lpData,cdWork.cbData);
          end;
        end;
      end;
    end;
    finally
    if dwMutex <> 0 then
    begin
      CloseHandle(dwMutex);
    end;
  end;
end.
(habe noch einen splash screen eingebaut)

und der code in meiner main unit sieht wie folgt aus:

Delphi-Quellcode:
procedure TForm1.WndProc(var msg : TMessage);
var
  cdWork : PcsCopyDataStruct;
  sec, min: Integer;
  s1, s2, result: String;
begin
  if msg.Msg = WM_COPYDATA then
  begin
    cdWork := PcsCopyDataStruct(msg.lParam);
    if cdWork.dwData = dwMessage then
    begin
      ListBox2.Items.Add(PChar(cdWork.lpData));
      ListBox5.Items.Add(ExtractFileName(PChar(cdWork.lpData)));
      ListBox7.Items.Add(IntToStr(Form1.ListBox5.Count));
      if MPEGaudio.ReadFromFile(PChar(cdWork.lpData)) then
        if MPEGaudio.Valid then
        begin
          sec := round(MPEGaudio.Duration);
          min := sec div 60;
          sec := (sec - min * 60);
          if min >9 then s1 := intToStr(min)
          else s1 := intToStr(min);
          if sec >9 then s2 := intToStr(sec)
          else s2 := '0' + intToStr(sec);
          result := S1 + ':' + S2;
          ListBox8.Items.Add(''+result+'');
        end;
      Sort(ListBox5, ListBox8, ListBox2);
      HorScrollBar(ListBox5, 68);
      HorScrollBar(ListBox7, 18);
      HorScrollBar(ListBox8, 29);
      ShowScrollBar(ListBox5.Handle, SB_VERT, FALSE);
      ShowScrollBar(ListBox7.Handle, SB_VERT, FALSE);
    end;
  end
  else
  begin
    inherited WndProc(msg);
  end;
end;
fehlermeldungen bringt er keine, aber in die listboxen wird auch nichts eingetragen.

danke für eure hilfe

Flo
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 20:14 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz