Results 1 to 4 of 4

Thread: Replacing API Calls with .NET Framework Classes

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2008
    Posts
    10

    Question Replacing API Calls with .NET Framework Classes

    Do we have nay .NET framework classes to replace the following API calls?

    CreateWindowEx
    GetWindowText
    ShowWindow
    SendMessage
    GetWindowRect

    Basically we have migrated our application from VB6 to .NET and used same API calls in .NET as well.

    Now the time has come to replace all API calls to .NET framework classes.

    We used those API calls to validate textboxes by popping up a temporary error message box next to textbox object. After few seconds, the error message box disappears by itself or on loosing the focus of textbox.

    If we can use the similar functionality of .NET, then there will be less code changes, otherwise please suggest other alternatives.

    Regards

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Replacing API Calls with .NET Framework Classes

    None of those functions are required if you're dealing with forms in your own app but then I don't think they would have in VB6 either. If you're dealing with windows outside your own app then you'll still have to use the same functions.

    Just note that, if you do use those functions in VB.NET, you need to use .NET-specific declarations. You should use the DllImport attribute but you can still use the Declare key word if you want. Either way though, you MUST ensure that you use the correct numeric types, which generally means using an Integer in VB.NET everywhere you would have used a Long in VB6.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    New Member
    Join Date
    Dec 2008
    Posts
    10

    Exclamation Re: Replacing API Calls with .NET Framework Classes

    But I was talking about completely knocking out the API calls. Which means, I should be able to create same functionality in .NET as it was with API methods.

  4. #4
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Re: Replacing API Calls with .NET Framework Classes

    Well JMC stated it pretty clearly. If you are doing this within your own app, then you don't need the API calls, otherwise, you do.

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