i got WlanConnect to work, here is your WlanConnect, it makes my wireless popup bubble come up, so it works
sub WlanConnect { croak "Wlan functions are not available" unless $wlan_available; my ($handle, $guuid, $profilename, $ssid) = @_; # possibly overkill, a pDot11Ssid = 0 should suffice #my $pDot11Ssid = Win32::API::Struct->new('PDOT11_SSID'); #$pDot11Ssid->{uSSIDLength} = length $ssid; #$pDot11Ssid->{ucSSID} = $ssid; my $SSIDstruct = pack('LZ[32]',length $ssid, $ssid ); #not overflo +w checked my $Wlan_connection_parameters = pack('LPPJLL', 0, $profilename, $ +SSIDstruct, 0, 3, 0); #$Wlan_connection_parameters->{wlanConnectionMode} = 0; #$Wlan_connection_parameters->{strProfile} = $profilename; #$Wlan_connection_parameters->{pDot11Ssid} = $pDot11Ssid; #$Wlan_connection_parameters->{pDesiredBssidList} = 0; #$Wlan_connection_parameters->{dot11BssType} = 3; #$Wlan_connection_parameters->{dwFlags} = 0; my $reterr = $API{ WlanConnect }->Call($handle, $guuid, $Wlan_con +nection_parameters, 0); $reterr == 0 or die "WlanConnect return Error $reterr "; }
I also changed main for null safety and to work on my machine
sub main { $ARGV[0] = 'removed'; $ARGV[1] = 'removed'; die "USAGE: $0 PROFILENAME SSID\n" unless($ARGV[1]); my $profilename = $ARGV[0]; my $ssid = $ARGV[1]; my $wlan_handle = WlanOpenHandle(); my @interfaces = WlanEnumInterfaces($wlan_handle); my $wlan_guuid = $interfaces[0]->{guuid}; $profilename = encode('UTF-16LE', $profilename."\x00"); WlanConnect($wlan_handle, $wlan_guuid, $profilename, $ssid); }
I dont think my pack codes work on x64 BTW. Perhaps another monk can rewrite them to be portable, or you can just make another SOPW post.

In reply to Re^10: Adding WlanConnect() to Win32::Wlan::API (structs no go?) by bulk88
in thread Adding WlanConnect() to Win32::Wlan::API by tomsell

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.