Very easy I think....

Hi experts...
Some time I see some code that I don't understand...

I love program on windows directly in MSVC++ without MFC.

Well... What does it mean... It is in the code that defines the class window to be registered.
Keep in mind that wcex is a WNDCLASSEX type variable

wcex.lpfnWndProc =(WNDPROC)WndProc;
WndProc is the name of the function that process the msgs.

wcex.hbrBackground      = (HBRUSH)(COLOR_WINDOW+1)
wcex.lpszMenuName = (LPCSTR)IDC_MENU;

IDC_MENU is a menu resourse ID.

Can any one explain to me what is the meaning of those "(SomeThing)"
I see things like that everywhere but I don't know how to use it.

I know use the parenthesys in theese situation if (), for (), function (){}But I'm not sure how do they work in thinks like this

something = (OtherThing)AnotherThing.

And where else can I use this kind of code?

Can any C++ expert explain to me?.
Thanks.

LVL 1
MarscAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

MarscAuthor Commented:
Edited text of question.
0
MarscAuthor Commented:
Edited text of question.
0
olgatCommented:
This (SomeThing) is called typacasting or type cast conversion.
You can find a lot explanations about typecasting in VC documentation.

In brief,
"A type cast provides a method for explicit conversion of the type of an object in a specific situation."
"Casts can be used to convert objects of any scalar type to or from any other scalar type"

I.e. in your example conversion from common HANDLE to the handle of a specific HBRUSH type etc.

Because typecasting is done at the compilation time it is a dangerous thing. You can apply it only when you are absolutely sure, that the type you are converting from and the type you are converting to are fully compatible.

See articles
Cast Operators
Conversions from Other Types
Type Conversions
Type-Cast Conversions

to finf more staff about it, it is a big ussue.
Don't hesitate to ask additional questions.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MarscAuthor Commented:
Thanks...
I'm using Type Casting now... It is very usefull...

0
MarscAuthor Commented:
Thanks...
I'm using Type Casting now... It is very usefull...

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.