您的位置:首页 > 编程语言 > Delphi

Delphi 窗口消息

2013-09-25 10:34 190 查看
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;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: