操
操作系统
Unregistered / Unconfirmed
GUEST, unregistred user!
这个问题我搞了两天了,一直没弄明白。各位大虾帮看看毛病出在哪里?
unit unit1
interface
uses Form,...;
Type TMain=Class(TFrom)
...
procedure FormActivate(Sender: TObject);
procedure GetInfo();
procedure WndProc(var Msg: TMessage);override;
end;
var fMain:TMain;
implementation
procedure TMain.FormActivate(Sender: TObject);
begin
GetInfo();
end;
procedure TMain.WndProc(var Msg: TMessage);
begin
Inherited WndProc(Msg);
if Msg.Msg=WM_USER+1 then
begin
GetInfo();
end;
end;
procedure TMain.GetInfo();
var
ShellWindow:IShellWindows;
i,nCount: integer;
begin
ShellWindow := CoShellWindows.Create;
nCount := ShellWindow.Count;
{启动FormActivate时触发GetInfo()没问题,但每当我向fMain窗口发消息触发GetInfo()时,总会在上面一句死掉,系统弹出对话框"Project Test.exe raised exception class EOleSysError with message'消息筛选器应用程序正在使用中。'.Process stopped.Use Step or Run to continue.",谁能帮忙搞定,俺虽然现在没多少分,但俺不会忘记他/她的大恩大德的。谢谢先。}
for i := 0 to nCount - 1 do
begin
...
end;
if ShellWindow<>nil then ShellWindow:=nil;
end;
end.
unit unit1
interface
uses Form,...;
Type TMain=Class(TFrom)
...
procedure FormActivate(Sender: TObject);
procedure GetInfo();
procedure WndProc(var Msg: TMessage);override;
end;
var fMain:TMain;
implementation
procedure TMain.FormActivate(Sender: TObject);
begin
GetInfo();
end;
procedure TMain.WndProc(var Msg: TMessage);
begin
Inherited WndProc(Msg);
if Msg.Msg=WM_USER+1 then
begin
GetInfo();
end;
end;
procedure TMain.GetInfo();
var
ShellWindow:IShellWindows;
i,nCount: integer;
begin
ShellWindow := CoShellWindows.Create;
nCount := ShellWindow.Count;
{启动FormActivate时触发GetInfo()没问题,但每当我向fMain窗口发消息触发GetInfo()时,总会在上面一句死掉,系统弹出对话框"Project Test.exe raised exception class EOleSysError with message'消息筛选器应用程序正在使用中。'.Process stopped.Use Step or Run to continue.",谁能帮忙搞定,俺虽然现在没多少分,但俺不会忘记他/她的大恩大德的。谢谢先。}
for i := 0 to nCount - 1 do
begin
...
end;
if ShellWindow<>nil then ShellWindow:=nil;
end;
end.