Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Beginning VB 6
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old February 3rd, 2006, 04:52 PM
Friend of Wrox
Join Date: Jun 2005
Posts: 101
Thanks: 0
Thanked 1 Time in 1 Post
Default passing an integer pointer to a C++ DLL

I have a VB GUI talking to a DLL written in C++ and one of the C++ function requires a pointer to an integer. The program is called but the pointer is NULL.

(#1) How do I define an integer pointer in Visual Basic to pass to a C++ routine?

(#2) How do I make the pointer such that it is not null in Visual Basic?

Old February 3rd, 2006, 06:11 PM
Friend of Wrox
Join Date: Jun 2003
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts

From VB, the declaration of the C++ method must be

... byref myValue as Long, ...

that says that myValue must be passed as reference (internally VB will pass the pointer of the value) When calling it:

dim myVal as Long
...(... , myval, ....)

Hope it's clear enough

PS you did not specify if the integer was a VB (16 bits) or C++ (32 bits) In my example I presumed was a int32.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing null value to integer abhishekkashyap27 C# 2005 9 April 18th, 2008 04:11 AM
PROBLEM with passing 'this' pointer smokey_gun Javascript How-To 4 June 27th, 2007 04:45 PM
Pointer fReqZz C++ Programming 5 June 5th, 2007 01:09 AM
Pointer reference perstam C++ Programming 5 April 29th, 2006 08:51 AM
Passing user defined parameters to vb dll Smita VB How-To 0 March 29th, 2004 04:49 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.