Results 1 to 4 of 4

Thread: help with accessing C++ memory blocks from VB

  1. #1

    Thread Starter
    Hyperactive Member Scott Penner's Avatar
    Join Date
    Dec 2000
    Location
    Mountain View
    Posts
    327

    Exclamation

    Hi all,
    I wrote some ATL data aquisition code that can pull in a large amount of data from an A/D card. My problem is that I would like to share this data with a 3D graphing control as well as some custom analysis routines. I need to be able to have multiple data sets in memory, so that I can display and / or analyze them at will.

    Is there are way to do this from VB without continually copying safe arrays from the ATL control? Could I say, set up a collection of Windows memory handles that could then be passed to and accessed by different controls?

    Does anyone have experience with this sort of thing? Any suggestions would be appreciated...
    -scott
    he he he

  2. #2
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    The API heap functions should help here. Use GlobalAlloc to allocate a handle to some memory, then pass that around.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  3. #3

    Thread Starter
    Hyperactive Member Scott Penner's Avatar
    Join Date
    Dec 2000
    Location
    Mountain View
    Posts
    327

    Talking thanks I'll try that...

    For some reason I didn't think that I could get at that function from VB. I'm using the heap operations in VC. Thanks for waking me up.

    -scott
    he he he

  4. #4
    Lively Member ExciteMouse's Avatar
    Join Date
    Jul 2000
    Location
    Dallas, TX
    Posts
    78

    Thumbs up here are the declorations for Global*

    Code:
    Public Declare Function GlobalAlloc Lib "kernel32" Alias "GlobalAlloc" (ByVal wFlags As Long, ByVal dwBytes As Long) As Long
    
    Public Declare Function GlobalFree Lib "kernel32" Alias "GlobalFree" (ByVal hMem As Long) As Long
    
    Public Declare Function GlobalLock Lib "kernel32" Alias "GlobalLock" (ByVal hMem As Long) As Long
    
    Public Declare Function GlobalHandle Lib "kernel32" Alias "GlobalHandle" (wMem As Any) As Long
    
    Public Declare Function GlobalReAlloc Lib "kernel32" Alias "GlobalReAlloc" (ByVal hMem As Long, ByVal dwBytes As Long, ByVal wFlags As Long) As Long
    
    Public Declare Function GlobalSize Lib "kernel32" Alias "GlobalSize" (ByVal hMem As Long) As Long
    
    Public Declare Function GlobalUnlock Lib "kernel32" Alias "GlobalUnlock" (ByVal hMem As Long) As Long

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