![]() |
WINDOWS MESSAGES zwischen zwei .net Anwendungen schicken
Hallo Leute,
ich habe eine Frage. Ich hab hier einen Source gefunden um mit Delphi 5 Windowsmessages zwischen zwei Anwendungen hin und Her zu schicken. Ich wollte das auf .net protieren klappt aber leider nicht :-( Hat da jemand ne info oder eine Idee wie ich das unter .net trotzdem lösen kann. Source im Projekt
Delphi-Quellcode:
Source im Hauptprogramm um die MSG zu verarbeiten
const
cMutexID = 'E-Mailsystem'; var Mutex : THandle; HAPPLICATION : HWND; HMAINFORM : HWND; StartParams : String; CountParams : Integer; AtomSend : Integer; begin dwMessage := RegisterWindowMessage('{93C5B2B7-CE8D-856B-857B-4CC76F35C091}'); Mutex := CreateMutex(nil, True, cMutexID); if (Mutex <> 0) and (GetLastError = 0) then begin Application.Initialize; application.title := 'con.fee E-Mailsystem'; Create_coParams; Application.CreateForm(TfrmcoDMC, frmcoDMC); Application.CreateForm(Tfrmsendmail, frmsendmail); application.showmainform := false; if not application.Terminated then Application.Run; if (Mutex <> 0) then CloseHandle(Mutex); end else begin HAPPLICATION := 0; HMAINFORM := 0; Application.Initialize; repeat HAPPLICATION := FindWindowEx(0,HAPPLICATION, 'TApplication', PChar('Testanwendnung')); until HAPPLICATION <> Application.Handle; if HAPPLICATION <> 0 then begin Windows.ShowWindow(HAPPLICATION, SW_Normal); Windows.BringWindowToTop(HAPPLICATION); Windows.SetForegroundWindow(HAPPLICATION); HMAINFORM := FindWindowEx(0,0,'Tfrmmain', nil); if (HMAINFORM <> 0) then begin StartParams := ';'; for CountParams := 1 to ParamCount do StartParams := StartParams + ';' + ParamStr(CountParams); try AtomSend := GlobalAddAtom(PChar(StartParams)); finally GlobalDeleteAtom(AtomSend); end; end; end; Halt; end; end.
Delphi-Quellcode:
Ach ja .net kennt dein DWORD ?? oder application.handle ?
procedure Tfrmsendmail.WndProc(var msg : TMessage);
var pFileName : PChar; dwLen : DWORD; SL : TStringlist; begin if msg.Msg=dwMessage then // Wenn die erhaltene Message wirklich die Message mit dem Parameter ist... begin dwLen := MAX_PATH+1; pFileName := StrAlloc(dwLen); // Speicher anfordern try GlobalGetAtomName(msg.lParam,pFileName,dwLen); // Parameter holen if pFilename = 'send' then begin end; if pos('kontochange',pFilename) > 0 then begin end; GlobalDeleteAtom(msg.lParam); // Parameter aus der Atomliste löschen finally StrDispose(pFileName); // Speicher wieder freigeben end; end else inherited WndProc(msg); // Andere Nachrichten darf jemand anderes verarbeiten end; Also ich hab auf jedenfall ein Problem den Source sauber in .net zu portieren. Danke für eure Hilfe |
Alle Zeitangaben in WEZ +1. Es ist jetzt 06:46 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