以下代码在Form Application没有任何问题,但是作为服务的DLL代码内运行就出现错误,而且GetLastError返回0initialization
CoInitialize(nil);
finalization
CoUninitialize;
end.这个代码也添加了,还是不行,只能让各位大侠看看了function IEIsOpened: Boolean;
var
ShellWindow: IShellWindows;
nCount: integer;
spDisp: IDispatch;
i: integer;
vi: OleVariant;
IE1: IWebBrowser2;
begin
ShellWindow := CoShellWindows.Create;
nCount := ShellWindow.Count;
for i := 0 to nCount - 1 do
begin
vi := i;
try
spDisp := ShellWindow.Item(vi);
except
end;
if (spDisp <> nil) then
begin
try
spDisp.QueryInterface(iWebBrowser2, IE1);
except
end;
if (IE1 <> nil) then
begin
Result := IE1.LocationURL =‘http://www.baidu.com/;
Exit;
end;
end;
end; Result := false;end;
CoInitialize(nil);
finalization
CoUninitialize;
end.这个代码也添加了,还是不行,只能让各位大侠看看了function IEIsOpened: Boolean;
var
ShellWindow: IShellWindows;
nCount: integer;
spDisp: IDispatch;
i: integer;
vi: OleVariant;
IE1: IWebBrowser2;
begin
ShellWindow := CoShellWindows.Create;
nCount := ShellWindow.Count;
for i := 0 to nCount - 1 do
begin
vi := i;
try
spDisp := ShellWindow.Item(vi);
except
end;
if (spDisp <> nil) then
begin
try
spDisp.QueryInterface(iWebBrowser2, IE1);
except
end;
if (IE1 <> nil) then
begin
Result := IE1.LocationURL =‘http://www.baidu.com/;
Exit;
end;
end;
end; Result := false;end;
解决方案 »
- 怎样得到要删除记录的ID
- 当Adoquery的connectionstring的测试链接成功,sql语句可以在查询分析器执行成功时,为什么程序在执行这行代码adoquery1.execsql;时停滞2
- 如何在RAVE报表中设置转换人民币大写?已有大写代码
- *********简单问题 如何在程序里模拟实现ctrl+v************
- DELPHI如何获取EXCEL当前光标所在的行和列值
- 如何将一个文件分成几块拷贝,然后用ProgressBar1 显示拷贝过程?
- 我的毕业设计,怎么办?
- 用ADO连接Oracle问题(TADOTable)
- talbe 的记录数怎么获取啊?
- delphi与数据库
- 请帮我解决无DLL注入问题
- delphi2009的数据类型转换和Deiphi以前版本的有什么差异?比如PChar
要么加 shareMem单元试试...
那会不会是服务运行的“交互桌面”的问题:是与普通的用户登录后的交互桌面有一些不同的
initialization
if IsLibrary then
CoInitialize(nil);finalization
if IsLibrary then
CoUninitialize();==========================
Result := IE1.LocationURL =‘http://www.baidu.com/;
????这啥能编译通过?========================
另外,先做调试知道哪里错误再说吧,
写程序报错谁没碰过,人家写驱动还蓝屏呢,自己不调一下就想让人解决,别人有啥兴趣帮你调。