Have a look at ... Frank Tonn 17.Jan.03 05:33 PM Lotus Notes General 2.1.1Windows NT
... the API function "DWFBinderGetMainDocument". It should solve your problem and in general you will find very usefull information of this kind in "Lotus Workflow SDK 3.0.1 Documentation".