Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > Visual C++ 2005
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Visual C++ 2005 For discussion of Visual C++ 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual C++ 2005 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old April 8th, 2010, 03:53 AM
Registered User
 
Join Date: Apr 2010
Location: Chennai
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Question C++ program console to win32 how to do code?

Good Morning to every body! I am a hobby programmer and join in this forum today. I have code a program of stop watch in c++ and compiled and run well.but I want to see the Win32 application istead of console appln. Please anybody can help how to code for win32? The source code of console appln for stop watch as given below.

code
// example2.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <iostream>

using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{int ms=0,s=0,m=0;
char stop;
cout << endl << "Hello ! This is a Stopwatch application programmed by T.Kannan" << endl;
cout << endl << " Press Q to Quit else any Charactor followed by enter Key to start STOP WATCH" << endl;
cin >> stop;
while(stop != 'Q')
{
do
{
for(ms=1; ms<=100; ms++)
{
cout << " Minutes : Seconds : Milliseconds";
s=s+(ms/100);
m=m+(s/60);
cout << endl << endl << " " << m << " : " << s << " : " << ms << endl;
if(s==60)s=0;
printf("\nBY");
printf("\n");
printf("\nT.KANNAN");
system ("CLS");
}
}while(m<1);
ms=0;
s=0;
cout << endl;
cout << endl << "Hello ! 1 Minute duration gone programmed by T.Kannan" << endl << endl;
cout << "M: " << m;
cout << " S: " << s;
cout << " MS: " << ms << endl << endl;
m=0;
cout << " Press Q to Quit else any Charactor followed by enter Key " << endl;
cin >> stop;
}

return 0;
}
/code
Reply With Quote
  #2 (permalink)  
Old September 7th, 2010, 03:34 AM
Authorized User
Points: 100, Level: 1
Points: 100, Level: 1 Points: 100, Level: 1 Points: 100, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2009
Posts: 26
Thanks: 1
Thanked 1 Time in 1 Post
Post

My best recommendation is to take a look at this book :

MS Press - Programmming WindowsBy Charles Petzold

This book goes through win32 API programming quickly and very efficiently using C language.I couldn't find any better source for win32 except this one.

Best luck
Reply With Quote
  #3 (permalink)  
Old March 30th, 2011, 07:17 AM
Registered User
 
Join Date: Dec 2010
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

download vc++ from microsoft and use it's help or msdn.
__________________
I thought may be some one will visit here in need of solution.

Regards
KFateh
Reply With Quote
  #4 (permalink)  
Old April 1st, 2011, 01:15 AM
Registered User
 
Join Date: Dec 2010
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by dreamboy View Post
Good Morning to every body! I am a hobby programmer and join in this forum today. I have code a program of stop watch in c++ and compiled and run well.but I want to see the Win32 application istead of console appln. Please anybody can help how to code for win32? The source code of console appln for stop watch as given below.

code
// example2.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <iostream>

using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{int ms=0,s=0,m=0;
char stop;
cout << endl << "Hello ! This is a Stopwatch application programmed by T.Kannan" << endl;
cout << endl << " Press Q to Quit else any Charactor followed by enter Key to start STOP WATCH" << endl;
cin >> stop;
while(stop != 'Q')
{
do
{
for(ms=1; ms<=100; ms++)
{
cout << " Minutes : Seconds : Milliseconds";
s=s+(ms/100);
m=m+(s/60);
cout << endl << endl << " " << m << " : " << s << " : " << ms << endl;
if(s==60)s=0;
printf("\nBY");
printf("\n");
printf("\nT.KANNAN");
system ("CLS");
}
}while(m<1);
ms=0;
s=0;
cout << endl;
cout << endl << "Hello ! 1 Minute duration gone programmed by T.Kannan" << endl << endl;
cout << "M: " << m;
cout << " S: " << s;
cout << " MS: " << ms << endl << endl;
m=0;
cout << " Press Q to Quit else any Charactor followed by enter Key " << endl;
cin >> stop;
}

return 0;
}
/code
Other then your name what you actually wrote in this code?
Your code remindes me 286, 386 era when I started learning C language.
It's printf() for screen output and system() for calling DOS commands or any executable eg .exe,. com, .bat etc.
Anyway code is not good.
Run and check how many minutes it takes to show 1 minutes on different PCs with processors of different speed.
It is not stop watch. It runs for so called 1 minute under all cercumtences.
There was no need of clearing screen in inner loop that also using system("CLS"). Use gotoxy() instead and over wright new time over old time..

Anyway from where ever you start keep trying.
It is good to search and read code on net.
Not only try them also try to modify them. This way you will learn.
__________________
I thought may be some one will visit here in need of solution.

Regards
KFateh
Reply With Quote
Reply


Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Win32 Console Apllication with a winform raghaw WinForms/Console Application Design 0 October 7th, 2008 07:34 AM
take arguments when running program in console iulian C++ Programming 8 January 16th, 2007 08:17 AM
Pls Help Me Check This Code - Win32 ck C++ Programming 4 January 12th, 2005 11:14 PM
Pls Help Me Check This Code - Win32 ck Visual C++ 0 December 29th, 2004 11:50 AM
Need help in writing a C program using win32 API rameshbabumv C++ Programming 0 March 10th, 2004 04:46 AM



All times are GMT -4. The time now is 06:34 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.