Problem with API, Need help


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Problem with API, Need help

  1. #1
    Join Date
    Mar 2006
    Posts
    4

    Problem with API, Need help

    I got a C++ function in a dll file:

    Code:
     int Initialization (Int PortNum, HWND hWnd, HINSTANCE HInst) as integer
    HWND = Main window in the program using the dll
    HINSTANCE = Instance in program using the dll

    how can i include this function in VB.NET?? Is the following declaration correct?

    Code:
     <DLLImport ("DllName.dll")> Public Shared Function Initialization(ByVal PortNum As Integer, ByVal HWND as IntPtr, ByVal HInst as Int32)
    If the declaration above is correct, how can i get the HWND and HINST in vb.net? Can i use:

    Code:
    Dim HWND As IntPtr = Me.Handle
    How bout HInstance?? What is HInstance?
    Hope somebody can help, thanks!

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    Your code looks correct, and you may pass the form's .Handle property for the hWnd parameter. For the hInst, pass AppDomain.GetCurrentThreadId.
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  3. #3
    Join Date
    Mar 2006
    Posts
    4
    Thanks you so much, solved another problem, haha

Similar Threads

  1. Replies: 0
    Last Post: 12-13-2001, 12:06 PM
  2. problem with recordset from Sybase and Oracle
    By substring in forum VB Classic
    Replies: 2
    Last Post: 07-24-2001, 02:29 PM
  3. quote in a string : query problem under VB
    By tyris in forum VB Classic
    Replies: 6
    Last Post: 02-01-2001, 02:08 AM
  4. Replies: 0
    Last Post: 06-23-2000, 02:17 PM
  5. Arabic problem view
    By Ayman in forum VB Classic
    Replies: 8
    Last Post: 04-03-2000, 08:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center