CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2000
    Location
    NY, USA
    Posts
    632

    VB build-in VS API

    Is there any advantages to use API function, if VB has build-in function with the same features. For example MessageBox API and VB MsgBox.

    Vlad


  2. #2
    Join Date
    Dec 1999
    Location
    Dublin, Ireland
    Posts
    1,173

    Re: VB build-in VS API

    The advantages are that you usually get more flexibility - for example the API call MessageBox allows you to specify the handle of the owner window. Thus, you can pass HWND_DESKTOP if your app has not loaded its main form yet and it won't cause problems.

    The performance difference (in most cases) is negligible.

    HTH,
    Duncan

    -------------------------------------------------
    Ex. Datis: Duncan Jones
    Merrion Computing Ltd
    http://www.merrioncomputing.com
    '--8<-----------------------------------------
    NEW -The printer usage monitoring application
    '--8<------------------------------------------

  3. #3
    Join Date
    Mar 1999
    Location
    Nepal
    Posts
    540

    Re: VB build-in VS API

    In my opinion, what VB does is just wrap up Windows functions in a more usable form, so it is never more expensive to use an API function (you would call the Windows function, instead of VB doing it) and you get more flexibility (usability and power are generally inversely proportional) but at the cost of stability. Using VB functions only gives you a certain degree of stability that you lose when you resort to APIs(you have to remember all the chores of freeing up things, and in the correct order etc.)


  4. #4
    Join Date
    Aug 2000
    Location
    NY, USA
    Posts
    632

    Re: VB build-in VS API

    Thank you, guys. Actually my question was just about performance and something else - not flexibility. I know, that many things either cannot be done in VB (I use API), or can be, but with restrictions (I use API again).

    Vlad


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

Featured