Article View: comp.os.ms-windows.programmer.misc
Article #2653Re: Data Type problem !!
From: John Grant
Date: Sun, 10 Jan 1993 03:52
Date: Sun, 10 Jan 1993 03:52
67 lines
2890 bytes
2890 bytes
In article <1993Jan9.085030.11967%gtonwu@Uz.nthu.edu.tw> gtonwu@Uz.nthu.edu.tw (Tony) writes: >Hi, there > > I am confused by type data types of MSC ! I don't know what is the > difference among them , since I was simply using int,unsigned,char.. > while I did programming under MS-DOS before ! > > Would someone kind enough to tell me the distict difference of the > following !? > > WORD , DWORD, LONG, WPARAM, LPARAM , ... > > and some others I have to know ! They are all defined in windows.h. Look in there and you will see those and many others. But you really don't have to know what they are because you will *not* be manipulating or touching them yourself. MS provides all you need. For example, when you get a WM_PAINT message, you need an HDC (handle to a device context) to call any of the GDI drawing functions. What is it? Who cares! But you do need one. So, just declare it and use it as the function tells you: HDC hdc; PAINTSTRUCT ps; ... case WM_PAINT: hdc=BeginPaint(hdc,&ps); ...gdi functions(hdc,....); EndPaint(hwnd,&ps); break; Also, if a windows message tells you that LPARAM contains a POINT structure, then just retrieve it with: POINT pt; pt=MAKEPOINT(lparam); Usually, the help for each function describes the functions and their parameters, returned values etc. Ok, so I lied. You do need to know a few things, like what is a POINT structure. You can look up all of these things in windows.h and in the docs. The definitions of HWND,HDC, etc depend on whether you use #define STRICT or not (see windows.h). I strongly recommend that you use: #define STRICT #include <windows.h> Most of the HDC, HWND, etc are all just UINT or WORD, i.e. just 'int' values when you get right down to it, so it is not possible for the compiler to check whether function1(hdc,hwnd); or function2(hwnd,hdc); is correct. If you use STRICT, then they are defined as pointers to unique structs and the compiler can tell you if you are wrong. I also highly recommend enabling every single warning message that your compiler can possibly report. Make sure it warns about everything and act on every warning until it is quiet. Your app will be significantly more reliable. -- John A. Grant jagrant@emr1.emr.ca Airborne Geophysics Geological Survey of Canada, Ottawa
Technical Details
Message-ID:
<1993Jan10.035219.22954@emr1.emr.ca>Path:
arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!torn!nott!emr1!jagrantReferences:
<1993Jan9.085030.11967%gtonwu@Uz.nthu.edu.tw>Show Full Headers
Complete Article Headers
Newsgroups: comp.os.ms-windows.programmer.misc Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!torn!nott!emr1!jagrant From: jagrant@emr1.emr.ca (John Grant) Subject: Re: Data Type problem !! Message-ID: <1993Jan10.035219.22954@emr1.emr.ca> Organization: Energy, Mines, and Resources, Ottawa References: <1993Jan9.085030.11967%gtonwu@Uz.nthu.edu.tw> Date: Sun, 10 Jan 1993 03:52:19 GMT Lines: 67