C++ to Windows application

Sep 7, 2009 at 11:04pm
Hi
I’m fairly good at c++ and I’ve just wrote a little program in Dev c++ and it works fine however, I would like to to write the program as a windows application in witch I have little or no knowledge of. What I’m asking is a short label list of the key elements of a windows application code Witten in dev c++. So far I know that there should be a main and maybe resource.h. but I’m uncertain of the code structure.

Here bellow you can see a copy of my c++ source code and executable file (exe) so you can see exactly what I’m talking about.Any kinda of help would be appreciated

Anticipated thanks

click
http://www.mediafire.com/?imwizotznjm

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#include <iostream>
#include <windows.h>
#include <stdlib.h>
#include <sstream>
#include <iomanip>
#include <stdio.h>
#include <cmath>
#include <cstdlib>
#include <conio.h>

using namespace std;


int  main()
{
     int time,hour,min,sec;
     system("color 3f");     
     char choice;
     for (;;){
     do {      
               cout<< "\n";          
                             
               cout<<"|--------------------------------------|\n";
               cout<<"|  Welcome to the The time calculator  |\n";
               cout<<"|               By                     |\n";
               cout<<"|          **************              |\n";
               cout<<"|                                      |\n";
               cout<<"|  Please choose an operation          |\n";
               cout<<"|  1 - To onvert into Minutes          |\n";
               cout<<"|  2 - To Convert into Seconds         |\n";
               cout<<"|  q - To quit program                 |\n";
               cout<<"|--------------------------------------|\n";
               cin>> choice;
 } while (choice == '1' &&choice == '2' && choice != 'q');
     if (choice == 'q') break;
    
    switch (choice) {    
             
              case '1': 
                       cout<<"Enter time in seconds: \t";         
                       cin>>time;
                       hour=     time/3600;
                       time=     time%3600;
                       min=      time/60;
                       time=     time%60;
                       sec=      time;
                       cout<<"\n\nThe time is : "<<"\t\t" <<hour<<"::"<<min<<"::"<<sec ;
                       cout<< "\n";                          
                       break;
                       
             case '2':
			           
                       cout<<"Enter time in minutes: \t";
                       cin>>time;                       
                       hour=     time/60;
                       time=     time%60;
                       min=      time/60;
                       time=     time%60;
                       min=      time;
                       sec=      time/60;
                       cout<<"\n\nThe time is : "<<"\t\t" <<hour<<"::"<<min<<"::"<<sec ;
                       cout<< "\n";
                       break;

                       
             case 'q':
                                   
                       break;
                 
             default:     
                       cout<< "That is not an option";
                       cout<< "Make a valid selection from the main menu \t";

}   

}                                        
  return 0;
 stop;
}



Sep 7, 2009 at 11:34pm
I’m fairly good at c++


Why have you included all these:

1
2
3
4
5
6
7
8
9
#include <iostream>
#include <windows.h>
#include <stdlib.h>
#include <sstream>
#include <iomanip>
#include <stdio.h>
#include <cmath>
#include <cstdlib>
#include <conio.h> 


then when they're not needed?
Sep 8, 2009 at 7:12am
You will use event system 90% of the time, and that is a new concept you will have to become familiar with. Some functions are straight-forward tho. Take a look at the MSDN library on Win32 programming.

Also, I'm assuming that you'd like to create user interface programs with windows. Search for some tutorials, there are good ones you can find with a simple google query.
Sep 8, 2009 at 8:45am
Check out "theForger's Win32 API Programming Tutorial" at http://www.winprog.org/tutorial/

also, dev-c++ has a template for a windows/win32 app (File>New>Project>Windows Application) <- off the top of my head...
Sep 8, 2009 at 4:36pm
Use Visual Studio and use the Win32 Wizard (C/ Win32 generated code)
Sep 11, 2009 at 12:49am
By the way
cout<<"| 1 - To onvert into Minutes |\n";

onvert should be convert :D

(line 29)
Topic archived. No new replies allowed.