Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

InternetDial not returning a handle

Status
Not open for further replies.

cheth

Programmer
Nov 6, 2001
16
US
Hi All,

I'm using wininet.dll to handle connecting to the internet. I use InterNetDial to dial and InterNetHangup to disconnect. If I'm in VFP6 running the program from the source code the application dials up just fine and returns a connection handle that I have to use when it's time to hangup. Works just fine..
But when I build the application exe and run it, InterNetDial just returns a zero for the connection handle. Which is an invalid handle and does not hangup...

Please, does anyone have any ideas on why the InternetDial won't return a handle when my app is compiled and does when uncompiled???
Thanks,
Chet

BTW. I tried the same thing with VB and it works fine..

This is the function I use for Dialing:
*************************************************
LPARAMETER lcDUN,lAutoDial
LOCAL liRC &&, liConn
DECLARE LONG InternetDial in "wininet.dll" ;
LONG hwndParent, ;
STRING lpszConnectoid, ;
LONG dwFlags, ;
LONG @ dwConnection, ;
LONG dwReserved

THIS.cErrorMsg = ""
lcErrMsg = SPACE(256)
liRC = 0
liConn = 0

** Hang up before dialing.
IF This.ConnHandle<>0 THEN
This.IPHangUp(This.ConnHandle)
ENDIF

*!* 0x2 in 3rd parameter for automatc dialing
*!* 0x0 is used for testing purpose
IF lAutoDial THEN
liRC = InternetDial(0 , lcDun , 0x2 , @liConn , 0)
ELSE
liRC = InternetDial(0 , lcDun , 0x0 , @liConn , 0)
ENDIF

This.ConnHandle = liConn

IF LiRC <> 0 THEN
THIS.nError = liRC
THIS.cErrorMsg = THIS.GetErrorMessage(THIS.nError,&quot;Dial-UP Connect&quot;)
* RETURN THIS.nError
RETURN THIS.cErrorMsg
ENDIF

RETURN &quot;&quot;

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top