Link to home
Start Free TrialLog in
Avatar of obruchez
obruchez

asked on

Using Rnaapp.exe in Visual C++ 4.0

I use Visual C++ 4.0 under Windows 95 and I need to launch an Internet connexion from one of my program. I know that I have to use the RNAAPP.EXE executable, in the SYSTEM directory. I also know that I have to use the "-l" command line. But what I don't know is how I can specifiy the Internet provider (or connexion) I will use. It seems that it's not specified neither in the command line nor in a file on the hard drive. So what does I have to do? Do you know another way to launch an Internet connexion? But I don't want to deal with the functions from the <ras.h> file. I just want to make the standard dialog box appear. What's the simplest solution to do that?
Avatar of ohell
ohell

MFC provides classes CInternetConnection and CInternetSession which would simplify what you want to achieve.

First you create a CInternetSession object with the values appropriate to your app and then use OpenURL() method to open a URL and when this is successfully done, you can call one of GetGopherConnection(), GetHttpConnection() or GetFTPConnection()
to have an object of type CInternetConnection.

I don't think the dialog box ia available as a common dialog box,  so I guess you can just create a copy of your own and get various options for the CInternetSession from there. This is pretty simple to do. Just read up the documentation on CInternetSession.
Avatar of obruchez

ASKER

I'm sorry, but I can't find anything about CInternetSession. I have Visual C++ version 4.0. It's perhaps an old version.

Anyway, I just want to launch a connection with the standard dialog box. I don't need anything else. I think that to use Rnaapp.exe is the best way to do that.

Upgrade to a newer version or just use the C API for the RAS functionality. The function you want to look at is RasDial and should be in the win32 API help documentation. The file to include is ras.h.

I've already used the RasDial function. I know that I can use it. But I don't want to. I just want to use Rnaapp.exe. That shouldn't be too difficult, I think. The only problem is that I don't know how to specify to this application which connection I want to use.

Use a spoof.

Write a program that prints out the command arguments.  Temporarily rename rnaapp.exe.  Install your new rnaapp.exe and run a program that uses this exe.  When your new rnaapp program executes, you will have your command line.

Pretty sneaky huh...

That's exactly what I've done. The command line is "-l". Nothing else. That's why I'm here... ;-)

The thing is that rnaapp is some kind of internal program that is not intended for the users to call directly. It is called under water by the RAS functions and communication goes probably via some kind of undocumented OLE interface or something. I checked the registry and it is not registered as some kind of server.
You have to use the microsoft published interface RasDial(). When for example MS decides to call the program rna_super.exe in the next release, all your code breaks, while you can assume that the published interface stays some kind of stable.

I cannot see any reason for you to directly communicate with rnaapp and not via RasDial.
I agree with msmits.
Actually, Rnaapp.exe calls the RAS functions, not the contrary.

Anyway, it doesn't matter, since you all think that I shouldn't deal with that program.

But let me explain what I would like to do (I should have done that before...). I want my program to be called each time a user wants to begin an Internet connection, just before the standard dialog box appears. So I thought that I could have changed "Rnaapp.exe" to "Rnapp_.exe" (for instance) and called my program "Rnaapp.exe".

Now I think it could be done differently. I know it is possible to create a shortcut from a RAS Connection with the standard Windows 95 explorer. Then it is possible to "lauch" this shortcut from the DOS shell, for instance. So if I could "launch" a shortcut from my program, my problem would be solved. But it can't be done with functions such as CreateProcess or WinExec. How can I do it?

There _must_ be a simple solution to my problem. Or maybe not...

I am interested in this question because I also wanted to invoke Rnaapp.exe. But I have not found any way but using RAS functions. In order to launch a shortcut, use ShellExecute() function.
I have the reverse problem. I want to get rid of rnaapp.exe when I am finished with DUN.
I have written an installer for DUN, TCP/IP and creation of a DUN entry in the phonebook and see that the rnaapp.exe is still running at the end. When this happens, the self-extractor doesn't detect the end of my own program (or children) and doesn't cleanup the extracted files. I now have a workaround that walks the process list and kills rnaapp.exe.

ASKER CERTIFIED SOLUTION
Avatar of brothers091097
brothers091097

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
It seems that RasDialDlg is supported only in Windows NT.
huppppssssssss,sorry!!!!!!!!!!!!!
For win95 try:

strcpy(cmd,"rundll rnaui.dll,RnaDial ");
strcat(cmd,"your_connection_name");
WinExec(cmd,SW_SHOWNORMAL);



Shouldn't that be rundll32?
brothers, it seems to work fine! Thanks!

Also, I would like to thank msmits, ohell, chensu and md for their help!