I'm wondering if anyone knows where I can learn a good programming
method for creating windows apps. I'm just starting to learn windows
programming with MSVC++ 6.0. I want to learn low level windows
programming in C first. I don't want to learn any bad habits by
hacking away at code until I get something to work.
Specifically, I'd like to learn how to set up and plan out a C windows
project and break it down into pieces of code that will be efficient
and in good style. A recomendation for website or book that teaches C
windows methodolgy would be good.
I hope the question was clear.
-thanks
-todd 8 2392 sm*****@auburn. edu (Todd Smith) wrote in
news:ed******** *************** ***@posting.goo gle.com: I'm wondering if anyone knows where I can learn a good programming method for creating windows apps. I'm just starting to learn windows programming with MSVC++ 6.0. I want to learn low level windows programming in C first. I don't want to learn any bad habits by hacking away at code until I get something to work.
Specifically, I'd like to learn how to set up and plan out a C windows project and break it down into pieces of code that will be efficient and in good style. A recomendation for website or book that teaches C windows methodolgy would be good.
I hope the question was clear.
Very. And very off-topic here. You seek a software engineering newsgroup
and one of the microsoft.* newsgroups. Please read the C-FAQ.
--
- Mark ->
--
"Todd Smith" <sm*****@auburn .edu> wrote in message I'm wondering if anyone knows where I can learn a good programming method for creating windows apps.
Windows programming isn't topical here but good style is.
For any program, you want to break the source down into logical units. For a
Windows program, an obvious unit is the Window.
Windows allows you to hang a pointer containing arbitrary data off each
window. Use this as something technically called an "object".
Eg, say you have a window which goes darker as you left click it, and
lighter as you right click it. It might be a control for ambient light level
in a game, for example.
You would define a structure
typedef struct
{
unsigned char level; /* light level 0-255 */
unsigned char prev; /* previous level (to implement a cancel) */
/* maybe more members here */
}LIGHTLEVEL;
Then in your windows procedure, the very first line retrieves this structure
from the window.
You then have a series of sub-functions to respond to messages. A "draw"
message would floodfill the window with grey of the appropriate colour.
Left-clicks and right clicks would cause the level to change and send a
redraw message. You might also want to respond to resize messages.
Malcolm wrote: "Todd Smith" <sm*****@auburn .edu> wrote in message I'm wondering if anyone knows where I can learn a good programming method for creating windows apps. Windows programming isn't topical here but good style is.
Let's rephrase the question:
"I have a C function which accepts four parameters. It's a key routine, a
gateway into the whole program. The parameters convey information about an
incoming message, and I have tons of different messages to process. How can
I invoke the right bits of my program without making a complete pig's
breakfast of the program structure?"
I think that, put this way, it is very close to becoming a C question. YMMV.
For any program, you want to break the source down into logical units. For a Windows program, an obvious unit is the Window. Windows allows you to hang a pointer containing arbitrary data off each window. Use this as something technically called an "object".
Well, I call it a pointer to struct, but yeah, this is good advice.
Eg, say you have a window which goes darker as you left click it, and lighter as you right click it. It might be a control for ambient light level in a game, for example.
You would define a structure
typedef struct { unsigned char level; /* light level 0-255 */ unsigned char prev; /* previous level (to implement a cancel) */ /* maybe more members here */ }LIGHTLEVEL;
Then in your windows procedure, the very first line retrieves this structure from the window.
You then have a series of sub-functions to respond to messages. A "draw" message would floodfill the window with grey of the appropriate colour. Left-clicks and right clicks would cause the level to change and send a redraw message. You might also want to respond to resize messages.
This is just about a perfect description of how I write Windows programs. I
would just add that I handle each message via a function with the same
prototype as the "standard" window procedure. This makes "message cracking"
very easy indeed. In fact, I use a macro to associate messages with
functions. My window procedures contain one physical line per message, plus
about half a dozen lines of overhead.
--
Richard Heathfield : bi****@eton.pow ernet.co.uk
"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
K&R answers, C books, etc: http://users.powernet.co.uk/eton
Richard Heathfield wrote: I would just add that I handle each message via a function with the same prototype as the "standard" window procedure. This makes "message cracking" very easy indeed. In fact, I use a macro to associate messages with functions. My window procedures contain one physical line per message, plus about half a dozen lines of overhead.
I like an array of function pointers
for handling numbered messages.
--
pete
pete wrote: Richard Heathfield wrote:
I would just add that I handle each message via a function with the same prototype as the "standard" window procedure. This makes "message cracking" very easy indeed. In fact, I use a macro to associate messages with functions. My window procedures contain one physical line per message, plus about half a dozen lines of overhead.
I like an array of function pointers for handling numbered messages.
Now there's an idea. :-)
--
Richard Heathfield : bi****@eton.pow ernet.co.uk
"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
K&R answers, C books, etc: http://users.powernet.co.uk/eton
Richard Heathfield <in*****@addres s.co.uk.invalid > wrote in message
news:3f******@n ews2.power.net. uk... pete wrote:
Richard Heathfield wrote:
I would just add that I handle each message via a function with the same prototype as the "standard" window procedure. This makes "message cracking" very easy indeed. In fact, I use a macro to associate messages with functions. My window procedures contain one physical line per message, plus about half a dozen lines of overhead.
I like an array of function pointers for handling numbered messages.
Now there's an idea. :-)
Until you actually look at the numerical values
of the e.g. MS Windows messages. The array would
be *very* large. :-)
-Mike
Mike Wahler wrote: Richard Heathfield <in*****@addres s.co.uk.invalid > wrote in message news:3f******@n ews2.power.net. uk...
pete wrote:
Richard Heathfield wrote:
I would just add that I handle each message via a function with the same prototype as the "standard" window procedure. This makes "message cracking" very easy indeed. In fact, I use a macro to associate messages with functions. My window procedures contain one physical line per message, plus about half a dozen lines of overhead.
I like an array of function pointers for handling numbered messages.
Now there's an idea. :-)
Until you actually look at the numerical values of the e.g. MS Windows messages. The array would be *very* large. :-)
But surely /never/ larger than 640K...
;-|
--
Morris Dovey
West Des Moines, Iowa USA
C links at http://www.iedu.com/c
Mike Wahler wrote: Richard Heathfield <in*****@addres s.co.uk.invalid > wrote in message news:3f******@n ews2.power.net. uk... pete wrote:
> Richard Heathfield wrote: > >> I would just add that I handle each message via a function >> with the same prototype as the "standard" window procedure. >> This makes "message cracking" very easy indeed. >> In fact, I use a macro to associate messages with functions. >> My window procedures contain one physical line per message, >> plus about half a dozen lines of overhead. > > I like an array of function pointers > for handling numbered messages.
Now there's an idea. :-)
Until you actually look at the numerical values of the e.g. MS Windows messages. The array would be *very* large. :-)
Well, not necessarily. You could easily map them: unsigned int
MapMessageToFun ction(MESSAGE m); Having said that, it does become less
tempting if you have to do that, since that's basically what the switch
does anyway.
--
Richard Heathfield : bi****@eton.pow ernet.co.uk
"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
K&R answers, C books, etc: http://users.powernet.co.uk/eton This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: tjones |
last post by:
Hi, I am guessing this is *THE* nntp newsgroup for C#?
I was hoping someone could point me in the right direction. Id like to find
employment in the IT industry as a programmer again. My background is a mix
of programming and networking. I have fairly decent skills in C++, Java and
ADA. I have been working as a network engineer on all flavours of windows,
lots of unix, mssql, cisco and others. Currently finishing a master of
science...
|
by: Siddharth Jain |
last post by:
Hello,
Could someone please tell me the history of GUI programming for
windows. In the early days, we had to write 100s of lines of code to
make a simple dialog box. Then along came MFC to simplify things. And
now, finally we have visual C#.NET.
Is that right? Is there anything else to it? Can someone please guide
me to some link form where I can get to know how things evolved from
pre-MFC to MFC to where we are now.
|
by: peter.mosley |
last post by:
I am trying to learn GUI programming in Python, but have to confess I
am finding it difficult.
I am not an experienced programmer - just someone who from time to
time writes small programs for my use. Over the years I have moved
from GWBASIC to QBASIC to Visual Basic, and now trying to move across
to a Linux platform. Python seems to be the best compromise between
the limitations of command line basic programming and the total...
|
by: Charles |
last post by:
I'd like to develop a simple cross-platform application in C++. I'd
like it to run in Windows, OS X, PC-BSD and Linux. From my research, it
seems I should use Qt or Gtk as a graphical library. Do you agree? Do
you have other tips? How Cygwin could help me? Thanks.
|
by: Giggle Girl |
last post by:
Hello there!
I am a User Interface Designer at a company that only makes web apps.
I am fluent in HTML, Javascript and Graphics programs. Now we are
making a compiled app with VS05 in C#, and I have to make the forms by
primarily drag'n'dropping controls using the WYSWIG editor built into
VS05. I have these questions:
QUESTION 1. Is there a horizontal rule, or vertical pipe, to visually
separate the layout?
| |
by: ifti_crazy |
last post by:
I am VB6 programmer and wants to start new programming language but i
am unable to deciced.
i have read about Python, Ruby and Visual C++. but i want to go
through with GUI based programming language like VB.net
so will you please guide me which GUI based language has worth with
complete OOPS Characteristics
will wait for the answer
|
by: deko |
last post by:
For building Windows desktop apps, the clear favorite is C#. But my clients
can't afford to buy Microsoft products. So I need to develop software for Linux
users and web applications.
In the open source world, what is the programmer's language of choice?
Judging by the number of members in each of these
http://www.google.com/Top/Computers/Programming/Languages/Open_Source/ user
groups, it looks like the top 3 open source languages...
|
by: hesamjamei |
last post by:
Hello!!
I am just about to break my computer......
Is a Window Programming issue .....compiler errors are as below :
1>------ Build started: Project: Project 78, Configuration: Debug Win32 ------
1>Compiling...
1>TextOut3.cpp
1>c:\documents and settings\seyed\my documents\game course\cpp2\chapter 5 cpp\projects\project 78\project 78\textout3.cpp(57) : error C2664: 'TextOutW' : cannot convert parameter 4 from 'const char *' to...
|
by: Netwatcher |
last post by:
Hello, i am new to c++ windows and DX programming, i encountered a code in the book stated in the title, which doesn't work for a reason, here is the code
// Beginning Game Programming
// Chapter 5 #edit: not 4, mistake in the title
// d3d_windowed program
//header files to include
#include <d3d9.h>
#include <time.h>
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |