::GlobalLock needed? 
Author Message
 ::GlobalLock needed?

Hi,

Just wondering if for interop the following is needed...

HGLOBAL hglob =
reinterpret_cast<HGLOBAL>(Marshall::AllocHGlobal(...).ToPointer());
...
Marshal::Copy(IntPtr(::GlobalLock(hglob)), pstream, 0, streamsize);

Or can you take for granted that hglobal always is the correct address?.

--



Mon, 27 Jun 2005 06:47:23 GMT  
 ::GlobalLock needed?
Egbert,

Quote:
> Hi,

> Just wondering if for interop the following is needed...

> HGLOBAL hglob =
> reinterpret_cast<HGLOBAL>(Marshall::AllocHGlobal(...).ToPointer());
> ...
> Marshal::Copy(IntPtr(::GlobalLock(hglob)), pstream, 0, streamsize);

> Or can you take for granted that hglobal always is the correct address?.

It should be, since the docs explicitly say it returns the address. In fact,
a quick look at the code reveals that this simply calls LocalAlloc() with
the LMEM_FIXED flag.

--
Tomas Restrepo



Mon, 27 Jun 2005 08:20:52 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Help with GlobalLock()

2. GlobalLock Problem

3. GlobalAlloc/GlobalLock

4. GlobalLock

5. GlobalAlloc and GlobalLock Question

6. GlobalAlloc: why use GlobalLock???

7. Threads and GLobalLock

8. GlobalAlloc and GlobalLock

9. Be aware with GlobalAlloc and GlobalLock

10. how to check handle from GlobalLock()

11. GlobalLock

12. GlobalLock() function in CE 2.0??

 

 
Powered by phpBB® Forum Software