Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Conversion of TMessage to c#

Status
Not open for further replies.

excelthoughts

Programmer
Jul 23, 2007
4
AU
Hi,
I am porting some code to C# from Delphi.
The Delphi code makes use of custom messages. One such message has a struct setup of:

// For UM_FLASH message
public struct TUMFlash
{
public uint Msg;
public bool MakeFlashing;
public bool LeftClick;
public bool RightClick;
public bool Unused;
public Object FlashObject;
public int Result;
}

Delphi usage:
Msg.LeftClick = true;
Msg.MakeFlashing = true;
Msg.LParam = 0;
Msg.FlashObject= SomeObject;

PostMessage(SomeHandle, SomeInt,TMessage(Msg).WParam, TMessage(Msg).LParam);

Delphi allows the user to send whatever they like into the Windows message (bool, object etc). Can this be done in .NET? i.e. overriding the Windows message (struct shown below)

public struct Message
{
...
public IntPtr HWnd { get; set; }
public IntPtr LParam { get; set; }
public int Msg { get; set; }
public IntPtr Result { get; set; }
public IntPtr WParam { get; set; }
...
}

If not, how does one associate other data with a Windows message in .NET?

Regards
Andrew
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top