Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Beginning VB 6
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 3rd, 2006, 04:52 PM
Friend of Wrox
Points: 660, Level: 9
Points: 660, Level: 9 Points: 660, Level: 9 Points: 660, Level: 9
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2005
Location: St. Louis, , .
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?

Reply With Quote
  #2 (permalink)  
Old February 3rd, 2006, 06:11 PM
Friend of Wrox
Join Date: Jun 2003
Location: Alameda, ca, USA.
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.
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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

All times are GMT -4. The time now is 10:27 AM.

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