In fact there are .NET APIs but they are not public.
You have two options :
- change the appropriate registry key for this service (see in HKLM\System\CurrentControlSet\Services\"servicename"\Type).
- use interop to call the native WIN32 CreateService method. This should be something like this :
public extern static IntPtr CreateService(IntPtr databaseHandle, string serviceName, string displayName, int access, int serviceType, int startType, int errorControl, string binaryPath, string loadOrderGroup, IntPtr pTagId, string dependencies, string servicesStartName, string password);
you should pass the numerical value of "interactive process" for the serviceType parameter.
I need to import functions frol UxTheme.dll, Windows XP's visual styles dll. Several of the functions have const parameters, and C# does not allow the use of the const keyword in function parameter definitions. I'm wondering if anyone knows how to import a function with constant parameters into a C# class.
public static extern int DrawThemeBackgroundEx(IntPtr hTheme, IntPtr hdc, int iPartId, int iStateId, const IntPtr pRect, const IntPtr pOptions);
I *think* your problem is that you are doing the drawing on the load event which actually occurs before the form is displayed.
Try taking the stuff in the draw event and putting it in the paint event instead and see if that works.
First I like to say I appreciate your attempt to help, however, please read a post and understand it before you reply.
Okay I will try to state this again. As I said, I understand how to access functions from a DLL. Which is what you just provided an example for.
What I asked for in the post, and what is also stated in the subject is how to access CLASSES from a NON-COM DLL. That would be a DLL that is not a COM library. That would be C++ classes, not C classes which are really just a struct.
If you know how to do this or have a link to a tutorial or sample code great that would be appreciated. How to access just global functions from a DLL is not needed.
Coding is a way of life. It's in the air we breath. It pumps through our veines. Without it we soon crumble to dust. - Rodney S. Foley
Last Visit: 31-Dec-99 19:00 Last Update: 3-Dec-22 16:03