Vcoderz Community
We create websites that have it all, beauty & brains
Lebanon Web Design & Development - Coddict
 

Go Back   Vcoderz Community > Computer Zone > Computers & Information Technologies > E-Learning Center

Notices

E-Learning Center E-Learning tutorials and competitions.

Reply
 
Share Thread Tools Search this Thread
Old 01-11-2009   #1
Google

 
Google's Avatar
 
Last Online: 05-30-2013
Join Date: Jan 2008
Posts: 1,788
Thanks: 10,018
Thanked 1,100 Times in 651 Posts
Groans: 1
Groaned at 6 Times in 6 Posts
Default Free Patriotic Movement Tone In C++

In my free time, I coded this small program that generates the FPM tone using the beep() function. This is the code:

Code:
//Free Patriotic Movement Tone By Edgard Chammas
#include <windows.h>
#include <time.h>

void sleep(unsigned int mseconds);

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)

{
        Beep( 750, 200);
        Beep( 750, 200);
        Beep( 750, 200);
        sleep(100);
        Beep( 750, 400);
        sleep(50);
        Beep( 750, 500);
        sleep(200);
        Beep( 750, 300);
        Beep( 750, 300);
        Beep( 750, 300);

     return 0;
}

void sleep(unsigned int mseconds)                                
{
    clock_t goal = mseconds + clock();
    while (goal > clock());
}
Now your PC can be upgraded to support GMA!

Note: The compiled executable file is here <> in case you don't have a compiler...



Google is offline   Reply With Quote
The Following User Says Thank You to Google For This Useful Post:
Kingroudy (01-11-2009)
Old 01-11-2009   #2
samrieh
Registered Member
 
samrieh's Avatar
 
Last Online: 04-06-2014
Join Date: Apr 2006
Posts: 314
Thanks: 72
Thanked 84 Times in 55 Posts
Groans: 0
Groaned at 0 Times in 0 Posts
Default Re: Free Patriotic Movement Tone In C++

sorry because I dont know in the computer stuff, so what do we do in order to get the tone for that?
samrieh is offline   Reply With Quote
Old 01-11-2009   #3
Google

 
Google's Avatar
 
Last Online: 05-30-2013
Join Date: Jan 2008
Posts: 1,788
Thanks: 10,018
Thanked 1,100 Times in 651 Posts
Groans: 1
Groaned at 6 Times in 6 Posts
Default Re: Free Patriotic Movement Tone In C++

Quote:
Originally Posted by samrieh View Post
sorry because I dont know in the computer stuff, so what do we do in order to get the tone for that?
It seems that you didn't download the zip file containing the program...
This is the link:
http://www.4shared.com/file/80106952/f080bb5f/FPM.html

Edit:
You can put the FPM.exe in a static place and make it run every time you logon to your user by this batch file:

Code:
@ECHO OFF
REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run" /V "FPM" /D "C:\LOCATION_ON_THE_HARD_DISK\FPM.exe" /F
Save the code above as whatever.bat and run it once (you can delete it after)...

Last edited by Google; 01-11-2009 at 11:21 PM.
Google is offline   Reply With Quote
Old 01-11-2009   #4
Tawa
 
Tawa's Avatar
 
Last Online: 1 Week Ago
Join Date: Mar 2006
Posts: 6,245
Thanks: 2,120
Thanked 3,365 Times in 1,740 Posts
Groans: 29
Groaned at 44 Times in 35 Posts
Default Re: Free Patriotic Movement Tone In C++

It Didn't Work For Me, I Downloaded The Compiled File You Uploaded, And I Hear Nothing

I Am Using Visual C++ 2008, You Have To Add #include <stdafx.h> As A PreCompiler Library, I Don't Know Why Though.
And The:
int
WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) Didn't Work For Me, I Get This:
Code:

1>Linking...
1>MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup
1>C:\Studies\C++ Projects\Test\Debug\Test.exe : fatal error LNK1120: 1 unresolved externals
1>Build log was saved at "file://c:\Studies\C++ Projects\Test\Test\Debug\BuildLog.htm"
1>Test - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


I Tried The int main(void), It Worked.

Any Idea?
__________________
What we do in life, echoes in eternity.
Tawa is offline   Reply With Quote
Old 01-11-2009   #5
Malek
Registered Member
Tetris Champion
 
Malek's Avatar
 
Last Online: 11-04-2014
Join Date: Sep 2006
Posts: 1,302
Thanks: 102
Thanked 1,147 Times in 619 Posts
Groans: 8
Groaned at 1 Time in 1 Post
Default Re: Free Patriotic Movement Tone In C++

I'm using Visual C++ 2005, and i got this :

Code:
1>Compiling...
1>Test.cpp
1>.\Test.cpp(2) : fatal error C1083: Cannot open include file: 'windows.h': No such file or directory
1>Build log was saved at "file://e:\Documents\Visual Studio 2005\Projects\Test\Test\Debug\BuildLog.htm"
1>Test - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Malek is offline   Reply With Quote
Old 01-11-2009   #6
Google

 
Google's Avatar
 
Last Online: 05-30-2013
Join Date: Jan 2008
Posts: 1,788
Thanks: 10,018
Thanked 1,100 Times in 651 Posts
Groans: 1
Groaned at 6 Times in 6 Posts
Default Re: Free Patriotic Movement Tone In C++

@Tawa
This is a windows 32-bit application and not a console application
To solve your problem, you either have to make a win32 project and put the code in, OR JUST create the cpp file and then in microsoft visual c++ go:
Project > Settings
In the C/C++ tab change the preprocessor definitions from WIN32,_DEBUG,_CONSOLE,_MBCS to WIN32, _DEBUG,_WINDOWS
In the Link tab change /subsystem:console in the project options to /subsystem:windows
And this will solve the problem.

@Malek
You have to download and install the SDK platform. It is not included by default in VC2005. That's why the compiler cannot find that header file.
Edit: If you want, download windows.h from the internet and put it in the libraries directory.


By the way, I'm using visual c++ 6.0

Last edited by Google; 01-11-2009 at 11:41 PM.
Google is offline   Reply With Quote
Old 01-12-2009   #7
Tawa
 
Tawa's Avatar
 
Last Online: 1 Week Ago
Join Date: Mar 2006
Posts: 6,245
Thanks: 2,120
Thanked 3,365 Times in 1,740 Posts
Groans: 29
Groaned at 44 Times in 35 Posts
Default Re: Free Patriotic Movement Tone In C++

Lol, I Did Man, Nothing Shows Up, And I Hear Nothing
__________________
What we do in life, echoes in eternity.
Tawa is offline   Reply With Quote
Old 01-12-2009   #8
Google

 
Google's Avatar
 
Last Online: 05-30-2013
Join Date: Jan 2008
Posts: 1,788
Thanks: 10,018
Thanked 1,100 Times in 651 Posts
Groans: 1
Groaned at 6 Times in 6 Posts
Default Re: Free Patriotic Movement Tone In C++

1- I'm glad to hear that the code is compiled with you!
2- nothing is supposed to show up unless you do it like you did it before (console mode, with int main() instead of int WINAPI WinMain... )

3- Now we come to the more interesting part that your PC "hane" and does not beep / well it is either your PC's internal speaker is damaged or simply your ears are damaged
The beep sound volume depends on each PC...


Google is offline   Reply With Quote
Old 01-12-2009   #9
Tawa
 
Tawa's Avatar
 
Last Online: 1 Week Ago
Join Date: Mar 2006
Posts: 6,245
Thanks: 2,120
Thanked 3,365 Times in 1,740 Posts
Groans: 29
Groaned at 44 Times in 35 Posts
Default Re: Free Patriotic Movement Tone In C++

I Think My Laptop Doesn't Have An Internal Speaker.

And I Don't Think It's Damaged Cause I Never Heard A Beep From An Internal Speaker. And The Laptop Is Still Pretty New.
__________________
What we do in life, echoes in eternity.
Tawa is offline   Reply With Quote
Reply

  Vcoderz Community > Computer Zone > Computers & Information Technologies > E-Learning Center

Tags
free, movement, patriotic, tone



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:41 PM.


Lebanon web design and development
Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Share