473,386 Members | 1,741 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,386 software developers and data experts.

How to define own message struct?

Hello NG,

in forme times (decades ago :-) I used to definy my own message structs in
Delphi like this :

TGbReportMessage = packed record
Msg: Cardinal;
Action : Word;
ActionId: Word;
Handle : UINT;
Result: LongInt;
end;

Can I do the same in C# and if yes how?

Thanks for Help
Rainer Queck
Feb 21 '07 #1
4 1952
Hi,

"Rainer Queck" <Ra****@noemail.noemailwrote in message
news:ea**************@TK2MSFTNGP03.phx.gbl...
Hello NG,

in forme times (decades ago :-) I used to definy my own message structs in
Delphi like this :

TGbReportMessage = packed record
Msg: Cardinal;
Action : Word;
ActionId: Word;
Handle : UINT;
Result: LongInt;
end;

Can I do the same in C# and if yes how?
You can use a struct for this.
Feb 21 '07 #2
Hi Ignacio,
You can use a struct for this.
Thanks for responding.

Yes, but can I then typcast a incoming windows message to this struct like I
used to do this in Delphi?

// make sure we process only our messages ....
if aMsg.Msg=FMsgId then
begin
FCurrentMsg := TGbReportMessage(aMsg);

Regards
Rainer
Feb 21 '07 #3
Depends what its type was before you tried to cast it.
Peter

"Rainer Queck" <Ra****@noemail.noemailwrote in message
news:uc**************@TK2MSFTNGP06.phx.gbl...
Hi Ignacio,
>You can use a struct for this.
Thanks for responding.

Yes, but can I then typcast a incoming windows message to this struct like
I used to do this in Delphi?

// make sure we process only our messages ....
if aMsg.Msg=FMsgId then
begin
FCurrentMsg := TGbReportMessage(aMsg);

Regards
Rainer

Feb 21 '07 #4
Hi,

"Rainer Queck" <Ra****@noemail.noemailwrote in message
news:uc**************@TK2MSFTNGP06.phx.gbl...
Hi Ignacio,
>You can use a struct for this.
Thanks for responding.

Yes, but can I then typcast a incoming windows message to this struct like
I used to do this in Delphi?

// make sure we process only our messages ....
if aMsg.Msg=FMsgId then
begin
FCurrentMsg := TGbReportMessage(aMsg);
In general no, it depends of the type it was before. You could do something
similar to Delphi if you use an unsafe block.
--
Ignacio Machin
machin AT laceupsolutions com
Feb 21 '07 #5

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

Similar topics

3
by: theotyflos | last post by:
Hi all, I have the following: /*--- SNIP ---*/ typedef struct Argument_s { char *address; int type;
0
by: ooze | last post by:
typedef unsigned long PARAM; typedef PARAM SAP; typedef struct qnode { struct qnode *next; struct qnode *prev; } QNODE;
42
by: baumann | last post by:
hi all, typedef int (*pfunc)(int , int); pfunc a_func; i know it's ok, but how can define a_func without typedef statement? thanks .
5
by: Daniel Rudy | last post by:
What is the purpose of having a #define inside a struct? typedef struct { uByte bLength; uByte bDescriptorType; uWord wTotalLength; uByte bNumInterface;...
1
by: Alex Sanchez. | last post by:
Hi, If I have this : public struct SGPoint { public double X; public double Y; }
12
by: djhong | last post by:
Following is a snippet of a header file. Here, #define are inside struct evConn{} Any advantage of putting them inside struct block? Looks like there is no diff in scoping of each...
4
by: _mario.lat | last post by:
for struct: struct in6_addr { uint8_t s6_addr; }; is provided a costant: #define IN6ADDR_LOOPBACK_INIT {{{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}}} what does means {{{, and }}}?
1
by: shofu_au | last post by:
Hi Group, I am trying to define a class that has a fixed size array of a structure containing a fixed size array of a structure. I am using System.Runtime.InteropServices and trying to define...
23
by: anon.asdf | last post by:
Hello! In the following code-snippet, is it possible to initialize each element of arr, with STRUCT_INIT? struct mystruct { int a; char b; };
1
by: Polaris | last post by:
Hi Experts: In my C# program I need to use a Win32 DLL which leads to a question: how to define Win32/C++ struct with array in C#. For example, I have a C++ struct: struct MY_STRUCT { int ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.