dllimport

  • Thread starter Thread starter UJ
  • Start date Start date
U

UJ

I've found code on the net to register a service using C# code. It works
great. Problem is I'd like it in VB.Net and I can get it all to compile,
it's just that I'm having problems that it can't find the dll correctly.
Could somebody look at this and tell me what I need to do to make it work
under vb.net?

TIA - Jeff.

[DllImport("advapi32.dll")]
public static extern IntPtr OpenSCManager(string lpMachineName,string
lpSCDB, int scParameter);
 
UJ said:
I've found code on the net to register a service using C# code. It works
great. Problem is I'd like it in VB.Net and I can get it all to compile,
it's just that I'm having problems that it can't find the dll correctly.
Could somebody look at this and tell me what I need to do to make it work
under vb.net?

[DllImport("advapi32.dll")]
public static extern IntPtr OpenSCManager(string lpMachineName,string
lpSCDB, int scParameter);

\\\
Public Declare Auto Function OpenSCManager Lib "advapi32.dll" ( _
ByVal lpMachineName As String, _
ByVal lpDatabaseName As String, _
ByVal swDesiredAccess As Int32 _
) As IntPtr
///
 
That worked great! Thanks for the help.


Herfried K. Wagner said:
UJ said:
I've found code on the net to register a service using C# code. It works
great. Problem is I'd like it in VB.Net and I can get it all to compile,
it's just that I'm having problems that it can't find the dll correctly.
Could somebody look at this and tell me what I need to do to make it work
under vb.net?

[DllImport("advapi32.dll")]
public static extern IntPtr OpenSCManager(string lpMachineName,string
lpSCDB, int scParameter);

\\\
Public Declare Auto Function OpenSCManager Lib "advapi32.dll" ( _
ByVal lpMachineName As String, _
ByVal lpDatabaseName As String, _
ByVal swDesiredAccess As Int32 _
) As IntPtr
///
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top