473,569 Members | 2,700 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2126

<sw************ @yahoo.comwrote in message
news:11******** *************@i 3g2000cwc.googl egroups.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.GetIDis patchForObject?

HTH,
Mythran
Aug 7 '06 #2
I found GCHandle. It works.
Bill
Mythran wrote:
<sw************ @yahoo.comwrote in message
news:11******** *************@i 3g2000cwc.googl egroups.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.GetIDis patchForObject?

HTH,
Mythran
Aug 7 '06 #3

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

Similar topics

7
14192
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, then use the GetThumbnailImage method to create a second Image. This second one is the one I want to get a FileStream from, so that I can then use...
2
1869
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
7181
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
2273
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 PostMessage to pass my class instance as the "lParam" of the message. Thanks in advance. Valerie Hough
15
10803
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
1584
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 wchat_t** Thanks in advance
1
3863
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 http://www.opennetcf.org/forums/topic.asp?TOPIC_ID=62
2
1293
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, _ficheNumber, _postalAddress As String Private _province, _bank As String Private _isSpecial, _photo As Boolean Public stk As New Stack
6
4454
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 get a "unspecified error" if I tried to add the data before converting to a byte in "deNewContextObject.Properties.Add((object)blob.pData);". ...
0
7612
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7673
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7970
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6284
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5513
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3640
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1213
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
937
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.