If you don't want to overload it, then you will have to allocate the
space in memory (which you will need to look at the static Size property
on to get the size of the IntPtr on the platform you are running on) and
then pass the pointer to that memory to SendMessage.
You can do this with the CoTaskMemAlloc and CoTaskMemFree methods on
the Marshal class, and then use the Write* methods on the Marshal class as
well to write the contents to memory (the actual value).
If you want to use unsafe code, you can always just pass the pointer to
the location of the variable on the stack as well.
Ok, thanks. I'll run with this for now but the overload is obviously looking
better. I was hoping that the pointer could simply be stored in an "IntPtr"
as an integer. How to get hold of that pointer without explictly allocating
memory or relying on unsafe code is another matter. I tried playing around
with boxing (casting to an "object") but apparently it's not doable. Maybe
it's possible to write a template that relies on the memory allocation
technique (I'd rather avoid unsafe code) and then it will work with any type
(or perhaps "SendMessage()" can even be written as a template). I'll play
around with it anyway. Thanks again.