473,395 Members | 1,999 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

convert class instance to IntPtr

I want to PostMessage from a class instance to its containing form. I
want the WPARAM to point to the class instance. I am using the
declaration of PostMessage from www.pinvoke.net. WPARAM is an IntPtr.
VB2005 won't let me do this:
CType(Me, IntPtr)
How can I pass Me as the WPARAM arg?
Bill

Aug 7 '06 #1
2 2108

<sw************@yahoo.comwrote in message
news:11*********************@i3g2000cwc.googlegrou ps.com...
>I want to PostMessage from a class instance to its containing form. I
want the WPARAM to point to the class instance. I am using the
declaration of PostMessage from www.pinvoke.net. WPARAM is an IntPtr.
VB2005 won't let me do this:
CType(Me, IntPtr)
How can I pass Me as the WPARAM arg?
Bill
Might be able to use System.Runtime.InteropServices.Marshal methods to get
the interface you need.

Maybe Marshal.GetIDispatchForObject?

HTH,
Mythran
Aug 7 '06 #2
I found GCHandle. It works.
Bill
Mythran wrote:
<sw************@yahoo.comwrote in message
news:11*********************@i3g2000cwc.googlegrou ps.com...
I want to PostMessage from a class instance to its containing form. I
want the WPARAM to point to the class instance. I am using the
declaration of PostMessage from www.pinvoke.net. WPARAM is an IntPtr.
VB2005 won't let me do this:
CType(Me, IntPtr)
How can I pass Me as the WPARAM arg?
Bill

Might be able to use System.Runtime.InteropServices.Marshal methods to get
the interface you need.

Maybe Marshal.GetIDispatchForObject?

HTH,
Mythran
Aug 7 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Toby Mathews | last post by:
Hi, In an ASP.Net application I want to convert open create a FileStream object from a System.Drawing.Image - is this possible? I create an instance of an Image object using the FromFile method,...
2
by: Mad Scientist Jr | last post by:
Can someone convert this code to vb.net? it is a voice recorder for pocket pc. many thanks ! source: http://www.opennetcf.org/forums/topic.asp?TOPIC_ID=62 the code: using System;
5
by: Chua Wen Ching | last post by:
Hi there, I am very curious on this code: // declared as structure public struct Overlapped { public IntPtr intrnal; public IntPtr internalHigh;
4
by: Valerie Hough | last post by:
In C#: How do I construct an IntPtr object to point to an instance of a class, pass it somewhere, then reference it once again as the original object.? My specific implementation is to use...
15
by: Yifan | last post by:
Hi Does anybody know how to convert System::String* to char*? I searched the System::String class members and did not find any. Thanks Yifan
1
by: Vinoth Kumar | last post by:
Hi I am writing a wrapper class for a unmanaged c++ class, which has the method signature, Method(wchar_t** ppszValue) Anyone please tell me, how to convert the string _gc* _gc* to...
1
by: Mad Scientist Jr | last post by:
hi can someone possibly convert this to vb.net ? it is c# code that lets the pocket pc access the voice recorder... many thanks... source: wapboy...
2
by: Saber | last post by:
Public Class User Private _id, _P, _L, _R As Integer Private _balance As Int64 Private _name, _family, _tel1, _tel2, _mobile, _city, _accountNumber As String Private _password, _email,...
6
by: =?Utf-8?B?UHVjY2E=?= | last post by:
Hi, I'm using VS2005, .net 2 and C# for windows application. I need to convert a IntPtr to a byte to be able to add a meetingBlob data to the meeting class object in Active Directory schema. I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.