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?
obruchezAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ohellCommented:
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.
0
obruchezAuthor Commented:
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.

0
msmitsCommented:
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.

0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

obruchezAuthor Commented:
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.

0
md041797Commented:
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...

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

0
msmitsCommented:
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.
0
md041797Commented:
I agree with msmits.
0
obruchezAuthor Commented:
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...

0
chensuCommented:
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.
0
msmitsCommented:
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.

0
brothers091097Commented:
#include "ras.h"

/* include rasapi32.lib in your project*/


void My_Dial_Func()
 {
  struct RASDIALDLG myStruct;
  BOOL result;

  myStruct.dwSize=sizeof(RASDIALDLG); /* very important */
  myStruct.hwndOwner=NULL;
  result=RasDialDlg(NULL,"your_internet_connexion_name",NULL,&myStruct);      
  ....
 }


if you want more information send me a mail brother@worldnet.net

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
chensuCommented:
It seems that RasDialDlg is supported only in Windows NT.
0
brothers091097Commented:
huppppssssssss,sorry!!!!!!!!!!!!!
For win95 try:

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



0
msmitsCommented:
Shouldn't that be rundll32?
0
obruchezAuthor Commented:
brothers, it seems to work fine! Thanks!

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

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.