C++Builder  |  Delphi  |  Kylix  |  Turbo-C  |  .NET  |  JBuilder  |  Together  |  FireBird
C++Builder Programming Forum º¼·£µåÆ÷·³ BorlandForum
 °æ°í! °Ô½Ã¹° ÀÛ¼ºÀÚÀÇ »çÀü Çã¶ô¾ø´Â ¸ÞÀÏÁÖ¼Ò ÃßÃâÇàÀ§ Àý´ë ±ÝÁö
C++ºô´õ Æ÷·³
Q & A
FAQ
ÆÁ&Æ®¸¯
°­ÁÂ/¹®¼­
ÀÚ·á½Ç
ÄÄÆ÷³ÍÆ®/¶óÀ̺귯¸®
¸Þ½ÅÀú ÇÁ·ÎÁ§Æ®
º¼·£µåÆ÷·³ Ȩ
Çìµå¶óÀÎ ´º½º
IT ´º½º
°øÁö»çÇ×
ÀÚÀ¯°Ô½ÃÆÇ
ÇØÇÇ ºê·¹ÀÌÅ©
°øµ¿ ÇÁ·ÎÁ§Æ®
±¸ÀÎ/±¸Á÷
ȸ¿ø ÀåÅÍ
°ÇÀÇ»çÇ×
¿î¿µÁø °Ô½ÃÆÇ
ȸ¿ø ¸Þ´º
ºÏ¸¶Å©
º¼·£µåÆ÷·³ ±¤°í ¸ðÁý

C++ºô´õ Q&A
C++Builder Programming Q&A
[60189] C++/CLI ¿¢¼¿ ¿ÀÅä¸ÞÀÌ¼Ç !!!! µµ¿ÍÁÖ¼¼¿ä !!!!
±è¼® [] 485 ÀÐÀ½    2010-02-09 09:21
C++/CLI ¿¢¼¿ ¿ÀÅä¸ÞÀ̼ÇÀ» °øºÎÇϰí ÀÖ½À´Ï´Ù.

Á¦°¡ ÇÏ·Á´Â °ÍÀº À©µµ¿ì Form ¿¡¼­ ¹öưÀ» ´©¸£¸é ÁöÁ¤µÈ ¿¢¼¿ ÆÄÀÏÀÌ ¿­¸®°í,

¿­¸°ÆÄÀÏÀÇ sheet ³»ºÎ¿¡ ÀÖ´Â Ä¿¸Çµå ¹öưÀ» ´©¸£¸é ¹öưÀÌ Å¬¸¯µÇ¾ú´Ù´Â ¸Þ½ÃÁö ¹Ú½º°¡ ¶ß°Ô ÇÏ°í ½Í½À´Ï´Ù.

ÇöÀç À©µµ¿ì Form ¿¡¼­ ¹öưÀ» ´©¸£¸é ÁöÁ¤µÈ ¿¢¼¿ ÆÄÀÏÀÌ ¿­¸®Áö¸¸, ±× ÈÄ ¾Æ·¡¿Í °°Àº ¿¡·¯°¡ ¹ß»ýÇÕ´Ï´Ù.

C#À¸·Î ¸¸µç Äڵ带 C++/CLI·Î ¹Ù²ã¼­ ÄÚµùÇϰí Àִ´ë ÂÍ Èûµå³»¿ä..

  C++/CLI·Î ÀÌ°Ô °¡´ÉÇѰ¡¿ä?? °¡´ÉÇÏ´Ù¸é ¹æ¹ýÀ» Á¶±Ý ¾Ë·ÁÁÖ½Ã¸é °¨»çÇϰڽÀ´Ï´Ù.

°í¼ö´ÔµéÀÇ ¸¹Àº Á¶¾ð ºÎʵ右´Ï´Ù. ÂÍ ±ÞÇÕ´Ï´Ù !!!!
¼Ò½º¿Í ¿¡·¯ È­¸é ĸÃÄÇØ¼­ ÷ºÎÇÕ´Ï´Ù. µµ¿ÍÁÖ¼¼¿ä !!!!


------------------------------------------------------------------------------------------------
󸮵ÇÁö ¾ÊÀº 'System.InvalidCastException' Çü½ÄÀÇ ¿¹¿Ü°¡ ExcelTest.exe¿¡¼­ ¹ß»ýÇß½À´Ï´Ù.

Ãß°¡ Á¤º¸: 'System.__ComObject' Çü½ÄÀÇ COM °³Ã¼¸¦ ÀÎÅÍÆäÀ̽º Çü½Ä 'Microsoft.Vbe.Interop.Forms.CommandButton'(À¸)·Î ij½ºÆÃÇÒ ¼ö ¾ø½À´Ï´Ù. ÇØ´ç ÀÎÅÍÆäÀ̽º¸¦ Áö¿øÇÏÁö ¾Ê½À´Ï´Ù. (¿¹¿Ü°¡ ¹ß»ýÇÑ HRESULT: 0x80004002 (E_NOINTERFACE)) ¿À·ù·Î ÀÎÇØ IID°¡ '{04598FC4-866C-11CF-AB7C-00AA00C08FCF}'ÀÎ ÀÎÅÍÆäÀ̽ºÀÇ COM ±¸¼º ¿ä¼Ò¿¡¼­ QueryInterface¸¦ È£ÃâÇÏÁö ¸øÇßÀ¸¹Ç·Î ÀÌ ÀÛ¾÷À» ¼öÇàÇÒ ¼ö ¾ø½À´Ï´Ù.
------------------------------------------------------------------------------------------------
 

#pragma once

#define Excel   Microsoft::Office::Interop::Excel
#define MSForms Microsoft::Vbe::Interop::Forms
namespace ExcelTest {

using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
using namespace Excel;
using namespace MSForms;
delegate void runExcel();

/// <summary>
/// Form1¿¡ ´ëÇÑ ¿ä¾àÀÔ´Ï´Ù.
///
/// °æ°í: ÀÌ Å¬·¡½ºÀÇ À̸§À» º¯°æÇϸé ÀÌ Å¬·¡½º°¡ ÀÇÁ¸ÇÏ´Â
///          ¸ðµç .resx ÆÄÀϰú °ü·ÃµÈ °ü¸®µÇ´Â ¸®¼Ò½º ÄÄÆÄÀÏ·¯ µµ±¸ÀÇ
///          '¸®¼Ò½º ÆÄÀÏ À̸§' ¼Ó¼ºµµ º¯°æÇØ¾ß ÇÕ´Ï´Ù. ±×·¸Áö ¾ÊÀº °æ¿ì
///          µðÀÚÀ̳ʴ ÀÌ Æû°ú °ü·ÃµÈ Áö¿ªÈ­µÈ ¸®¼Ò½º¿Í
///          ¿Ã¹Ù¸£°Ô »óÈ£ ÀÛ¿ëÇÒ ¼ö ¾ø½À´Ï´Ù.
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
public:
  Form1(void)
  {
   InitializeComponent();
   //
   //TODO: »ý¼ºÀÚ Äڵ带 ¿©±â¿¡ Ãß°¡ÇÕ´Ï´Ù.
   //
  }

protected:
  /// <summary>
  /// »ç¿ë ÁßÀÎ ¸ðµç ¸®¼Ò½º¸¦ Á¤¸®ÇÕ´Ï´Ù.
  /// </summary>
  ~Form1()
  {
   if (components)
   {
    delete components;
   }
  }
private: System::Windows::Forms::Button^  butExcel;
protected:

protected:

private:
  /// <summary>
  /// Çʼö µðÀÚÀÌ³Ê º¯¼öÀÔ´Ï´Ù.
  /// </summary>
  System::ComponentModel::Container ^components;

  Excel::Workbook^ workBook;
  Excel::Worksheet^ workSheet;
  //Excel::Range^ range;
  Excel::Application^ app;
  MSForms::CommandButton^ btnExcel;

#pragma region Windows Form Designer generated code
  /// <summary>
  /// µðÀÚÀÌ³Ê Áö¿ø¿¡ ÇÊ¿äÇÑ ¸Þ¼­µåÀÔ´Ï´Ù.
  /// ÀÌ ¸Þ¼­µåÀÇ ³»¿ëÀ» ÄÚµå ÆíÁý±â·Î ¼öÁ¤ÇÏÁö ¸¶½Ê½Ã¿À.
  /// </summary>
  void InitializeComponent(void)
  {
   this->butExcel = (gcnew System::Windows::Forms::Button());
   this->SuspendLayout();
   //
   // butExcel
   //
   this->butExcel->Location = System::Drawing::Point(104, 100);
   this->butExcel->Name = L"butExcel";
   this->butExcel->Size = System::Drawing::Size(95, 45);
   this->butExcel->TabIndex = 0;
   this->butExcel->Text = L"Run Excel";
   this->butExcel->UseVisualStyleBackColor = true;
   this->butExcel->Click += gcnew System::EventHandler(this, &Form1::butExcel_Click);
   //
   // Form1
   //
   this->AutoScaleDimensions = System::Drawing::SizeF(7, 12);
   this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
   this->ClientSize = System::Drawing::Size(292, 268);
   this->Controls->Add(this->butExcel);
   this->Name = L"Form1";
   this->Text = L"Form1";
   this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
   this->ResumeLayout(false);

  }
  void RunExcel()
  {
 
   app = gcnew Excel::ApplicationClass();
   //runExcel^ run = gcnew ExcelTest::Form1();

   workBook = app->Workbooks->Open("C:\\Test.xls", false, false, 5, "", "",
   false ,Excel::XlPlatform::xlWindows, false,true, false, false, true, false, false);
   app->Visible = true;

   btnExcel = (MSForms::CommandButton^)FindControl("btnExcel");
   btnExcel->Click += gcnew MSForms::CommandButtonEvents_ClickEventHandler(this, &Form1::btnExcel_Click);
  
  }

 
  System::Object^ FindControl(String^ name)
        {
   return FindControl(name, (Excel::Worksheet^)workBook->ActiveSheet);
        }
 
  System::Object^ FindControl(String^ name, Excel::Worksheet^ sheet)
        {
   Excel::OLEObject^ theObject;
   theObject =  (Excel::OLEObject^)sheet->OLEObjects(name);
   return (System::Object^)theObject;
        }

  void btnExcel_Click()
        {

   MessageBox::Show("Button Clicked");

        }




#pragma endregion
private: System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e) {
    }
private: System::Void butExcel_Click(System::Object^  sender, System::EventArgs^  e) {
    RunExcel();
    }
};
}

+ -
ÀÌÀü±Û:  Re:SDL Ãâ·ÂÀ» TPanelÀ̳ª TFormÀ§·Î ¼³Á¤ÇÒ ¼ö´Â ¾øÀ»±î¿ä?
´ÙÀ½±Û:  TBitmap32ÀÇ ÃÖ´ë Å©±â¸¦ ´õ ´Ã¸± ¼ö´Â ¾ø³ª¿ä?

°ü·Ã ±Û ¸®½ºÆ®
60189 C++/CLI ¿¢¼¿ ¿ÀÅä¸ÞÀÌ¼Ç !!!! µµ¿ÍÁÖ¼¼¿ä !!!! ±è¼® 485 2010-02-09
Google
Copyright © 2008, borlandforum.com. All right reserved.