Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

OLEObject error

119 views
Skip to first unread message

leonardorodriguesleorj79athotmaildotcom

unread,
Apr 30, 2008, 11:24:24 AM4/30/08
to
The functionality from the code below has been working for 2
years with no complaints. Recently, a customer has gotten
the following error:

"Error calling external object function eval at line 25 in
function f_terminate_process_taskmgr of object
f_terminate_process_taskmgr"

The function is meant to forcibly 'close' the application.
Here's the code and line 25 is marked.

***BEGING FUNCTION***

mssc = CREATE OleObject
li_rc =
mssc.ConnectToNewObject("MSScriptControl.ScriptControl")
mssc.language = "VBScript"

ls_code = "function killlas() ~r~n" + &
"Set locator =
CreateObject(~"WbemScripting.SWbemLocator~")~r~n" + &
"Set service = locator.ConnectServer()~r~n" + &
"Set props = service.ExecQuery" + &
"(~"select name, description from Win32_Process where
name = '"+st_app_name+".exe'~")~r~n" + &
"num = props.count~r~n" + &
"for each notepad in props~r~n " + &
" notepad.terminate ~r~n " + &
"next~r~n" + &
"killlas = num~r~n" + &
"end function"
mssc.AddCode(ls_code)
i = mssc.Eval("killlas()") //LINE 25 !
mssc.DisconnectObject()
DESTROY mssc

***END FUNCTION***

How can this work for some machines and not others? How are
OLE objects linked to OS libraries/settings?

Any ideas?

Thanks,

-Leo

Chris Pollach

unread,
Apr 30, 2008, 11:51:34 AM4/30/08
to
Hi Leo;

1) Do you know if the machine in error has a different version of
MS-Windows (ie Service pack) installed?
2) Did you create your own OLE ancestor (user Object) and try to handle any
errors?
3) Have you thought about wrapping this code up in a TRY .. Catch?

Regards ... Chris

<Leonardo Rodrigues leorj79 at hot mail dot com> wrote in message
news:48188f28.90...@sybase.com...

leonardorodriguesleorj79athotmaildotcom

unread,
Apr 30, 2008, 12:29:28 PM4/30/08
to
Hi Chris,

1) Do you know if the machine in error has a different
version of MS-Windows (ie Service pack) installed?

Information from customer indicates the following:
10 machines total:
1 Windows 2003 Server - does not work
5 XP Pro SP2 - does not work
4 XP Pro SP2 - works

2) Did you create your own OLE ancestor (user Object) and
try to handle any errors?

No, this function was there before me and it is the only
function in the code that uses the OLEObject this way.

3) Have you thought about wrapping this code up in a TRY
.. Catch?

It seems like this would be a good idea and it would help
us debug. However, we cannot reproduce the issue in-house
and to obtain access to the customer's machines would not be
an expeditious task.

I forgot to mention that I am using PB 10.2.1 build 9004

I have read comments online suggesting that certain OLE
files such as ole2nls.dll can be somehow 'disabled'. Would
this be a possibility? if so, do we have any idea on how to
accomplish this?

Thanks,

-Leo

Chris Pollach

unread,
Apr 30, 2008, 1:02:28 PM4/30/08
to

FWIW: I would take a few minutes to create a Standard User Object inherited
from the OLEObject ancestor and use that in the CREATE statement. Then you
can code the "Error" and "ExternalException" events to handle these
scenarios better.

Is the "ole2nls.dll" file on the machines that fail?


<Leonardo Rodrigues leorj79 at hot mail dot com> wrote in message

news:48189e68.ab...@sybase.com...

leonardorodriguesleorj79athotmaildotcom

unread,
Apr 30, 2008, 2:34:26 PM4/30/08
to
Chris,

The User Object idea is definitely worth it.

Regarding the ole2nls.dll:

I am trying to find out what all files are linked to the
usage of OLE objects and there are quite a few in the
system32 folder, including ole2nls.dll.

I have renamed them (including ole2nls.dll) to attempt to
break the application and reproduce the error without
success. So, are those files needed or not?

I'll keep researching,

-Leo

0 new messages