Jump to content
Tuts 4 You

How to play a chiptune and show a form in visual c++


PiZZAMiN

Recommended Posts

So I have a visual c++ keygen template, but it's just a terminal. :confused: It's for visual c++ 2010, but I can't make the main show the form and play the chiptune.

The original main looks like this

#include <stdafx.h>
#include <iostream>
#include <windows.h>
#include "monday.h" //chiptune header file,change to any if you want
#include "ufmod.h"
#include <mmsystem.h>
#include "Form1.h"
HWAVEOUT* hWave=0;#pragma comment(lib,"winmm.lib")
#pragma comment(lib,"ufmod.lib")using namespace std;int main(array<System::String ^> ^args)
{
hWave=uFMOD_PlaySong(table, (void*)sizeof(table), XM_MEMORY);
system("PAUSE");
return EXIT_SUCCESS;
}

and this is what a normal one looks like that only shows a form

// form1.cpp : main project file.#include "stdafx.h"
#include "Form1.h"using namespace form1;[STAThreadAttribute]
int main(array<System::String ^> ^args)
{
// Enabling Windows XP visual effects before any controls are created
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false); // Create the main window and run it
Application::Run(gcnew Form1());
return 0;
}

You would think to just put it all together, but no. It doesn't like it. So can someone show me how to do this? If I have multiple c++ files in the runtime can i run the form1.cpp inside the main run? I am so confused. :( Go easy and explain things; I am a visual basic programer so I understand most things.

Link to comment

"It doesn't like it"

I'm afraid this ain't cuttin it

You might wanna share the errors it(?) is giving you...

What's in the main window? Where's the code handling the main window? Where is your final code ("put it all together")

:worthy:

Also, this looks like C++ .NET or some sick MFC **** to me, I'd go as far as saying this complicates things ;)

Link to comment

"It doesn't like it"

I'm afraid this ain't cuttin it

You might wanna share the errors it(?) is giving you...

Here is my compile log

------ Build started: Project: test, Configuration: Debug Win32 ------
test.cpp
test.cpp(17): error C2653: 'Application' : is not a class or namespace name
test.cpp(17): error C3861: 'EnableVisualStyles': identifier not found
test.cpp(18): error C2653: 'Application' : is not a class or namespace name
test.cpp(18): error C3861: 'SetCompatibleTextRenderingDefault': identifier not found
test.cpp(21): error C2653: 'Application' : is not a class or namespace name
test.cpp(21): error C2061: syntax error : identifier 'Form1'
test.cpp(21): error C3861: 'Run': identifier not found
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
What's in the main window? Where's the code handling the main window? Where is your final code ("put it all together")

Here is the "all put together"

#include <stdafx.h>
#include <iostream>
#include <windows.h>
#include "thehive.h" //chiptune header file,change to any if you want
#include "ufmod.h"
#include "form1.h"
#include <mmsystem.h>
HWAVEOUT* hWave=0;#pragma comment(lib,"winmm.lib")
#pragma comment(lib,"ufmod.lib")using namespace std;int main()
{
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false); // Create the main window and run it
Application::Run(gcnew Form1());
hWave=uFMOD_PlaySong(table, (void*)sizeof(table), XM_MEMORY);
system("PAUSE");
return EXIT_SUCCESS;
}
Also, this looks like C++ .NET or some sick MFC **** to me, I'd go as far as saying this complicates things ;)

As I stated above, this is Microsoft Visual C++ :thumbsup::down:

Link to comment

Visual C++ is NOT a programming language, it's an IDE. It supports C++ and C++ .NET, also you can use MFC with it. All three of them provide different ways of coding a GUI.

The code you posted above definately is C++ .NET but I'm not sure what namespaces you're trying to access there, not much of a .NET coder myself.

I'd guess you need a WinMain instead of main, and you don't seem to have any dialog/form defined. What do you expect to pop up on the screen :o

Try creating a new GUI project from a template, that should get you started.

Link to comment

There's no way around what?

You can't just download stuff from somewhere, paste it one way or another and expect it to work. That doesn't even work in VB ;D

I dunno how hard you want this, but looking at your response tells me you didn't really think this through. Learning a new programming language and a new GUI API at that takes time.

You can make awesome keygens in C++ but you have to put in work lol

Link to comment

Well all I want right now is a template that pops up form1 and plays a chiptune in the background. Then I can add stuff and edit it and learn. That's all I'm asking for. None of my attempts worked, but I know there are hundreds up people that know how.

Link to comment

your code seems to be some strange mixture of c++/managed c++/MFC... :rolleyes:

If you are using the express edition of microsofts IDE, you cant really create native guis, as no resource editor is included.

this is a nice tut for win32 gui coding:
/>http://www.winprog.org/tutorial/

But i am afraid you`ll need a c++ beginners book, too.

YOu can also look at other sources and learn from that...

btw, which tool did you use to convert the .xm fileto a char[] array?

Link to comment

Dear,

Here is a complete project, I think you should look this.

Coded by Indian guy Cyclops, really awesome Keygen template in GUI with custom buttons, region and XM play support.


/>http://forum.tuts4you.com/index.php?showtopic=18861

Hope this will help you. :thumbsup:

Regards,

Blue Indian

Team IREC

Link to comment

Yes Blue, its really a good project on GUI skinning in Visual C++ by Brother Cyclops, that I was looking for and wishing myself to create GUI Skinning in no time. Have a great fun.

Link to comment
:woot: Ok guys I figured it out, make your cool form whatever. after that find or make a wav, mp3, ogg, mod, xm, s3m etc. Now get this thingy called PunchIt made by condzero and open it. Now select your files, but one important thing! Set compress outputand overwrite existing to N !!! Then click PunchIt and save the file. It usally doesn't work unless you select a custom icon which you can extract! This usally works on a packed exe. Mod please edit this part out if it is not allowed, but I made uPPP have a chiptune! All credits fly out to UFO-PU55Y for original uppp and whoever made the chiptune!!! uPPP With music
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...