GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 30-Sep-2006, 14:46
Robbie Dave Robbie Dave is offline
New Member
 
Join Date: Sep 2006
Posts: 2
Robbie Dave is on a distinguished road

MS Windows examples (know any?)


I am a novice C programmer who is attempting to create a custom window interface in C. Sounds horrible does not it?

I have access to www.msdn.com and also have Visual Studio 6 but I do not want to use VS6 for this application but a free C compiler.

I understand a window can be opened in any language such as C, C++, even 16 bit assembler. But, my main problem is finding resources for programming the functions of the window.

For example, there is a 'File Open' menu button, which opens the directory viewer, but when a file is selected - how do you reference the filename in the program?

Other such things are problematic for me. So, I ask, is there a good book that details microsoft windows programming with good examples? Preferably in C or C++.

Also, if you know of a website with good examples I could learn from it is much appreciated. I understand this is more of a microsoft question rather than a C++ one, but the program is being written in either C or C++ and I need to find a good resource for the window programming with the microsoft o/s.

I apologise to the moderators if this is a misguided post.

Regards,

RD
  #2  
Old 30-Sep-2006, 14:50
ubergeek ubergeek is offline
Regular Member
 
Join Date: Jan 2005
Posts: 775
ubergeek is a jewel in the roughubergeek is a jewel in the roughubergeek is a jewel in the rough

Re: MS Windows examples (know any?)


I always use Dev-C++, which is a fantastic free compiler based on g++. Unfortunately, development seems to be dead, but it is still awesome and stable (mostly ) and available here. For Windows programming, I know you've probably heard this before, but please get some experience in console programming under your belt before you attempt this. It will prevent later confusion with basic programming and language concepts (for example the file input/output process, which you asked about, can be done in the console much the same way as in Windows, but if you understand how it worked int he console it will be easy to adapt it to GUI programming -- basically, just changing the way the user selects the filename and the way the program displays the text, if it does that). Having said that, I started with this tutorial and there are many more to be found with that wonderful tool, Google.
  #3  
Old 30-Sep-2006, 14:59
Robbie Dave Robbie Dave is offline
New Member
 
Join Date: Sep 2006
Posts: 2
Robbie Dave is on a distinguished road

Re: MS Windows examples (know any?)


Wow! That is one awesome link Ubergeek.

I was searching on amazon for windows API programming and the books are expensive as hell. But that tutorial is basically what a lot of the books were covering.

I have done some console programming - where my C programs execute from the command prompt if that's what you mean? - but accepting input from the command line as parameters is one thing compared to learning about how windows file dialog box passes variables around inside itself.

I really should learn about windows programming but I was stuck in the past making command line programs.

Hey, thanks again for that link - its excellent and just what I was after in a tutorial for making windows.

Regards,

RD
  #4  
Old 30-Sep-2006, 21:14
davis
 
Posts: n/a

Re: MS Windows examples (know any?)


Quote:
Originally Posted by Robbie Dave
Wow! That is one awesome link Ubergeek.

I was searching on amazon for windows API programming and the books are expensive as hell. But that tutorial is basically what a lot of the books were covering.

I have done some console programming - where my C programs execute from the command prompt if that's what you mean? - but accepting input from the command line as parameters is one thing compared to learning about how windows file dialog box passes variables around inside itself.

I really should learn about windows programming but I was stuck in the past making command line programs.

Hey, thanks again for that link - its excellent and just what I was after in a tutorial for making windows.

Regards,

RD


It sounds like you want to use the Win32 SDK to write your programs. I haven't used a freeware compiler to build Win32 programs, but I can tell you that there are a few that exist. Open Watcomm is probably one of them, but I don't know for sure...never wrote any Win32 apps with it. Another purchase-ware, but low enough cost is the Borland v5.x compiler that comes with the book as part of a "kit." Search Amazon for it. Basically, you buy the book and get the compiler free. I think the book costs about $55, but you can probably find a used one for half that. If not Amazon, try Powells.com.

Writing Win32 programs is fairly simple for fairly simple programs. The File Open Dialogs are part of the Common Dialogs library. Basically, you need to link against that library in order to use the common dialogs, which include the File Open/Save, Print, Color Chooser, Date/Time Chooser, Font Chooser, etc. dialogs. Most 3rd party (non Micro$haft) libraries do not use the M$ libraries. They use their own proprietary libraries so that the look-n-feel is "different." I use VS6.0 for my Win32 programming, so I can't really tell you how to use someone else's compiler for it. The last time I wrote a Win16 program, I used VC++ v4.something, its been so long that I'm not even sure if that is it. I still have VC++ since version 1.0 and MSC/C++ since version 3 or 4, I don't remember and I don't think that I've loaded a version before v7 in many, many years. I did almost all of my early DOS programming on Borland's "Turbo C" compiler until 1990 when Turbo C++ 1.0 came out. I've been using some form of C++ ever since. About a year and a half later, Charles Petzold came out with a book called Programming Windows (version 1.0 of the book ) that was specific to Windows v2.0, if I remember correctly. I had the book many years ago, but no longer have it so my brain is fairly foggy on the exact dates and versions.

However, if you are interested in programming to the Win32 SDK, you can't go too far wrong (except that I dislike the coding style of Petzold's books) with Programming Windows 95. You're likely to get it at a fairly deep discount due to the age of the book, but most of it is fairly useful today. The only major areas of "detraction" that I would point out are in the "NT" system areas and in the UNICODE areas. Otherwise, most of it will be completely transparent. I have literally dozens of books on various Windows programming topics, but I tend not to look at them very much any more. What I do is create a directory structure with all of the "book code" from each of the books in it so that I can easily grep through the path looking for the Win32 example code that meets what I'm trying to accomplish. It is fairly challenging to remember somewhat over 5000? API functions in the modern Win32...but if you know about what to look for, regular expressions will find it in the code base. My "BookCode" directory is about 160MB compressed, so it represents a LOT of books on a wide variety of topics mostly directly related to M$ "technologies" including COM, ATL, MFC, Win32, threading, sockets, etc.etc.etc. I also have a path off of it for a lot of "template" (not to be confused with STL templates) or "boilerplate" code that I've written over the years for various programmatic elements including MDI, Doc/View, threading and networking, etc. all in Win32.

I guess that my point in telling you all of this is that there is a lot to programming for Windoze. A few tutorials may get you going, but they're no replacement for good books on the topics. The good thing is that many publishers now offer their "author's book code" online for free download to save them the costs associated with distributing media with the book. If you search around O'Reilly, Wrox, Prentice Hall, Wiley, Addison Longman Wesley, SAMS and others, you can suck down a lot of "free code" to add to your own "BookCode" path. Then, start grepping through it with even the most basic Win32 API such as "CreateWindow." You will find (numerous) hits that you can review and see what the author did so that you can figure out what you want to do with your own code.


:davis:
  #5  
Old 02-Oct-2006, 12:30
Alloishus Alloishus is offline
New Member
 
Join Date: Sep 2006
Posts: 15
Alloishus is on a distinguished road

Re: MS Windows examples (know any?)


Charles Petzold is on the 5th Edition of Programming Windows. Definitely worth buying since he covers Unicode and is more focused on WinNT than previous versions.

The first edition might make you pull your hair out as some things do not work anymore.
  #6  
Old 02-Oct-2006, 12:57
davis
 
Posts: n/a

Re: MS Windows examples (know any?)


Quote:
Originally Posted by Alloishus
Charles Petzold is on the 5th Edition of Programming Windows. Definitely worth buying since he covers Unicode and is more focused on WinNT than previous versions.

The first edition might make you pull your hair out as some things do not work anymore.

I think that the first edition of Programming Windows was written in 1988, so I'm guessing that it won't be much help to anyone...what do you think? The 2nd edition of Programming Windows was released in 1990. The 3rd edition of "Programming Windows" was called Programming Windows 3.1 and was released in 1992. And, since that is obviously still Win16, yes, "some things" do not work very well any more with the first edition.

The "first edition" for Win32 was Programming Windows 95, but is known as the 4th edition of Programming Windows. There are so many things that "do work" in it, that for "Amazon new and used from $0.40" is probably a reasonable choice for a low-budget way to learn the fundamentals of Win32.

In fact, one can go to Petzold's web site and download the source code to his books, which is a lot of help if you can read the code reasonably well enough to see what he's doing.

www.charlespetzold.com


:davis:
  #7  
Old 03-Oct-2006, 18:16
Alloishus Alloishus is offline
New Member
 
Join Date: Sep 2006
Posts: 15
Alloishus is on a distinguished road

Re: MS Windows examples (know any?)


Quote:
Originally Posted by davis
I think that the first edition of Programming Windows was written in 1988, so I'm guessing that it won't be much help to anyone...what do you think? The 2nd edition of Programming Windows was released in 1990. The 3rd edition of "Programming Windows" was called Programming Windows 3.1 and was released in 1992. And, since that is obviously still Win16, yes, "some things" do not work very well any more with the first edition.

:davis:

Well, Windows does have a sort of backward compatibility. It just isn't what you want to learn with, since most of those functions are obsolete in favor of Win32 specific functions. The closer the book is to the 5th edition, the more relevance you get (if you are progamming for Win32).

If you want to be on the latest, Charles' book, Windows Forms, covers the latest basics for Win programming (really helpful in an enterprise environment that uses .NET).
  #8  
Old 03-Oct-2006, 19:35
davis
 
Posts: n/a

Re: MS Windows examples (know any?)


Quote:
Originally Posted by Alloishus
Well, Windows does have a sort of backward compatibility. It just isn't what you want to learn with, since most of those functions are obsolete in favor of Win32 specific functions. The closer the book is to the 5th edition, the more relevance you get (if you are progamming for Win32).

If you want to be on the latest, Charles' book, Windows Forms, covers the latest basics for Win programming (really helpful in an enterprise environment that uses .NET).

Somebody help me here, but I seem to recall something to the effect that the Win16 "thunking" layer was removed at the end of WinNT, which I think means that in XP it is gone, but in Win2K it is still present. Can anyone confirm or deny this info?


:davis:
  #9  
Old 05-Oct-2006, 06:54
Alloishus Alloishus is offline
New Member
 
Join Date: Sep 2006
Posts: 15
Alloishus is on a distinguished road

Re: MS Windows examples (know any?)


I am not familiar with the word "thunking"...so I am not sure what you are speaking of.

But, many Win16 calls have been changed in the current Win32 API (and these calls are changed again with Win64 API calls). So, I guess you are right in that you cannot really program Win16 with the current Win32 API. I do not think it is present even in Win2k.

However, you could run an emulator (VirtualPC, VMWare, etc) and load Windows 3.1 on it or whatever and the programs will run. WinXP only supports Win32 calls as far back as Win95, and even then really only has sketchy functionality.

Is that what you were asking?
  #10  
Old 05-Oct-2006, 09:53
davis
 
Posts: n/a

Re: MS Windows examples (know any?)


Quote:
Originally Posted by Alloishus
I am not familiar with the word "thunking"...so I am not sure what you are speaking of.

www.google.com

...which comes up with:

www.microsoft.com

...which answers (part of) my own question about still being around on Win2K.


:davis:
 
 

Recent GIDBlogInstall Adobe Flash - Without Administrator Rights by LocalTech

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Command & Conquer 95 under XP dexter Computer Software Forum - Games 42 20-Sep-2008 13:30
Is my windows installation doomed? Rizzon Computer Software Forum - Windows 1 04-Mar-2006 18:12
printer / font color / windows programming nicolas_qc MS Visual C++ / MFC Forum 0 03-Jan-2006 23:13
Trouble with Windows XP vsseym Computer Software Forum - Windows 29 12-Aug-2004 03:56

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 05:52.


vBulletin, Copyright © 2000 - 2010, Jelsoft Enterprises Ltd.