Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Get WIFI SSID Name

593 views
Skip to first unread message

Christophe L.

unread,
Jan 27, 2012, 1:00:52 PM1/27/12
to
Hello

I'm not sure it's the good forum for this question, and sorry if not.

I'm trying to retrieve the SSID (wifi network name) connected to my Wlan
card (and only that).

I'm quite a newbie in Delphi. I've found some examples, always difficult
to understand, and none was working :(

Is it so difficult to do it ?

If you can give the best way to do it... (at least the best/simpler
function to use, after I will search to make it work)

thanks a lot

Christophe

Maarten Wiltink

unread,
Jan 29, 2012, 8:04:40 AM1/29/12
to
"Christophe L." <christop...@free.fr> wrote in message
news:4f22e654$0$6943$426a...@news.free.fr...

> I'm trying to retrieve the SSID (wifi network name) connected to my
> Wlan card (and only that).
>
> I'm quite a newbie in Delphi. I've found some examples, always
> difficult to understand, and none was working :(
>
> Is it so difficult to do it ?
>
> If you can give the best way to do it... (at least the best/simpler
> function to use, after I will search to make it work)

I don't know if it's difficult but it may be different for every
network adapter.

Can you show the gist of some of the examples? (Are they in Delphi?)

Groetjes,
Maarten Wiltink


Erick Engelke

unread,
Jan 29, 2012, 10:14:07 AM1/29/12
to

You can do it with WMI, and it works for all.

I can't give you the code, it's wrapped up in something I can't
distribute, but if you learn to read WMI it's in:

root\WMI
MSNdis_80211_ServiceSetIdentifier
Ndis80211SSID

Erick

Christophe L.

unread,
Jan 31, 2012, 1:47:13 AM1/31/12
to
Hello

Thanks, it works now for WMI.
Was not easy for a newbie, but it's ok.

Thanks a lot !

Christophe

Christophe L.

unread,
Jan 31, 2012, 1:52:36 AM1/31/12
to
Here is the code.
I retrieve 3 times the SSID.
Did I made a mistake ?

begin
locator := TSWbemlocator.Create(self);
Services := locator.ConnectServer('', 'root\WMI', '', '', '', '', 0, nil);
memo1.Clear;
ObjSet := Services.ExecQuery('SELECT * FROM
MSNdis_80211_ServiceSetIdentifier where active=true',
'WQL', wbemFlagReturnImmediately, nil);
Enum := IUnknown(ObjSet._NewEnum ) as IEnumVariant;
while (Enum.Next(1, tempObj, Value) = S_OK) do
begin
Obj := IUnknown(tempObj) as SWBemObject;
PropSet := Obj.Properties_;
propEnum := IUnknown(PropSet._NewEnum) as IEnumVariant;
while (propEnum.Next(1, tempObj1, Count) = S_OK) do
begin
Prop := IUnknown(tempObj1) as SWBemProperty;

result:='';

if ansicomparestr(prop.name, 'Ndis80211SsId')=0 then
begin
if VarIsArray(prop.Get_Value) then
begin
if VarArrayHighBound(prop.Get_Value, 1) > 0 then
for Count := 1 to VarArrayHighBound(prop.Get_Value, 1) do
begin
i:=prop.Get_Value[Count];
if i<>0 then
Result := Result + chr(i);

end;
end
else Result := IntToStr(prop.Get_Value);

memo1.Lines.Add(prop.name + ' ' + result);
end;

// memo1.Lines.Add(GetValue(prop.Name, mo));

end;
end;
0 new messages