
March 25th, 2003
01:14 AM
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
BOOL (WINAPI *MySetLayeredWindowAttributes)(HWND,COLORREF,BYTE,DWORD);
i have seen it alot but cannot grasp what it means
please explain it to me:D
___________________


March 26th, 2003
03:01 AM
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.

March 26th, 2003
11:58 AM
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! 
___________________
Signature Suspended as it is in violation with the signature rules