Pripojenie na internet
Pripojenie na internet.
uses WinInet; { INTERNET_AUTODIAL_FORCE_ONLINE -> Forces an online connection. INTERNET_AUTODIAL_FORCE_UNATTENDED -> Forces an unattended Internet dial-up. If user intervention is required, the function will fail. INTERNET_DIAL_FORCE_PROMPT -> Ignores the "dial automatically" setting and forces the dialing user interface to be displayed. INTERNET_DIAL_UNATTENDED -> Connects to the Internet through a modem, without displaying a user interface, if possible. Otherwise, the function will wait for user input. INTERNET_DIAL_SHOW_OFFLINE -> Shows the Work Offline button instead of Cancel button in the dialing user interface. } function DialDFUE(DFUEName : String; var ErrorCode : integer; var ConId : DWord) : boolean; var ConNum : LPDWORD; ReturnCode : DWord; begin result := false; ErrorCode := 0; New(ConNum); try ReturnCode := InternetDial(Application.Handle , PChar(DFUEName), INTERNET_AUTODIAL_FORCE_UNATTENDED, ConNum, 0); {Returns ERROR_SUCCESS if successful, or an error value otherwise. The error code can be one of the following: ERROR_INVALID_PARAMETER One or more of the parameters are incorrect. ERROR_NO_CONNECTION There is a problem with the dial-up connection. ERROR_USER_DISCONNECTION The user clicked either the Work Offline or Cancel button on the Internet connection dialog box.} ErrorCode := ReturnCode; if ReturnCode = ERROR_SUCCESS then begin result := true; ConId := ConNum^; end; finally Dispose(ConNum); end; end; procedure TForm1.Button1Click(Sender: TObject); var Err: integer; ConId: DWord; begin DialDFUE('Kiwwi', Err, ConId); //Disconnect: //InternetHangUp(ConId, 0); end;