Convert Byref memory address to long value 
Author Message
 Convert Byref memory address to long value

Hi,

I need help with the following.

I receive a memory  address (12551816)  by reference in a vb function.
I would like to put this address in a variable. How do I convert this to a
long.  I tried using clng(Firstelement) this returns 0 and not 12551816.

How should I go about this

Regards

Guno



Wed, 27 Oct 2004 03:39:36 GMT  
 Convert Byref memory address to long value
Hi Guno,

I wonder if you are trying to convert the address of an variable to long?
If this is the case, you may want to check the following code:

Dim lAdd As Long

lAdd = VarPtr(lAdd)

Note: lAdd contains the address of itself.

For detailed information, please check the article below:

Q199824 HOWTO: Get the Address of Variables in Visual Basic
http://support.microsoft.com/support/kb/articles/q199/8/24.asp

Also, I wonder if you are copying the content from a specific address. If
this is the case, you can use the CopyMemory introduced by Bruce McKinney:

Q129947 INFO: Win32 Replacement for the hmemcpy Function
http://support.microsoft.com/support/kb/articles/q129/9/47.asp

For the sample code, please check the article below:

Q176058 HOWTO: Pass String Data Between Applications Using SendMessage
http://support.microsoft.com/support/kb/articles/q176/0/58.asp

I hope this helps.

Best Regards,
Leo Chen

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------

| Subject: Convert Byref memory address to long value
| Date: Fri, 10 May 2002 21:39:36 +0200
| Lines: 18
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000

| Newsgroups: microsoft.public.vb.com
| NNTP-Posting-Host: c11137.upc-c.chello.nl 212.187.11.137
| Path: cpmsftngxa08!cpmsftngxa10!tkmsftngp01!tkmsftngp04
| Xref: cpmsftngxa08 microsoft.public.vb.com:27462
| X-Tomcat-NG: microsoft.public.vb.com
|
| Hi,
|
| I need help with the following.
|
| I receive a memory  address (12551816)  by reference in a vb function.
| I would like to put this address in a variable. How do I convert this to a
| long.  I tried using clng(Firstelement) this returns 0 and not 12551816.
|
| How should I go about this
|
| Regards
|
| Guno
|
|
|
|
|
|



Sat, 30 Oct 2004 16:09:33 GMT  
 Convert Byref memory address to long value
Hi leo

I am indeed trying to convert an address to a long

Thanks
Guno



Quote:
> Hi Guno,

> I wonder if you are trying to convert the address of an variable to long?
> If this is the case, you may want to check the following code:

> Dim lAdd As Long

> lAdd = VarPtr(lAdd)

> Note: lAdd contains the address of itself.

> For detailed information, please check the article below:

> Q199824 HOWTO: Get the Address of Variables in Visual Basic
> http://support.microsoft.com/support/kb/articles/q199/8/24.asp

> Also, I wonder if you are copying the content from a specific address. If
> this is the case, you can use the CopyMemory introduced by Bruce McKinney:

> Q129947 INFO: Win32 Replacement for the hmemcpy Function
> http://support.microsoft.com/support/kb/articles/q129/9/47.asp

> For the sample code, please check the article below:

> Q176058 HOWTO: Pass String Data Between Applications Using SendMessage
> http://support.microsoft.com/support/kb/articles/q176/0/58.asp

> I hope this helps.

> Best Regards,
> Leo Chen

> This posting is provided "AS IS" with no warranties, and confers no
rights.

> --------------------

> | Subject: Convert Byref memory address to long value
> | Date: Fri, 10 May 2002 21:39:36 +0200
> | Lines: 18
> | X-Priority: 3
> | X-MSMail-Priority: Normal
> | X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
> | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000

> | Newsgroups: microsoft.public.vb.com
> | NNTP-Posting-Host: c11137.upc-c.chello.nl 212.187.11.137
> | Path: cpmsftngxa08!cpmsftngxa10!tkmsftngp01!tkmsftngp04
> | Xref: cpmsftngxa08 microsoft.public.vb.com:27462
> | X-Tomcat-NG: microsoft.public.vb.com
> |
> | Hi,
> |
> | I need help with the following.
> |
> | I receive a memory  address (12551816)  by reference in a vb function.
> | I would like to put this address in a variable. How do I convert this to
a
> | long.  I tried using clng(Firstelement) this returns 0 and not 12551816.
> |
> | How should I go about this
> |
> | Regards
> |
> | Guno
> |
> |
> |
> |
> |
> |



Thu, 04 Nov 2004 23:48:09 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Converting Long color value to RGB values

2. Converting Long color value to RGB values

3. Converting long to address

4. How to convert Long IP address to normal?

5. How to convert Long IP address to normal?

6. Convert IP Address (String) to Long

7. Help: converting long integer colour values to RGB

8. Converting long value to RGB

9. converting long value rgb() to r,g,b

10. Convert long value to "unreadable string"

11. How to get data from I/O address or memory address

12. Passing UDT ByRef to DLL function changes its address

 

 
Powered by phpBB® Forum Software