Results 1 to 5 of 5

Thread: Api question

  1. #1

    Thread Starter
    Member
    Join Date
    Dec 1999
    Location
    Vilnius, Lithuania
    Posts
    50

    Post

    Where can i find good API tutorial?

    Could ANYONE explain me what is API?
    (in normal words please)

    If i want program to work with .ini
    file(load,save data etc.) do i need API

    What is class?(I lost my help file so could anyone explain meplease )

    Is it Hard to Leard API?

    AND HAPPY NEW YEAR EVERYONE



  2. #2
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    1. API - An acronym for Application Program Interface, the set of commands that an application uses to request and carry out lower-level services performed by a computer's operating system.

    2. For INI files...yes you have to use API. Here is the quick example of how to save the information to INI file and then retrieve it back. Requires 1 Textbox and 2 Command buttons (cmdSave and cmdLoad)
    Code:
    Private Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
    Private Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Long
    
    Private Sub cmdLoad_Click()
        Dim strBuffer As String
        Dim lRet As Long
        
        strBuffer = Space(255)
        lRet = GetPrivateProfileString("TextSection", "Text1", "", strBuffer, Len(strBuffer), "C:\MyFile.ini")
        If lRet Then
            Text1.Text = Left(strBuffer, lRet)
        End If
        
    End Sub
    
    Private Sub cmdSave_Click()
        Call WritePrivateProfileString("TextSection", "Text1", Text1.Text, "C:\MyFile.ini")
    End Sub
    API are tough as you first start working with them, but after a while you will realize that they're not as tough as they seem.

    Happy New Year.

    ------------------

    Serge

    Software Developer
    Access8484@aol.com
    ICQ#: 51055819


  3. #3

    Thread Starter
    Member
    Join Date
    Dec 1999
    Location
    Vilnius, Lithuania
    Posts
    50

    Post

    At last someone answered my questions

    thank you thank you thank you thank you

  4. #4
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,175

    Post

    Where can i find good API tutorial? Visual Basic programer's guide to the WIN32 API, by Dan Appleman

    Could ANYONE explain me what is API? Visual Basic is a high level language, in other words a language that does a lot of the grunt work for you. The API is a way to access some of the lower-level functions if you are willing to do a little more work. The benefit is that you can do some things you can't ordinarily do in VB, and do other things faster.

    If i want program to work with .ini
    file(load,save data etc.) do i need API Strictly speaking, no, you can read and write to an ini file just like a regular file, but there are several easy to use APIs that make the jog much easier.

    What is class?(I lost my help file so could anyone explain meplease )A class is a group of similar objects. I suggest you buy a book like "Doing Objects in Microsoft Visual Basic" by Deborah Kurata

    Is it Hard to Leard API? Not if you have Dan's book.




    ------------------
    Marty

  5. #5
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844

    Post

    A class is a "blueprint" of an object. Once a class is instantiated, it becomes a single instance of that blueprint, aka an object.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width