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
Nishant S wrote: I seriously doubt if you can access native C++ classes from a C# program.
Nope, you can't. The problem is that each vendor compiles its C++ code differently, which is the main reason why COM was created (so that a binary standard existed for sharing OOP code without having to produce a version for every compiler version in existance)
As you said the best option is to use an MC++ wrapper for the native class.
I have been only a few hours on C# and I am loving it.
I have created a program that downloads a web page, and i am trying to extract the keywords meta tag. I tried using the MSHTML stuff, but it was sooo slow! I figured that I will parse the meta keyword thing myself, thats when i discovered "regular expressions".
I have managed to the keywords from this kind of string:
However, the same pattern will not work on
(content and name are switched).
How cuold i make my query not care where CONTENT and NAME are located, as long as they ARE present in the string?