Does anyone have an example of using the RASDial or RASApi32.DLL with C#? I am looking to be able to create a VPN connection programatically from within an automation application. I need to be able to establish a VPN connection nightly and download a file from a server. I have found a VB6 example of using RASApi32.DLL and launching the DUN for the VPN configuration, but would rather work with C#.
I am trying to use this WMI class (correct term) to extract a list of users and the groups they are members of. Not completely sure how to do this, the ManagementObject returns two fields called Name, one the user name and one the group name, and when I try to print out both my app throws an exception.
Gumnaam wrote: Form abc = new Form(params)
The following works for me:
publicclass nick : System.Windows.Forms.Form
publicstaticvoid Main(string args)
test t= new test();
nick n = new nick();
I am writing a DLL in VC++ that needs to be called by one of our customers who use C#.
Unlike my VC++ test application, which statically links the DLL to the EXE and creates the object upon startup, the C# application appears to load the DLL at runtime at the first reference to a DLL call (using the import keyword).
THe problem is that subsequent calls to other functions do not work. It seems that there needs to be some pause for the load to happen.
Ed Hopkins wrote: THe problem is that subsequent calls to other functions do not work. It seems that there needs to be some pause for the load to happen.
Does the first function call always work? Have you tried calling different functions the first time to see if there is a problem? If your dll that you are writing in C++ is based on COM I would hightly recommend you read through information on Runtime Callable Wrappers[^] on MSDN.
It's not quite that simple ... it works A-OK from the VC++ demo app. It's NOT written in COM just a standard Win32 MFC DLL written in VC++.
The timing appears to be due to the finite # of milliseconds it takes for the DLL objects to get created. They are not ready yet, and a subsequent call returns an error since it is pointing to things that are not yet created. Quite strange.
Hmm, seems to me I've heard MFC doesn't
play nice with other frameworks. And
.NET is a framework. I've run into some
strangeness with MFC. I remember I was
experimenting with forms in DLLs and had
one done in Delphi that I launched from
a VC++ 6.0 MFC app using a worker thread.
No matter what I did when I closed the
DLL form, I got an exception. However
if I displayed a messagebox in the VC++
app after closing the form, I never got
an error. I chalked it up to Delphi
having a VCL and MFC not being at the
root of all the GUI stuff, but who knows?
Of course the Delphi DLL form worked fine
with every other app I used to launch it,
such as Delphi and VB 6.0. Go figure.
Well if implemented correctly MFC is capable of being accessed by other types of compilers ... that in itself is not the issue. The issue is that the way that C# loads DLL's is a bit strange coming from C++ ... I suspect VB does it the same way, I've developed a hacky workaround but it would be nice to know from a real C# expert why this is happening. In fact, forget I even mentioned MFC if you do it with a Win32 (or a Delphi) DLL it will load the same way. I did a little Delphi work myself at one point.
eggie5 wrote: I want to use org.xml.sax mosty... Are they stored in DLLs???
You want to use the SAX parser? Take a look at what is provided in the .NET Framework, there is all kinds of classes that provide XML support. Are you looking for some interop between Java and .NET? Look in the System.Xml namespace (System.Xml.dll).
searched around but couldn't find anything. Almost unbelievable. I think these must be common questions. I'd like to display the files in a given folder within a ListView. Various don't-knows:
1. How to I retrieve the associated icon for a given file?
2. How do I retrieve the file type (on my german OS, the win-explorer writes "Microsoft Word-Dokument" when selecting 'bla.doc'.)
3. How do I launch the file in it's associated application. I know I can start any application using Process.Start(). But is that the way of doing it properly (by attaching the documents file name as a commandline parameter?)
Just need a starting point.
Thanks a ton!
If eell I ,nust draw to your atenttion to het fakt that I can splel perfrectly well - i;ts my typeying that sukcs.