whiplk

wii-MédiaPlay

Jan 26th, 2012
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.92 KB | None | 0 0
  1. #pragma once
  2.  
  3.  
  4. namespace MediaPlayer {
  5.  
  6.     using namespace System;
  7.     using namespace System::ComponentModel;
  8.     using namespace System::Collections;
  9.     using namespace System::Windows::Forms;
  10.     using namespace System::Data;
  11.     using namespace System::Drawing;
  12.  
  13.     public ref class Form1 : public System::Windows::Forms::Form
  14.     {
  15.     public:
  16.         Form1(void)
  17.         {
  18.             InitializeComponent();
  19.         }
  20.  
  21.     protected:
  22.         ~Form1()
  23.         {
  24.             if (components)
  25.             {
  26.                 delete components;
  27.             }
  28.         }
  29.  
  30.     private: System::Windows::Forms::OpenFileDialog^  openFileDialog1;
  31.     private: System::Windows::Forms::Button^  cmdopen;
  32.     public: AxWMPLib::AxWindowsMediaPlayer^  axWindowsMediaPlayer1;
  33.     private: System::Windows::Forms::Button^  media;
  34.     public:
  35.  
  36.     public:
  37.     private:
  38.     protected:
  39.  
  40.     private:
  41.         System::ComponentModel::Container ^components;
  42.  
  43. #pragma region Windows Form Designer generated code
  44.         void InitializeComponent(void)
  45.         {
  46.             System::ComponentModel::ComponentResourceManager^  resources = (gcnew System::ComponentModel::ComponentResourceManager(Form1::typeid));
  47.             this->axWindowsMediaPlayer1 = (gcnew AxWMPLib::AxWindowsMediaPlayer());
  48.             this->openFileDialog1 = (gcnew System::Windows::Forms::OpenFileDialog());
  49.             this->cmdopen = (gcnew System::Windows::Forms::Button());
  50.             this->media = (gcnew System::Windows::Forms::Button());
  51.             (cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->axWindowsMediaPlayer1))->BeginInit();
  52.             this->SuspendLayout();
  53.             resources->ApplyResources(this->axWindowsMediaPlayer1, L"axWindowsMediaPlayer1");
  54.             this->axWindowsMediaPlayer1->Name = L"axWindowsMediaPlayer1";
  55.             this->axWindowsMediaPlayer1->OcxState = (cli::safe_cast<System::Windows::Forms::AxHost::State^  >(resources->GetObject(L"axWindowsMediaPlayer1.OcxState")));
  56.             this->axWindowsMediaPlayer1->Enter += gcnew System::EventHandler(this, &Form1::axWindowsMediaPlayer1_Enter);
  57.             this->openFileDialog1->FileName = L"Escolha uma música";
  58.             resources->ApplyResources(this->openFileDialog1, L"openFileDialog1");
  59.             this->openFileDialog1->InitialDirectory = L"C:/documentos";
  60.             this->openFileDialog1->FileOk += gcnew System::ComponentModel::CancelEventHandler(this, &Form1::openFileDialog1_FileOk);
  61.             resources->ApplyResources(this->cmdopen, L"cmdopen");
  62.             this->cmdopen->Name = L"cmdopen";
  63.             this->cmdopen->UseVisualStyleBackColor = true;
  64.             this->cmdopen->Click += gcnew System::EventHandler(this, &Form1::cmdopen_Click);
  65.             resources->ApplyResources(this->media, L"media");
  66.             this->media->Name = L"media";
  67.             this->media->UseVisualStyleBackColor = true;
  68.             this->media->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
  69.             resources->ApplyResources(this, L"$this");
  70.             this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
  71.             this->BackColor = System::Drawing::SystemColors::ActiveCaptionText;
  72.             this->Controls->Add(this->media);
  73.             this->Controls->Add(this->cmdopen);
  74.             this->Controls->Add(this->axWindowsMediaPlayer1);
  75.             this->Cursor = System::Windows::Forms::Cursors::Arrow;
  76.             this->MaximizeBox = false;
  77.             this->Name = L"Form1";
  78.             this->ShowIcon = false;
  79.             this->ShowInTaskbar = false;
  80.             this->TopMost = true;
  81.             (cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->axWindowsMediaPlayer1))->EndInit();
  82.             this->ResumeLayout(false);
  83.  
  84.         }
  85. #pragma endregion
  86.     private: System::Void axWindowsMediaPlayer1_Enter(System::Object^  sender, System::EventArgs^  e) {
  87.                  
  88.              }
  89.     private: System::Void openFileDialog1_FileOk(System::Object^  sender, System::ComponentModel::CancelEventArgs^  e) {
  90.                  
  91.              }
  92.     private: System::Void cmdopen_Click(System::Object^  sender, System::EventArgs^  e) {
  93.                  Visible = 0;
  94.                  openFileDialog1->ShowDialog();
  95.                  axWindowsMediaPlayer1->URL = openFileDialog1->FileName;
  96.                  Visible = 100;
  97.              }
  98. private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
  99.              this->axWindowsMediaPlayer1->Visible = 100;
  100.          }
  101. };
  102. }
Advertisement
Add Comment
Please, Sign In to add comment