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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

InternetDial in Threads

Status
Not open for further replies.

Slippie

Programmer
Jan 17, 2006
6
0
0
ZA
I have the problem that if I use InternetDial with the mainform as Parent handle it stops the program in order to do the dial.

What I want to do is use a thread as its parent handle so that I can still access the rest of the program and it dials in the background.

I tried the following:

Code:
InternetDial((PParent as TCommThread).Handle, PChar('MWeb'), INTERNET_AUTODIAL_FORCE_UNATTENDED, @ConnectionID, 0);

It gives an error saying Invalid class typecast.

Any suggestions?
 
Try this:

var
HW : THandle;
begin
HW := ((PParent as TCommThread).Handle;
InternetDial(HW, PChar(...), ..., @..., 0);
end;

If the error moves to the line HW := ... check what you are triyng to do with your typecasting.

BTW, InternetDial requires an HWND handle; if (PParent as TCommThread) resolves to a TThread descendent, the handle you are getting is a thread handle, not a window handle.

Anyway, the Internet functions are a real mess, bad documented and poorly written. Better use the RAS directly to make the connection.

buho (A).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top