• Delphi 窗口消息


    function TCmdEbookMin.Execute: string;
    //  var
    //  hHandle           : HWND;
    begin
      //hHandle := Application.MainForm.Handle;
      //PostMessage(hHandle, WM_SYSCOMMAND, SC_MINIMIZE, 0);
      Application.Minimize;
    end;


    case Message.msg of
        WM_COPYDATA:
          begin
            str := StrPas(PChar(PCopyDataStruct(Message.lparam)^.lpData));
            outputArgs := SplitString(str, '|');
            if outputArgs.Count > 0 then
            begin
              if outputArgs[0] = 'getres' then
    
                DownloadCallback(str)
              else if outputArgs[0] = 'uploadres' then
                UploadCallback(str);
    
              if outputArgs.Count <> 2 then
              begin
                Exit;
              end;
    
              if outputArgs[0] = 'videocap' then
              begin
                if (outputArgs[0] = 'videocap') and (outputArgs[1] = 'nocamera') then
                begin
                  ShowMessage('没有检测到拍照设备!');
                  Exit;
                end;
    
                data := outputArgs[1];
                VideoCapCallback(data);
              end;
            end;
    
            outputArgs.Free;
          end;
      end;
      inherited;

    var
      SL                : TStringList;
      msg               : string;
      head              : string;
      msglen            : Integer;
      hAgent            : HWND;
      ds                : TCopyDataStruct;
    begin
      if combobox_Cams.Items[0] = 'NoCamera' then
      begin
        head := 'videocap|';
        msg := head + 'nocamera';
        msglen := Length(msg);
        // IflybooFrom发送窗口消息
        hAgent := FindWindow('TiflyBookForm', nil);
    
        if hAgent <> 0 then
        begin
          ds.dwData := 0;
          ds.cbData := msglen * 2 + 2;
          ds.lpData := PChar(msg);
          SendMessage(hAgent, WM_COPYDATA, 0, Cardinal(@ds));
        end;
    
        Self.Close;
        VideoImage.VideoStop;
        Exit;
      end;


  • 相关阅读:
    Delphi编写星光效果
    网格动画
    在窗体边框上画图
    algebra单元
    CMOS单元
    类似于Split(VB)的函数
    利用PHPLIB加入模板功能
    随机产生一个中文
    测试PHP
    获得指定后缀名的文件数
  • 原文地址:https://www.cnblogs.com/wjchang/p/3671511.html
Copyright © 2020-2023  润新知