分类: Delphi
2014-10-17 10:54:33
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
//AName:无线AP名称,不超过32个字符
//APass:密码,至少8个字符
//function SetSoftAP(AName, APass: string): Boolean;
//var
// phClient: THandle;
// dwVer, dwRet: DWORD;
// pwhnr: WLAN_HOSTED_NETWORK_REASON;
// pwhnc: WLAN_HOSTED_NETWORK_CONNECTION_SETTINGS;
// pTemp: PAnsiChar;
// pb: BOOL;
//begin
// Result := False;
// dwRet := WlanOpenHandle(1, nil, @dwVer, @phClient);
// if dwRet <> ERROR_SUCCESS then
// Exit;
//
// dwRet := WlanHostedNetworkInitSettings(phClient, @pwhnr, nil);
// if dwRet = ERROR_SUCCESS then
// begin
// pTemp := PAnsiChar(AnsiString(AName));
// pwhnc.hostedNetworkSSID.uSSIDLength := lstrlenA(pTemp);
// ZeroMemory(@pwhnc.hostedNetworkSSID.ucSSID, 32);
// CopyMemory(@pwhnc.hostedNetworkSSID.ucSSID, pTemp, lstrlenA(pTemp));
// pwhnc.dwMaxNumberOfPeers := 10;
// //设置无线AP的名称
// dwRet := WlanHostedNetworkSetProperty(phClient,
// wlan_hosted_network_opcode_connection_settings,
// SizeOf(pwhnc), @pwhnc, @pwhnr, nil);
// if dwRet = ERROR_SUCCESS then
// begin
// pb := True;
// //启用网络承载
// dwRet := WlanHostedNetworkSetProperty(phClient,
// wlan_hosted_network_opcode_enable, SizeOf(pb), @pb, @pwhnr, nil);
// Form1.mmo1.Lines.Add(IntToStr(dwRet) + ': 2');
// if dwRet = ERROR_SUCCESS then
// begin
// pTemp := PAnsiChar(AnsiString(APass));
// //设置无线AP的密码
// dwRet := WlanHostedNetworkSetSecondaryKey(phClient, lstrlenA(pTemp) + 1,
// PUCHAR(pTemp), True, False, @pwhnr, nil);
// Form1.mmo1.Lines.Add(IntToStr(dwRet) + ': 3');
// if dwRet = ERROR_SUCCESS then
// begin
// //开启无线AP
// dwRet := WlanHostedNetworkStartUsing(phClient, @pwhnr, nil);
// Result := dwRet = ERROR_SUCCESS;
// end;
// end;
// end;
// end;
// WlanCloseHandle(phClient, nil);
//end;
|