Banner

Sponsor

Login


Welcome Back!
Guest
Guest

Register

Lost your password?

85 users online



C programming help!

C programming help!

Currently viewing this thread: 1 (0 members and 1 guests)


Julan

Julan

computers are my life
Status: Offline!

C programming help!

hey i am trying to learn c and i was just wondering what is meant when a functions return value has () around it

eg

Code:


BOOL (WINAPI *MySetLayeredWindowAttributes)(HWND,COLORREF,BYTE,DWORD);

i have seen it alot but cannot grasp what it means

please explain it to me:D

___________________

http://home.swiftdsl.com.au/~julan/images/firefox_80x15.png

rallyrulz

rallyrulz

rally fan
Status: Offline!

Thats piece of code u wrote is defined as C++ win32 programming, not c.
That is come extremly complex code there and if your a beginner then ure not going to get anywhere with that!

That function there anyway is just returning a boolean. The first set of brackets is simply a cast for the function as far as i can see from that code. Else it could be worse and you could even be dealing with some overloaded constuctors or garbage, have to see the full code first. Seems fairly odd code to me and i certainly wouldnt be caught dead implementing that unreadable stuff. Whoever wrote that may have thought they were being smart by cutting down lines of code, but at the more important expense of readability.

A far more simple function would be something like -

bool Setwindowsattributes(sWinAttr MyAttributes);

Simply make your own struct with the windows attributes in it, in this case that would be sWinAttr which could contain as many variables as you like. This is far better than passing say more than 4 parameters to a function. Much tidier and cleaner code.

Mustang232r

Mustang232r

Status: Offline!

structs... awww.. It is amazing how people actually came up with this stuff from nothing.

if you need any help with structs I'm pretty good in uhm.. just send me a halla! Grin

___________________

Signature Suspended as it is in violation with the signature rules

Quick Jump:

Main Navigation


Site & Graphic Design by Aeon Tan
Developed by Jeremie Pelletier & Scott Roach


NeverAPI generated this page in 0.0071 seconds.