SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 4 of 4
  1. #1
    Junior Member
    Join Date
    Jan 2005
    Posts
    5
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    how to use the WIN32API function in winrunner

    how to use the WIN32API function in winrunner

  2. #2
    SQA Knight
    Join Date
    Jun 2002
    Location
    Cupertino, CA, USA
    Posts
    2,164
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: how to use the WIN32API function in winrunner

    First, be aware that WinRunner provides no documentation for WIN32API. You will therefore want to become familiar with the following website:

    http://msdn.microsoft.com/library/de...y_category.asp

    A number of functions can be "preloaded" by calling the win32 api init script. It's a good idea to put the call in you're tslinit script so the default functions will be loaded whenever you start WinRunner:

    call_close "win32api" ();

    You will then see a number of functions in the function generator. These will only be a small subset of the API, however.

    If you want to call other functions there are basically two steps:

    1) Load the dll containing the function.
    2) Write an external function declaration for the function (see "External Function Declarations") in tsl online reference

    Many of the functions take or returns structures as paramaters. Since WinRunner doesn't support structures, the only way to call these functions is to write you're own dll which creates the structures and calls the function.

    win32 has it's own types which need to be mapped to one of the standard C Types for the external function declaration.

    char (signed and unsigned)
    float
    short (signed and unsigned
    double
    int (signed and unsigned)
    string (equivalent to C char*)
    long (signed and unsigned)


    To see how Win32 data types mapp to standard C types:

    http://msdn.microsoft.com/library/en...data_types.asp

    One more thing to keep in mind - the Win32 reference contains many constants that you don't know the value of. For example here is a snipet form a reference which shows how to set the password character for a password edit:

    <BLOCKQUOTE><PRE CLASS="clsCode"><TABLE border="0" cellpadding="0" cellspacing="0"><TR><TD>
    lResult=SendMessage(
    </TD><TD>//returnsLRESULTinlResult
    </TD></TR><TR><TD>(HWND) hWndControl,
    </TD><TD>// handle to destination control
    </TD></TR><TR><TD>(UINT) EM_SETPASSWORDCHAR,
    </TD><TD>// message ID
    </TD></TR><TR><TD>(WPARAM)wParam,
    </TD><TD>//=(WPARAM)()wParam;</TD></TR><TR><TD>(LPARAM)lParam
    </TD><TD>//=0;notused,mustbezero</TD></TR><TR><TD>
    );
    </TD><TD></TD></TR></TABLE></PRE></BLOCKQUOTE>

    In order to use this, you would need to know the value of EM_SETPASSWORDCHAR (an unsigned int). The easisest way is to write a Win32 console program which spits out the value:

    printf("%i",EM_SETPASSWORDCHAR);

    Good luck.

    [ 01-26-2005, 09:09 AM: Message edited by: bpolitzer ]

  3. #3
    Moderator
    Join Date
    Mar 2002
    Location
    Tampa Bay
    Posts
    7,673
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: how to use the WIN32API function in winrunner

    Good grief, Brett, what did you post?!

  4. #4
    SQA Knight
    Join Date
    Jun 2002
    Location
    Cupertino, CA, USA
    Posts
    2,164
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: how to use the WIN32API function in winrunner

    Look again, I cleaned it up.

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 11.54%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 10:26 AM.

Copyright BetaSoft Inc.