[Lazarus] RAS -API for Win32 (and WinCE)

Tommi Prami groups.tprami at gmail.com
Fri Aug 12 08:05:13 CEST 2011


On 11.8.2011 22:47, Sven Barth wrote:
> On 11.08.2011 14:13, Sven Barth wrote:
>> 3. Regarding GPRS. I might have a solution for that, but currently I
>> don't have access to the code; you'd need to wait till this evening,
>> then I can check whether that could help you.
>
> Ok, I have found the code. Strangely though I only use it in the older 
> version of my application, but the newer one connects as well... strange.
>
> === source fragments begin ===
>
> uses
>   ConnMgr;
>
> var
>   ConInfo: TConnMgrConnectionInfo;
>   ConStatus: DWord;
> begin
>   FillChar(ConInfo, SizeOf(TConnMgrConnectionInfo), 0);
>   ConInfo.cbSize := SizeOf(TConnMgrConnectionInfo);
>   ConInfo.dwParams := CONNMGR_PARAM_GUIDDESTNET;
>   ConInfo.dwPriority := CONNMGR_PRIORITY_USERINTERACTIVE;
>   ConInfo.bExclusive := False;
>   ConInfo.guidDestNet := IID_DestNetInternet;
>
>   if ConnMgrEstablishConnection(@ConInfo, @fConHandle) <> S_OK then
>     raise Exception.Create('Error creating connection; check your 
> settings');
>
>   while True do begin
>     Application.ProcessMessages;
>     Sleep(50);
>     ConnMgrConnectionStatus(fConHandle, @ConStatus);
>
>     case ConStatus of
>       CONNMGR_STATUS_CONNECTED: begin
>         SetStatus('Connection established');
>         Break;
>       end;
>       CONNMGR_STATUS_WAITINGFORPHONE: begin
>         SetStatus('Call blocks connection');
>       end;
>       CONNMGR_STATUS_NOPATHTODESTINATION: begin
>         SetStatus('No suitable connection found');
>         raise Exception.Create('Could not find suitable connection');
>       end;
>       CONNMGR_STATUS_WAITINGFORPATH: begin
>         SetStatus('Cannot establish connection. (Bad signal?)');
>       end;
>       CONNMGR_STATUS_CONNECTIONFAILED: begin
>         SetStatus('Connection failed');
>         raise Exception.Create('Couldn''t establish connection. Try 
> again later');
>       end;
>       CONNMGR_STATUS_CONNECTIONCANCELED: begin
>         SetStatus('Connection canceled');
>         raise Exception.Create('The connection was canceled');
>       end;
>     end;
>   end;
> end;
>
> === source fragment end ===
>
> "SetStatus" was used to set the content of a status label and the 
> text's are rough translations from my German ones.
>
> Even if this shouldn't work as is it might give you the necessary 
> pointers for MSDN. And this code will work on Windows CE/Mobile only 
> (at least as far as I'm aware of).
>
> Regards,
> Sven
>
> -- 
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Thanks...

I try to explore it later...

-TP-




More information about the Lazarus mailing list