It would us to help you if the code you posted at least compiled clean of simple typos.

  1. $rasentry = Win32::API::Struct->New( 'RASENTRY' );

    The is no method New(...), it is new(...)

  2. $ret = RasSetEntryProperties( $Phonebook, $Entry, $rasentry, (Win32::API::Struct::sizeof($rasentry), 0, 0);

    There is an extraneous left paren.

If you had enabled warnings (-w or use warnings;) then you would see that once the above typos are corrected, your code produces 938 lines of warnings.

These two

Useless use of hash element in void context at test.pl8 line 170. Useless use of hash element in void context at test.pl8 line 349.

relate to these two lines where you have forgotten to add the assignment.

$rasentry->{dwDialExtraSampleSeconds}; #170 $rasentry->{dwDialExtraSampleSeconds}; #349

The other 936 come from Win32::API::Struct or Win32::API::Type. When a module starts producing large numbers of warnings like this, you can draw one of two conclusions: Either the module author ignored warnings and published a really crap module--which does happen, but for the most part not-- or, you are using it incorrectly.

For my part, I usually assume the latter, and I'm rarely disappointed:)

Picking out a few lines of your code and analysing them

The upshot is that you will need to resolve these symbolic constants to their numeric values. There are several approaches to doing this, and it would be an interesting project to extend Win32::API to automate some more of this type of thing, but it would entail a great deal of work and would not be something to take on lightly.

I hope that this post won't offend you and will clarify some of the problems that you face in re-writing Win32::RASE to work with Win2K. None of the problems are insurmountable, but there is no readily available shortcut to the process.


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller
If I understand your problem, I can solve it! Of course, the same can be said for you.


In reply to Re: help with Win32::API (Struct and general) by BrowserUk
in thread help with Win32::API (Struct and general) by mabman

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.