[fpc-pascal] Wireless configuration in Windows

"Jürgen Hestermann" Juergen.Hestermann at gmx.de
Tue Nov 29 15:56:30 CET 2011


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



More information about the fpc-pascal mailing list