NO

Author Topic: Windows program to copy a file  (Read 11877 times)

tpekar

  • Guest
Re: Windows program to copy a file
« Reply #15 on: February 21, 2012, 11:01:17 PM »
CommonTator-thanks so much for the sample program!  I have studied it a lot and learned much from it.  I adapted it to what I needed and learned much in the process.  It looked like you used a resource file to build your window.  The tutorials I have read say I must first create the class.  But it looks like the resource file side steps that?  Am I correct in assuming you cannot use the resource file method if you need to create your window at execution time rather than at compile time?

Timovl-thanks for your answers, which have helped me know where to start.  Being new to windows programming, it helped me write my first windows program which actually worked.

I am sure my technique will get better as I learn more.  The problem with so many tutorials is that once you get past the "hello world" program, the examples include only code snippets instead of whole programs, which takes them out of context.

CommonTater

  • Guest
Re: Windows program to copy a file
« Reply #16 on: February 22, 2012, 01:10:23 AM »
CommonTator-thanks so much for the sample program!  I have studied it a lot and learned much from it.  I adapted it to what I needed and learned much in the process.  It looked like you used a resource file to build your window.  The tutorials I have read say I must first create the class.  But it looks like the resource file side steps that?  Am I correct in assuming you cannot use the resource file method if you need to create your window at execution time rather than at compile time?

It depends what you are doing... For a single window program like the filecopy example, you can use the dialog approach that I used.  It's quick simple and efficient.  For more complex programs where you are opening a main window and using dialogs on top it is often better to register a class and use CreateWindow()... particularly if the window is to be resizeable by the user or your program incorporates more than one window.  Of course you still use windows controls for your I/O work just like in a dialog based program, it's just that you're doing it manually at run time; like in the editor example I gave you.

Quote
I am sure my technique will get better as I learn more.  The problem with so many tutorials is that once you get past the "hello world" program, the examples include only code snippets instead of whole programs, which takes them out of context.

Windows GUI is advanced programming. Those tutorials make certain assumptions about your level of skill that should mostly be appropriate.  For example the Forger's Winprog tutorial gives you the basics for creating a simple window then shows you code you can add or changes to the code to help you as your knowledge increases.  Windows programs are more complex and they all incorporate certain core functionalities that you have to understand first. To repeatedly publish entire programs would bloat the tutorial signficantly.  The assumption is that you understand programming well enough to follow that...

Now, in all respect...
1) Since your first try at this was something of a disaster due to your strong focus on this one program.  I would strongly suggest that you set yourself down and follow the tutorial again... no specific program in mind... and try to understand the concepts it is teaching you.  Especially pay attention to the concept of windows controls... Almost all I/O in windows is done via controls and you need to understand them properly if you are to write reasonable code.

2) Get and install a copy of the Windows SDK  Like the Pelles C help file, this is going to be your best friend when writing GUI code.  It discloses the entire Windows API with full explainations of each function.  Get familiar with it's contents and know now to look things up as you work... you will be very happy you did.
 
3) One thing I can promise you... you're not going to "dumb ass" your way through advanced programming by copying and adapting snippets and examples.  One day you'll be facing a problem where there are no precidents for you to "borrow" and if you can't do it from a blank page up, you're screwed. "Scoop and Poop" programming is strictly beginner stuff, my friend.
 
This Link contains a lot of useful information for GUI mode programming.
 
 
« Last Edit: February 22, 2012, 01:20:47 AM by CommonTater »