Re: Where di my VB function go?
- From: "Dmitriy Antonov" <antonovdima@xxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 16 Nov 2006 21:30:05 -0500
"Nate, Nano" <nanonut@xxxxxxxxx> wrote in message
news:1163727869.957720.89510@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi all,
I've been working on an interprocess messaging system which is used by
VB to send messages to other VB apps. I designed a C++ DLL interface,
which takes care of the storing and transmission of messages to the
other processes. Everything works great, except, i want to be able to
call a VB Message handler function from within my C++ Message handler
thread. Essentially the VB app calls a C function i wrote to give the
address of the VB Mesage Handler function to the C++ DLL and store it
in the global area of the process's virtual memory space, then later on
when a message comes into the C++ Message_handler thread, the C++
Message_Handler calls the address of the Passed VB function (which was
placed into virtual memory earlier, as was just discribed) and passes
the relavent message parms to the VB Function (via the stack)
However, i get an access violation. Now, i did some Debugging, and i
found out that when i pass the address of my VB function; that when the
function address is being passed to C++ that the function's machine
code actually resides in memory (at the location of the function
address). Now when i have a message coming in (at a latter time) and i
attempt to call the VB function from C++ (i have the VB functions
address becuase it was sent to me earlier as described above), i find
out that the VB function no longer exists at the address of when the VB
function address was passed initially.
It's like the VB function is dynamically allocated when it is to be
ran, then destroyed afterward. Is there anyway i can force this VB
function to remain at a given place in the process's virtual memory
space, or is there a way to determine where the function will reside
when i need to call it from C++
Thanx for your help
Nate
Where that function is declared - it should be a function (generally,
public) in a Module - not in a Class or a Form. Public function in the
Module shouldn't change an address during lifetime of the process.
Dmitriy.
.
- Follow-Ups:
- Re: Where did my VB function go?
- From: Nate, Nano
- Re: Where did my VB function go?
- References:
- Where di my VB function go?
- From: Nate, Nano
- Where di my VB function go?
- Prev by Date: Where di my VB function go?
- Next by Date: Re: Where did my VB function go?
- Previous by thread: Where di my VB function go?
- Next by thread: Re: Where did my VB function go?
- Index(es):
Relevant Pages
|