Archive: Usint Active Desktop Instances in NSIS


Usint Active Desktop Instances in NSIS
Maybe someone can help me with this. In my installer, I need to use the Remote API to communicate with a Windows CE device. To do this I need to create some class instances for the remote API. There is some sample code for creating and using class instances on the NSIS wiki. I have some questions about this code. The code is given below:

!define CLSCTX_INPROC_SERVER 1
!define CLSID_ActiveDesktop {75048700-EF1F-11D0-9888-006097DEACF9}
!define IID_IActiveDesktop {F490EB00-1240-11D1-9888-006097DEACF9}
# create IActiveDesktop interface
System::Call "ole32::CoCreateInstance( \
g '${CLSID_ActiveDesktop}', p 0, \
i ${CLSCTX_INPROC_SERVER}, \
g '${IID_IActiveDesktop}', *p .r0) i.r1"
StrCmp $1 0 0 end
# call IActiveDesktop->GetWallpaper
System::Call "$0->4(w .r2, i ${NSIS_MAX_STRLEN}, i 0)"
# call IActiveDesktop->Release
System::Call "$0->2()"


The first question that I have is where do the GUIDs CLSID_ActiveDesktop and IID_IActiveDesktop come from?

The second question that I have is how to determine the methods in an active desktop instance. The methods of the active desktop are being referenced by numbers. How does one know what number is associated with what method?

If I know the answers to these questions I will be able to use the RAPI2 interfaces for my install program.

If anyone knows the answer to these questions a reply would be greatly appreciated.

Thanks,

Chris Lustig


The class id is defined in the same library that defines e.g. ActiveDesktop/IActiveDesktop in shlobj.h/shell32.dll. As for the numbers, those are the methods in their order. Release is #2 because it is the 2nd method in IUnknown (which IActiveDesktop inherits). GetWallpaper is #4 because it is the 2nd method in IActiveDesktop.

Edit: MSDN is your friend :)

Stu