Einzelnen Beitrag anzeigen

venice2
(Gast)

n/a Beiträge
 
#7

AW: Probleme beim Empfangen mittels WM_COPYDATA

  Alt 5. Feb 2022, 21:31
Hmmm..

Delphi-Quellcode:
var
  gCDS: COPYDATASTRUCT;
  gSOP: TSOP64; // my Record
const
  dwData_GetPluginName = 6;
64 Bit Anwendung..
Delphi-Quellcode:
function GetPluginDescription(WindowHandle: HWND): string;
begin
  SetLength(Result, SendMessage(WindowHandle, WM_GETTEXTLENGTH, 0, 0));
  if Result <> 'then
    SendMessage(WindowHandle, WM_GETTEXT, Length(Result) + 1, LPARAM(PWideChar(Result)));
end;

procedure SOP_GetPluginName;
begin

  if (gp.hSOPlugin <> 0) then
  begin
    gCDS.dwData := dwData_GetPluginName;
    gCDS.cbData := SizeOf(gSOP);
    gCDS.lpData := @gSOP;
    SendMessage(gp.hSOPlugin, WM_COPYDATA, WPARAM(gP.MainHandle), LPARAM(@gCDS));
  end;

  Description := GetPluginDescription(gP.MainHandle);
end;
32 Bit Anwendung..
Delphi-Quellcode:
function GetPluginName(handle: HVIS): PWideChar; stdcall;
begin

  Result := '';
  if handle <> 0 then
  begin
    Result := PWideChar(WideString(VisInfo^.VisPointer^.PluginName));
  end;
end;
Delphi-Quellcode:
var
  pCDS: PCopyDataStruct;
Delphi-Quellcode:
    WM_COPYDATA:
      begin
        pCDS := Pointer(lP); // LP pointer auf die CopyDataStruct
        case pCDS.dwData of

          dwData_GetPluginName:
            begin
              PluginName := GetPluginName(VisHandle);
              StrPCopy(aTemp, string(PluginName));
              SendMessage(wp, WM_SETTEXT, SizeOf(aTemp), LPARAM(@aTemp));
            end;
        end;
Nur als Denkanstoß.

Geändert von venice2 ( 5. Feb 2022 um 21:46 Uhr)
  Mit Zitat antworten Zitat