I have spent a lot of time to understand how to make Sidebar Gadgets with DesktopX which will work correctly. First of all any temporary data as well as temporary folders must be created in the gadget destination directory like:
"C:\Users\USER NAME\AppData\Local\Microsoft\Windows Sidebar\Gadgets\GADGET NAME.gadget\"
In this case your gadgets will work correctly. As well all data will be removed automatically on gadget uninstalling.
But there is more serious problem I have found during my experiments! Imagine that you have more than one installed gadget (created with DesktopX!) in your Sidebar. If you'll try to open "Right Click" Service Menu each of DX gadget that will be out of focus will disappear from the Sidebar (i.e. they will appear under the Sidebar because of a minor bug with Z-order). However there is the easy way to solve this. You just need to add the next code lines into the script of your Main Parent object:
Function Object_OnRButtonDownEx(obj,x,y)
If obj.name <> "" Then object.ontop : object.setfocus
End Function
Function Object_OnRButtonUpEx(obj,x,y,dragged)
If obj.name <> "" Then object.ontop : object.setfocus
End Function
Hope this help you.