Solved

VB and pointers et al

Posted on 2003-11-06
7
330 Views
Last Modified: 2010-07-27
This is something that's probably been covered time and time again.  I'm working with external DLLs that require pointers to byte array and also pointers to the equivalent of a DWORD.

I think I understand the pointer to a byte array, using the concept of ByRef and myArray(0) to pass to a DLL or return from a DLL, but what about a DWORD, how can I pass a pointer to my variable in VB and either pass my number to the DLL or get it to pass a response back into my variable?

If that makes any sense, I'll be very surprised.

Thanks
Simon
0
Comment
Question by:sbennetts
  • 4
  • 3
7 Comments
 
LVL 48

Accepted Solution

by:
AlexFM earned 125 total points
ID: 9693665
If C++ function has DWORD parameter, use ByValue Integer in VB.
If C++ function has DWORD* parameter, use ByRef Integer in VB.
0
 
LVL 2

Author Comment

by:sbennetts
ID: 9693842
Is there a definitive list for this kind of thing?  It's something I always spend ages and ages on...
0
 
LVL 48

Expert Comment

by:AlexFM
ID: 9693985
I usually find some API with parameters of required type and see how API viewer generated API declaration. For example, to see difference between DWORD and DWORD* you can compare GetComputerName and GetWindowText.
0
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
LVL 2

Author Comment

by:sbennetts
ID: 9694091
...but how does that tell you about the actual function call in the DLLs?
0
 
LVL 2

Author Comment

by:sbennetts
ID: 9694133
i.e. what they are expecting in...
0
 
LVL 48

Expert Comment

by:AlexFM
ID: 9694384
Compare GetComputerName and GetWindowText API declarations in MSDN and generate their VB declarations using API Viewer. When Dll function has DWORD* parameter, you pass ByRef Integer. Dll gets DWORD* and may change this variable.
0
 
LVL 2

Author Comment

by:sbennetts
ID: 9701362
Many thanks
Simon
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question