----- Original Message -----

> From: ""Jürgen Hestermann"" <juergen.hesterm...@gmx.de>
> To: fpc-pascal@lists.freepascal.org
> Cc: 
> Sent: Tuesday, November 29, 2011 11:56 AM
> Subject: [fpc-pascal] Wireless configuration in Windows
> 
> I am trying to access the Wireless interface of the Windows API. It seems 
> that 
> there is no support for these functions in Free Pascal so I defined them 
> myself 
> and accessed them via "Loadlibrary". But WlanOpenHandle always results 
> in error 87 (invalid parameter). I defined:
> 
> -----------------------------------------------------------------------
> type WlanOpenHandleTyp = function(ClientVersion : DWord;
>                                   Reserved : Pointer;
>                               var NegotiatedVersion : DWord;
>                               var ClientHandle : Hwnd) : DWord;
> -----------------------------------------------------------------------
> 
> but also tried a different definitions of the first two parameters with CONST.
> 
> I then coded:
> 
> -----------------------------------------------------------------------
> Var LibHandle       : THandle;
>     H               : Hwnd;
>     WlanOpenHandle  : WlanOpenHandleTyp;
> 
> begin
> LibHandle := Windows.LoadLibrary('wlanapi.dll');
> if LibHandle<>0 then
>    begin
>    WlanOpenHandle := 
> WlanOpenHandleTyp(GetProcAddress(LibHandle,'WlanOpenHandle'));
>    if WlanOpenHandle<>nil then
>       begin
>       j := WlanOpenHandle(1,nil,i,H);
>       if j=Error_Success then ....
> -----------------------------------------------------------------------
> 
> at this point j is 87 (should be 0). Anybody who has an idea why 
> WlanOpenHandle 
> is reporting this error?
> 
> -- 
> Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
> belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de


Didn't tested, but can you try this?:

Original function:
DWORD WINAPI WlanOpenHandle( __in        DWORD dwClientVersion, 
__reserved  PVOID pReserved, __out       PDWORD pdwNegotiatedVersion, 
__out       PHANDLE phClientHandle
);

Pascal conversion:
type WlanOpenHandleTyp = function(ClientVersion : DWord;

                              Reserved : Pointer;
                              out NegotiatedVersion : DWord;
                              out ClientHandle : Cardinal) : DWord;


--  
Leonardo M. Ramé
http://leonardorame.blogspot.com
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to