|
For C++, I would add a constructor. In C++, class and struct are the same except for one point. With struct , members have public access by default, while with class , the access is private by default. This means that a struct can have a constructor, and that's the place you should initialize the values.
You can initialize the union as follows:
data01.thisSignal = ItemDataInitial; where ItemDataInitial is an initialized ITEM_DATA as I described in the previous post. If you use a constant initializer for the union , it must correspond to the first field in it.
Software Zen: delete this;
|
|
|
|
|
Thanks for the info. I have started to use your scheme, or a varient of it.
Will use the union as follows:-
typedef struct
{
unsigned short data1;
}DATA1;
typedef struct
{
unsigned : 4 data2;
}DATA2;
etc
union ALL_DATA_UNION
{
DATA1 data1;
DATA2 data2;
etc
unsigned short buffer[50];
}ALL_DATA;
I need to transmit the buffer, but want all the data items 'overlayed' with the buffer. Dont need to initialise the union as can use memcpy to zero the buffer.
I will have another structure with the details of each item of data and initialise it as per your scheme.
Thanks again, but please point out if this scheme is fault.
Regards,
Graham
grahamfff
|
|
|
|
|
You can use constructor in your structure like this:
struct MyStructure<br />
{<br />
char blablabla[200];<br />
MyStructure()<br />
{<br />
strcpy(this->blablabla,"Testing");<br />
}<br />
}
|
|
|
|
|
Hai,
I'm doing an application in Win32 where I am creating a window dynamically.I want to know how to disable the minimize maximize and close buttons in the title bar of the window dynamically.Can anyone suggest?
Thanks a lot.
|
|
|
|
|
One solution is EnableMenuItem();
GetSystemMenu(FALSE)->EnableMenuItem(SC_SIZE, MF_ENABLED/MF_DISABLED);
Kuphryn
|
|
|
|
|
How can i get the notification in to my application, when the IP address changes..?
mind is everything.
|
|
|
|
|
Look at NotifyAddrChange() in MSDN. Part of the IP HELPER API, its available on Win2000+
Bikram Singh
|
|
|
|
|
Do you know how to set default web-site from C++ for IE and NetScape?
default web-site is called "Home page" also.
thx
includeh10
|
|
|
|
|
i think thats some registry settings..
u just set a URL as homepage in IE and search that string in registry
i hope that will work
mind is everything.
|
|
|
|
|
thx
good suggestion, i will test.
is a doc somewhere for this?
includeh10
|
|
|
|
|
Please give me an example/syntax of:
REFERENCE TO ARRAY OF 10 INTEGERS
Maybe it is very eazy but my super genius stops working for eazy questions... ...
...Avenger
Remember... testing & debugging are always part of programming ...so exterminate those stinking bugs
|
|
|
|
|
int a[10];
void fn(int &a)
{
}
Jaime
|
|
|
|
|
I tried the same myself but i get a bad error WITH THIS....
int fn(int&a)
{
}
int main(int argc, char* argv[])
{
int abb[10];
fn(abb);
return 0;
} ERROR:
C:\Windows\Desktop\a\a.cpp(19) : error C2664: 'fn' : cannot convert parameter 1 from 'int [10]' to 'int &'
A reference that is not to 'const' cannot be bound to a non-lvalue
...Avenger
Remember... testing & debugging are always part of programming ...so exterminate those stinking bugs
|
|
|
|
|
fn(abb[0]); // Get the address of the first cell, must work
Kochise
In Code we trust !
|
|
|
|
|
|
no... this is wrong... i am happy that markuk has given the corect answer. Take a look at his reply. thanx anyway
...Avenger
Remember... testing & debugging are always part of programming ...so exterminate those stinking bugs
|
|
|
|
|
I'm too lazy to look this up from a C++ reference, so I'll let the computer answer:
$ c++decl
Type `help' or `?' for help
c++decl> declare a as reference to array 10 of int
int (&a)[10]
c++decl>
|
|
|
|
|
THANX A LOT 'markkuk'. U are a GENIUS (i mean ur computer)
It works. Please please please tell me in which book did u find that syntax.... I was reading C++ from Stroupstrup and in fact... that was a question from the exercises of chapter-5. But i cudnt dig out that particular syntax. thanx.
...Avenger
Remember... testing & debugging are always part of programming ...so exterminate those stinking bugs
|
|
|
|
|
It is really quite easy to decipher, or create, any simple or complex C/C++ decl, once you know how..
Ever heard of the "right-left rule" ? Again, google is your best friend...
Bikram Singh
|
|
|
|
|
Thank you bikram singh.... YOU ARE MY BEST FRIEND.
'right-left' rule was a BLAST. i dont know how i missed to learn it.... ANYWAY... now i am a genius too.... thanx a lot
|
|
|
|
|
Is there an API function to get Printer feedback from the current job printing?
Thanks
|
|
|
|
|
Yes.
The EnumJobs function retrieves information about a specified set of print jobs for a specified printer.
The JOB_INFO_1 structure specifies print-job information such as the job-identifier value, the name of the printer for which the job is spooled, the name of the machine that created the print job, the name of the user that owns the print job, and so on.
That does the trick!
|
|
|
|
|
Hi , i have a picture box with a large image loaded. can anyone guide me on how to implement a vertical and horizonal scroll bar to see the entire image. Is there a function to autosize the image to fit in my picture box?
thanks in advance ...
|
|
|
|
|
|
You can use _ttoi or brew your own (more robust) function.
bool convertWideStringToInt
(wchar_t* wStr,
int& nInt)
{
if (wscanf (wStr, _T("%d"), &nInt) == 1)
return (true);
return (false);
} /ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|