SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 7 of 7

Thread: Win32API Q

  1. #1
    Senior Member
    Join Date
    Oct 2002
    Posts
    254
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Win32API Q

    Hi

    I'm trying to read a value from an ini file, but TC doesn't support reference parameters used to return values from functions, like the GetPrivateProfile string function in the Win32api. Does anyone know of a way around this?

    Thanks,
    Nick

  2. #2
    Member
    Join Date
    Nov 2001
    Location
    Kiev, Ukraine
    Posts
    38
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Win32API Q

    Hi Nick,

    Have a look at the Storages.INI help topic.
    Regards,
    Alex
    [TeamAQA]
    ================================

  3. #3
    Senior Member
    Join Date
    Oct 2002
    Posts
    254
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Win32API Q

    Hi Alex

    Thanks for the idea, but unfortunately the ini file I'm trying to read from wasn't created by TC, and according to the Storages.INI help topic, The INI method can open only those files that were created by that method. Do you know of something else I could try?

    Thanks,
    Nick

  4. #4
    Senior Member
    Join Date
    Oct 2004
    Location
    Las Vegas
    Posts
    473
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Win32API Q

    Hello Nick,

    In fact, the ini file should just contain a [root] section in order to be written by TestComplete. I can suggest you to add this section to the file (just add the '[root]' line in the end of the file) and then use of the Storages object.

    Atanas

  5. #5
    Senior Member
    Join Date
    Oct 2002
    Posts
    254
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Win32API Q

    Thanks, Atanas, I'll give that a shot.

    -Nick

  6. #6
    Junior Member
    Join Date
    Aug 2005
    Posts
    4
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Win32API Q

    Nolivo,
    I had same problem, but followed Atanas suggestion. Now TC is able to read the INI file i created.

    Jpkittu

  7. #7
    Member
    Join Date
    Oct 2002
    Location
    Kansas City
    Posts
    79
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Win32API Q

    It you are still interested...I downloaded a helper .dll (wshini.dll) from http://cwashington.netreach.net/main...asp?topic=n-z. It simply wraps up the WritePrivateProfileString / GetPrivateProfileString API.

    Usage(after registering the .dll):

    Public Function fGetPrivateProfileString(sSection, sKey, sFilePath)

    Dim oWSHINI
    Dim sDefault
    Dim sReturnedString
    Dim lSize

    Set oWSHINI = CreateObject("WSHINI.ini")

    sDefault = "Unknown"
    sReturnedString = Space(255)
    lSize = Len(sReturnedString)

    fGetPrivateProfileString = oWSHINI.XGetPrivateProfileString(CStr(sSection), CStr(sKey), CStr(sDefault), CStr(sReturnedString), CLng(lSize), CStr(sFilePath))

    Set oWSHINI = Nothing

    End Function

    Public Sub fWritePrivateProfileString(sSection, sKey, sValue, sFilePath)

    Dim oWSHINI

    Set oWSHINI = CreateObject("WSHINI.ini")

    Call oWSHINI.XWritePrivateProfileString(CStr(sSection), CStr(sKey), CStr(sValue), CStr(sFilePath))

    Set oWSHINI = Nothing

    End Sub

 

 

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 9.38%
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 08:06 PM.

Copyright BetaSoft Inc.