User Name
Password

Go Back   Planetarion Forums > Non Planetarion Discussions > Programming and Discussion

Reply
Thread Tools Display Modes
Unread 14 Jan 2003, 08:32   #1
Structural Integrity
Rawr rawr
 
Structural Integrity's Avatar
 
Join Date: Dec 2000
Location: Upside down
Posts: 5,300
Structural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriend
The spawn of the devil that they call Win32

I'm not even going into MFC (because that's an even bigger mess), but after trying to get the simple dimensions of a Window last night I have finalised my opinion that the Windows API is the biggest mess around...
I could choose out of 3 functions with the same name, just a different pointertype given to the second parameter... I could choose out of 4 different structures, all with different capitalisation or a different letter. Each of these structures had a derived pointer which had a whole different name.
It took me an hour to try out all possible pointers and figure out that some of these needed another Windows header file, which was mutually exclusive with the original Windows header, which was needed for my application...

=/

Well, I got my dimensions now, with a reference to an original structure instead of a named pointer, but can't they just document that kind of thing in the MSDN?!
Structural Integrity is offline   Reply With Quote
Unread 14 Jan 2003, 08:59   #2
Raging.Retard
Street Tramp
 
Raging.Retard's Avatar
 
Join Date: Apr 2000
Location: Street Gutter
Posts: 341
Raging.Retard has a brilliant futureRaging.Retard has a brilliant futureRaging.Retard has a brilliant futureRaging.Retard has a brilliant futureRaging.Retard has a brilliant futureRaging.Retard has a brilliant futureRaging.Retard has a brilliant futureRaging.Retard has a brilliant futureRaging.Retard has a brilliant futureRaging.Retard has a brilliant futureRaging.Retard has a brilliant future
How by using MFC did you decide the API it encapsulates was not to your liking? Or were you actully making direct API calls instead of letting MFC encapsulate it for you (which is its purpose)

3 functions with the same name? Thats common place in most languages (lo overloading). The idea is to produce the same return output from a varying range of inputs.
__________________
Chimney Pots.
Raging.Retard is offline   Reply With Quote
Unread 14 Jan 2003, 09:33   #3
Structural Integrity
Rawr rawr
 
Structural Integrity's Avatar
 
Join Date: Dec 2000
Location: Upside down
Posts: 5,300
Structural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriend
Quote:
Originally posted by Raging.Retard
How by using MFC did you decide the API it encapsulates was not to your liking? Or were you actully making direct API calls instead of letting MFC encapsulate it for you (which is its purpose)

3 functions with the same name? Thats common place in most languages (lo overloading). The idea is to produce the same return output from a varying range of inputs.
I only have very basic MFC knowledge from a course at school... we had to finish the course with making a game (\o/... I made a reaction-time game, but the random number seeder didn't work, but the teacher didn't know that ) with MFC. We used visual C++ for it. Needless to say it was a biatch as noone managed to understand WTF was going on... The code generation of VC++ isn't really good for learning I tell you, especially if you don't have any win32 knowledge at all.
OK OK, I admit it, I don't have enough experience with MFC to say that it's the crappiest API around, but from what I've seen it's not pretty.

I know overloading is common, but they shouldn't confuse people with a whole set of structures with basically the same function (RECT, CRect, CRECT, LPRECT, PRect, Rect... some of those are pointers) but are not accepted by any function.
I used a reference to a RECT while the function takes a LPRECT (which is a pointer) which is an overloaded member of RECT (I found out in the header file).
They should either adjust the damn MSDN and list where a LPRECT comes from and list alternative uses, or don't use a dozen names for the same damn thing.
Spawn of the devil I tell you!
Structural Integrity is offline   Reply With Quote
Unread 14 Jan 2003, 10:48   #4
Pitchfork
Tourist
 
Join Date: Jun 2001
Location: moon
Posts: 90
Pitchfork is an unknown quantity at this point
hint: Alt+F12 -> Definition and References, that would have given you something like:

typedef struct tagRECT
{
LONG left;
LONG top;
LONG right;
LONG bottom;
} RECT, *PRECT, NEAR *NPRECT, FAR *LPRECT;

(from windef.h)

you see, that LPRECT and PRECT are the same, namely a pointer to RECT resp. tagRect.

the class CRect inherits from tagRECT and is nearly the same with a few functions to determine width, heigth offset a rect and so on.

Anyway, there is only ONE member function of CWnd to determine window size, namely
void GetWindowRect( LPRECT lpRect ) const;
the parameter is LPRECT, but as mentioned above, this is equal to PRECT, &(RECT) and &(CRect)

I don't see any problems with that function.
__________________
Quote:
Originally posted by Bloomers III
sex is dirty and for losers who can't masturbate properly
Pitchfork is offline   Reply With Quote
Unread 14 Jan 2003, 15:48   #5
djbass
mmm.. pills
 
djbass's Avatar
 
Join Date: Apr 2000
Location: Australia
Posts: 2,152
djbass has a reputation beyond reputedjbass has a reputation beyond reputedjbass has a reputation beyond reputedjbass has a reputation beyond reputedjbass has a reputation beyond reputedjbass has a reputation beyond reputedjbass has a reputation beyond reputedjbass has a reputation beyond reputedjbass has a reputation beyond reputedjbass has a reputation beyond reputedjbass has a reputation beyond repute
It does seem like only a simple process to me, but I geuss if you are not used to dealing with the win32 API it can get a little confusing.

All the functions used to be brilliantly documented in older revisions of MSDN, but they seem to have dropped that in favour of pushing all their .NET technologies instead.

MFC is also far easier and useful than it seems at first, the problem is that the code generated by MSVC for default projects of this kind are way overdone. I found a good book on the subject and have learned 90% of the generated code isn't really needed.

=[DJ Bass]=
__________________
CSS : the result of letting artists design something only an engineer should touch.
djbass is offline   Reply With Quote
Unread 14 Jan 2003, 16:52   #6
Nodrog
Registered User
 
Join Date: Jun 2000
Posts: 8,476
Nodrog has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.Nodrog has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.Nodrog has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.Nodrog has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.Nodrog has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.Nodrog has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.Nodrog has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.Nodrog has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.Nodrog has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.Nodrog has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.Nodrog has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.
I dont understand why people hate win32 API so much.

Get a copy of Borland C++ though, it comes with superb help files (including a complete reference for winAPI and MFC). Also, use something like Visual Studio which autocompletes the function as you type it and tells you what parameters it takes, so you dont have to bother memorising them all.

Also, you wouldnt really program anything semi-complex in winAPI other than to actually learn how things work. Its low level system calls - of course its going to be pretty horrible compared to an API that encapsulates system calls. If you dont like MFC, theres a few other libraries around that encapsulate the API at a lowish level (I think borland has one thats reasonably popular, but I'm not sure).


Also, the pointer names make perfect sense once you learn Hungarian Notation (which is admittedly a stupid idea). LPRECT = Long Pointer to a RECT, and so on.

Last edited by Nodrog; 14 Jan 2003 at 16:57.
Nodrog is offline   Reply With Quote
Unread 14 Jan 2003, 17:00   #7
mbushell
Registered User
 
mbushell's Avatar
 
Join Date: Jul 2000
Location: :noitacoL
Posts: 1,200
mbushell spreads love and joy to the forum in the same way Jesus wouldmbushell spreads love and joy to the forum in the same way Jesus wouldmbushell spreads love and joy to the forum in the same way Jesus wouldmbushell spreads love and joy to the forum in the same way Jesus wouldmbushell spreads love and joy to the forum in the same way Jesus wouldmbushell spreads love and joy to the forum in the same way Jesus wouldmbushell spreads love and joy to the forum in the same way Jesus wouldmbushell spreads love and joy to the forum in the same way Jesus wouldmbushell spreads love and joy to the forum in the same way Jesus wouldmbushell spreads love and joy to the forum in the same way Jesus wouldmbushell spreads love and joy to the forum in the same way Jesus would
Quote:
Originally posted by Nodrog
Hungarian Notation
I almost ripped out my eyes when i saw this, i've now a major brainache as it brings back terrible memories - i lost sleep because it couldn't remember things :/
mbushell is offline   Reply With Quote
Unread 14 Jan 2003, 17:29   #8
Structural Integrity
Rawr rawr
 
Structural Integrity's Avatar
 
Join Date: Dec 2000
Location: Upside down
Posts: 5,300
Structural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriend
Well, I guess I'm not that experienced with either win32 nor MFC to get everything right the first time. But it really took me about an hour to figure out that I had the wrong rect struct and that I could use a reference to a RECT...
Structural Integrity is offline   Reply With Quote
Unread 14 Jan 2003, 17:41   #9
Nodrog
Registered User
 
Join Date: Jun 2000
Posts: 8,476
Nodrog has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.Nodrog has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.Nodrog has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.Nodrog has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.Nodrog has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.Nodrog has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.Nodrog has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.Nodrog has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.Nodrog has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.Nodrog has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.Nodrog has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.
Quote:
Originally posted by Structural Integrity
Well, I guess I'm not that experienced with either win32 nor MFC to get everything right the first time. But it really took me about an hour to figure out that I had the wrong rect struct and that I could use a reference to a RECT...
Youre going to have to learn hungarian notation :(
Nodrog is offline   Reply With Quote
Unread 14 Jan 2003, 18:02   #10
Raging.Retard
Street Tramp
 
Raging.Retard's Avatar
 
Join Date: Apr 2000
Location: Street Gutter
Posts: 341
Raging.Retard has a brilliant futureRaging.Retard has a brilliant futureRaging.Retard has a brilliant futureRaging.Retard has a brilliant futureRaging.Retard has a brilliant futureRaging.Retard has a brilliant futureRaging.Retard has a brilliant futureRaging.Retard has a brilliant futureRaging.Retard has a brilliant futureRaging.Retard has a brilliant futureRaging.Retard has a brilliant future
Quote:
Originally posted by Nodrog
Hungarian Notation (which is admittedly a stupid idea
I write everything in Hungarian notation
__________________
Chimney Pots.
Raging.Retard is offline   Reply With Quote
Unread 14 Jan 2003, 18:50   #11
Nodrog
Registered User
 
Join Date: Jun 2000
Posts: 8,476
Nodrog has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.Nodrog has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.Nodrog has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.Nodrog has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.Nodrog has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.Nodrog has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.Nodrog has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.Nodrog has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.Nodrog has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.Nodrog has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.Nodrog has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.
Quote:
Originally posted by Raging.Retard
cI lpsWrite lpsEverything lpsIn lpsHungarian lpsNotation pc:lpcD
Nodrog is offline   Reply With Quote
Unread 14 Jan 2003, 19:01   #12
Structural Integrity
Rawr rawr
 
Structural Integrity's Avatar
 
Join Date: Dec 2000
Location: Upside down
Posts: 5,300
Structural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriend
Quote:
Originally posted by Nodrog
Youre going to have to learn hungarian notation
Since when does that have anything to do with win32?
Structural Integrity is offline   Reply With Quote
Unread 14 Jan 2003, 20:15   #13
MT
/dev/zero
Retired Mod
 
MT's Avatar
 
Join Date: May 2000
Posts: 415
MT is an unknown quantity at this point
Quote:
Originally posted by Structural Integrity
Since when does that have anything to do with win32?
Since microsoft used it to name all their functions. So ..... 1993?
__________________
#linux : Home of Genius

<idimmu> ok i was chained to a desk with this oriental dude
MT is offline   Reply With Quote
Unread 14 Jan 2003, 20:31   #14
Nodrog
Registered User
 
Join Date: Jun 2000
Posts: 8,476
Nodrog has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.Nodrog has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.Nodrog has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.Nodrog has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.Nodrog has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.Nodrog has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.Nodrog has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.Nodrog has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.Nodrog has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.Nodrog has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.Nodrog has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.
Quote:
Originally posted by Structural Integrity
Since when does that have anything to do with win32?
As MT said, all microsoft functions/variables/whatever use hungarian notation in order to appease people like RR who are unable to remember what type their variables are because they are dum (lol). The problem you mentioned comes from being unfamiliar with HN - if you knew it, the RECT thing would have made a lot more sense.
Nodrog is offline   Reply With Quote
Unread 14 Jan 2003, 22:12   #15
Cyp
∞+♪˛
 
Join Date: Nov 2000
Location: :uo!te]oŻ|
Posts: 428
Cyp is an unknown quantity at this point
The size of MFC alone is ridiculous enough to put me off even considering trying to figure it out.

64kb should be enough for anything. Therefore MFC is nothing.
__________________
Structural Integrity for Creator - since he'll probably make PA turn 3D.
Wikipedia forum
Note to self - Don't write Chinese letters with bold and italics...
<!--Last incarnation: Nov 2000-->
Cyp is offline   Reply With Quote
Unread 14 Jan 2003, 23:07   #16
Idi
Guest
 
Posts: n/a
GTK 2

live it
  Reply With Quote
Unread 15 Jan 2003, 16:27   #17
djbass
mmm.. pills
 
djbass's Avatar
 
Join Date: Apr 2000
Location: Australia
Posts: 2,152
djbass has a reputation beyond reputedjbass has a reputation beyond reputedjbass has a reputation beyond reputedjbass has a reputation beyond reputedjbass has a reputation beyond reputedjbass has a reputation beyond reputedjbass has a reputation beyond reputedjbass has a reputation beyond reputedjbass has a reputation beyond reputedjbass has a reputation beyond reputedjbass has a reputation beyond repute
Quote:
Originally posted by Structural Integrity
Well, I guess I'm not that experienced with either win32 nor MFC to get everything right the first time. But it really took me about an hour to figure out that I had the wrong rect struct and that I could use a reference to a RECT...
That sounds more like an issue with getting to know pointers and memory structures better. If you haven't already, I'd severly suggest getting a decent book on C/C++ and doing a refresher on how structures and variables are referenced.

=[DJ Bass]=
__________________
CSS : the result of letting artists design something only an engineer should touch.
djbass is offline   Reply With Quote
Unread 15 Jan 2003, 16:33   #18
Structural Integrity
Rawr rawr
 
Structural Integrity's Avatar
 
Join Date: Dec 2000
Location: Upside down
Posts: 5,300
Structural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriend
Quote:
Originally posted by djbass
That sounds more like an issue with getting to know pointers and memory structures better. If you haven't already, I'd severly suggest getting a decent book on C/C++ and doing a refresher on how structures and variables are referenced.

=[DJ Bass]=
Oh, I know how structures and pointers work. I've seen nothing else for 3 months while working on the embedded webserver in C.
Although I learned a few new things from structures when I looked at the definition of that RECT structure in that windows header. I didn't know that you could give several type names to a single struct, or that you could even define a pointer to one in such a way.

Structural Integrity is offline   Reply With Quote
Unread 15 Jan 2003, 17:21   #19
Pitchfork
Tourist
 
Join Date: Jun 2001
Location: moon
Posts: 90
Pitchfork is an unknown quantity at this point
Quote:
Originally posted by Structural Integrity
Oh, I know how structures and pointers work. I've seen nothing else for 3 months while working on the embedded webserver in C.
Although I learned a few new things from structures when I looked at the definition of that RECT structure in that windows header. I didn't know that you could give several type names to a single struct, or that you could even define a pointer to one in such a way.

u can do everything with C
I have a collection of the worst code structures I found here at work and there are really horrible lines like:

cuadwab=((swab>=0.0&&hilf>=0.0)?1(swab>=0.0&&hilf<0.0)?2(swab<0.0&&hilf<0.0)?3:4)));

or

class AcDbObjectId;
template <class VV> class AcArrayMemCopyReallocator;
template <class TT, class RR = AcArrayMemCopyReallocator<TT> > class AcArray;
typedef AcArray<AcDbObjectId> AcDbObjectIdArray;

and

if((AcGePoint3d::AcGePoint3d(showPoint[0],showPoint[1],0).distanceTo(cursorPos)<maxDist)||(!(DoOrthoAnsicht))||(pRaster->AlwaysSnap()))

pretty nice, eh
__________________
Quote:
Originally posted by Bloomers III
sex is dirty and for losers who can't masturbate properly
Pitchfork is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Forum Jump


All times are GMT +1. The time now is 09:20.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2002 - 2018