Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- namespace MediaPlayer {
- using namespace System;
- using namespace System::ComponentModel;
- using namespace System::Collections;
- using namespace System::Windows::Forms;
- using namespace System::Data;
- using namespace System::Drawing;
- public ref class Form1 : public System::Windows::Forms::Form
- {
- public:
- Form1(void)
- {
- InitializeComponent();
- }
- protected:
- ~Form1()
- {
- if (components)
- {
- delete components;
- }
- }
- private: System::Windows::Forms::OpenFileDialog^ openFileDialog1;
- private: System::Windows::Forms::Button^ cmdopen;
- public: AxWMPLib::AxWindowsMediaPlayer^ axWindowsMediaPlayer1;
- private: System::Windows::Forms::Button^ media;
- public:
- public:
- private:
- protected:
- private:
- System::ComponentModel::Container ^components;
- #pragma region Windows Form Designer generated code
- void InitializeComponent(void)
- {
- System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(Form1::typeid));
- this->axWindowsMediaPlayer1 = (gcnew AxWMPLib::AxWindowsMediaPlayer());
- this->openFileDialog1 = (gcnew System::Windows::Forms::OpenFileDialog());
- this->cmdopen = (gcnew System::Windows::Forms::Button());
- this->media = (gcnew System::Windows::Forms::Button());
- (cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->axWindowsMediaPlayer1))->BeginInit();
- this->SuspendLayout();
- resources->ApplyResources(this->axWindowsMediaPlayer1, L"axWindowsMediaPlayer1");
- this->axWindowsMediaPlayer1->Name = L"axWindowsMediaPlayer1";
- this->axWindowsMediaPlayer1->OcxState = (cli::safe_cast<System::Windows::Forms::AxHost::State^ >(resources->GetObject(L"axWindowsMediaPlayer1.OcxState")));
- this->axWindowsMediaPlayer1->Enter += gcnew System::EventHandler(this, &Form1::axWindowsMediaPlayer1_Enter);
- this->openFileDialog1->FileName = L"Escolha uma música";
- resources->ApplyResources(this->openFileDialog1, L"openFileDialog1");
- this->openFileDialog1->InitialDirectory = L"C:/documentos";
- this->openFileDialog1->FileOk += gcnew System::ComponentModel::CancelEventHandler(this, &Form1::openFileDialog1_FileOk);
- resources->ApplyResources(this->cmdopen, L"cmdopen");
- this->cmdopen->Name = L"cmdopen";
- this->cmdopen->UseVisualStyleBackColor = true;
- this->cmdopen->Click += gcnew System::EventHandler(this, &Form1::cmdopen_Click);
- resources->ApplyResources(this->media, L"media");
- this->media->Name = L"media";
- this->media->UseVisualStyleBackColor = true;
- this->media->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
- resources->ApplyResources(this, L"$this");
- this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
- this->BackColor = System::Drawing::SystemColors::ActiveCaptionText;
- this->Controls->Add(this->media);
- this->Controls->Add(this->cmdopen);
- this->Controls->Add(this->axWindowsMediaPlayer1);
- this->Cursor = System::Windows::Forms::Cursors::Arrow;
- this->MaximizeBox = false;
- this->Name = L"Form1";
- this->ShowIcon = false;
- this->ShowInTaskbar = false;
- this->TopMost = true;
- (cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->axWindowsMediaPlayer1))->EndInit();
- this->ResumeLayout(false);
- }
- #pragma endregion
- private: System::Void axWindowsMediaPlayer1_Enter(System::Object^ sender, System::EventArgs^ e) {
- }
- private: System::Void openFileDialog1_FileOk(System::Object^ sender, System::ComponentModel::CancelEventArgs^ e) {
- }
- private: System::Void cmdopen_Click(System::Object^ sender, System::EventArgs^ e) {
- Visible = 0;
- openFileDialog1->ShowDialog();
- axWindowsMediaPlayer1->URL = openFileDialog1->FileName;
- Visible = 100;
- }
- private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
- this->axWindowsMediaPlayer1->Visible = 100;
- }
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment