Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
COM Object (ADSI) Error Trapping?
Message
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00489229
Message ID:
00489453
Views:
8
Well, right after the "Scan" line in my code, I had
On Error *
in order to get VFP to ignore the OLE error. But what happened then was the scan kept going, so instead of the proper result of

Steve = lvl3

I got

Steve = lvl3
Steve = lvl4

I'm interested in putting this into a class with an error event, but I've never done that before. :) Could you pass me some quick info on how to do that?

Thanks.




>What doesn't work about ON ERROR? An alternative is to program this functionality into a class and have an Error event. You have to trap for OLE errors (usually 1426 - 1428).
>
>HTH.
>
>>I am having a little trouble with error trapping/handling with ADSI in my .prg.
>>
>>0. I created some dummy local user accounts.
>>1. I created 3 local groups on my NT4 box called lvl1, lvl2, lvl3 and put a user in each.
>>2. I created a .dbf called AccessMap which has a list of local groups that should be queried for membership.
>>
>>I am now scanning through AccessMap, looking for a match between my user name and the local group I belong to. I have 4 rows in the table, but only 3 local groups, so when I get to "lvl4" in my table, VFP says:
>> OLE error code 0x800708ac: Unknown COM status code.
>>What's the best way to trap this kind of OLE error? I originally did "On Error *" but that's just sloppy and doesn't work right anyway. Help?
>>
>>
>>cAccount = "Steve"
>>Select AccessMap
>>Scan
>>oGroup = GetObject("WinNT://" + "SCraft" + "/" +AllTrim(cGroupName) )
>>For Each oAcct in oGroup.Members
>>If Upper(oAcct.Name) = Upper(cAccount)
>>? oAcct.Name + " = " + cGroupName
>>EndIf
>>Next
>>EndScan
>>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform