Çü½Ä ¶óÀ̺귯¸®¿¡¼­ »ó¼ö ¹× DLL ¼±¾ð ¸¸µå´Â ¹æ¹ý

±â¼ú ÀÚ·á: 143258 - ÀÌ ¹®¼­°¡ Àû¿ëµÇ´Â Á¦Ç° º¸±â.
¸ðµÎ È®´ë | ¸ðµÎ Ãà¼Ò

ÀÌ ÆäÀÌÁö¿¡¼­

¿ä¾à

»ó¼ö Á¤ ¹× DLL ¼±¾ð Çü½ÄÀÇ ¶óÀ̺귯¸® ÆÐŰÁö·Î ¸Å¿ì À¯¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù. Visual Basic Çü½Ä ¶óÀ̺귯¸® ¹× ÇØ´ç ³»¿ë¿¡ ¾×¼¼½ºÇÒ ¼ö ÀÖ½À´Ï´Ù. Çü½Ä ¶óÀ̺귯¸®¿¡ ´ëÇÑ ÂüÁ¶¸¦ º¯°æÇßÀ¸¸é, Visual BasicÀÇ °íÀ¯ÇÑ °³Ã¼ ºê¶ó¿ìÀú¿¡¼­ ÇØ´ç Á¤º¸¸¦ º¼ ¼ö ÀÖ½À´Ï´Ù. ¶ÇÇÑ µµ¿ò¸» ¹®ÀÚ¿­À» Á¦°øÇÒ ¼ö ÀÖ´Â Çü½Ä ¶óÀ̺귯¸® ¶ÇÇÑ ¿ì¼öÇÕ´Ï´Ù ¼±¾ðÀ» ÇÔ²² Ç×»ó ¾î¶² Á¤ÀÇ »ç¿ëÀÚ¿¡°Ô ¾Ë¸± ¼ö ÀÖ½À´Ï´Ù.

Ãß°¡ Á¤º¸

¸í·ÉÁÙ¿¡¼­ ÇÊ¿äÇÑ Çü½Ä ¶óÀ̺귯¸®¸¦ ¸¸µé·Á¸é, UUID.EXE ¹× MKTYPLIB.EXE ÇÁ·Î±×·¥. Visual C++´Â »ç¿ëÇÏ¿© ÀÌ·¯ÇÑ ÇÁ·Î±×·¥ÀÌ Á¦°øµË´Ï´Ù.

¼¼ °³ÀÇ Á¤¼ö »ó¼ö, ¹®ÀÚ¿­ »ó¼ö ¹× Windows API¸¦ ¼±¾ð Çϳª°¡ Çü½Ä ¶óÀ̺귯¸®¸¦ ¸¸µé¾î¾ß ÇÑ´Ù°í °¡Á¤ÇØ º¾´Ï´Ù. ´ÙÀ½ Çü½Ä ¶óÀ̺귯¸®¸¦ »ý¼ºÇÏ´Â µ¥ ÇÊ¿äÇÑ ODL (°³Ã¼ ¼³¸í ¾ð¾î) Äڵ尡 ÀÖ½À´Ï´Ù. ÅëÇØ ODL ÀÐ°í °¢ ±¸¿ª ¹«¾ùÀÎÁö ¼³¸íÇÏ´Â ÁÖ¼®À» ¼ö ¹× ÀÌÀ¯¸¦ ÀÖÀ» °ÍÀÔ´Ï´Ù ¿ì¸®´Â ÇÕ´Ï´Ù.
   [
   // The Universal Unique identifier (UUID), needs to be generated by
   // using uuid.exe program. Then, you paste the value into the type
   // library.
   uuid(006da100-110f-11cf-83b2-00aa0068851c),

   // The Help String comes up in the object browser as the second
   // piece of the library description in the "Libraries/Projects" combo
   // box.
   helpstring("Constants TypeLib"),

   // The Locale Identifier (LCID), identifies the language the type
   // library applies to.
   lcid(0x9),

   // This is the version number of the type library.
   version(1.0)
   ]

   // This is the name of the type library. It comes up in the object
   // browser as the first piece of the library description in the
   // "Libraries/Projects" combo box.
   library MyLib
   {
     // Define numeric constants.
     typedef enum tagConst
        {
          mylibConst1,       // Make the constant mylibconst1 equal to 0.
          mylibConst2=5,     // Make the constant mylibconst2 equal to 5.
          mylibConst3=7      // Make the constant mylibconst3 equal to 7.
        }Constants;

      // You need to define string constants in a module.
      // Modules also need to reference a dll name. In this case you don't
      // need to, so just give it a bogus name.
      [dllname("bogus")]
      module MoreConstants
       {
         // Define a constant mystr and assign it the value StringConstant.
         const LPSTR mystr="StringConstant";
       };

      // Now call a function located in the Windows API, specifically
      // User32.dll. Now you see why you need a dll name here, this is
      // where the API function will come from.
      [dllname("user32.dll")]
      module APIDeclare
       {
         // Give the API function a descriptive help line, this will
         // be seen in the Object browser. Then, you can declare the
         // function. The entry attribute specifies the identifier for the
         // entry point into the dll.
         // The in attribute specifies a parameter as a value going into
         // the function.
         //Note that the following two lines need to be all on one line.
   [helpstring("Test API function Declaration"), entry("CloseWindow")]_
    boolean

   CloseWindow([in] long Winhndl);
       };
   }
				

ÀÌ Äڵ带 ÄÄÆÄÀÏÇÏ·Á¸é ÅØ½ºÆ® ÆÄÀÏ·Î º¹»çÇÑ ¹× test.odl, È£Ãâ ÈÄ ´ÙÀ½°ú °°Àº MkTypLib ¸í·ÉÁÙ ÇÁ·Î±×·¥À» ½ÇÇàÇϽʽÿÀ.
   mktyplib /nocpp test.odl
				

´ÙÀ½°ú °°Àº ¸Þ½ÃÁö°¡ ³ªÅ¸³³´Ï´Ù.
   Successfully generated type library 'test.tlb'.
				

Visual Basic¿¡¼­ Çü½Ä ¶óÀ̺귯¸® »ç¿ë

  1. Visual Basic ÇÔ²² »õ ÇÁ·ÎÁ§Æ®¸¦ ½ÃÀÛÇϽʽÿÀ.
  2. µµ±¸ ¸Þ´º¿¡¼­ ÂüÁ¶¸¦ ¼±ÅÃÇϽʽÿÀ. À§·Î ÂüÁ¶ Ç¥½ÃÇÕ´Ï´Ù ´ëÈ­ »óÀÚ; Test.tlb ÆÄÀÏÀ» °Ë»öÇÏ·Á¸é ã¾Æº¸±â ´ÜÃ߸¦ Ŭ¸¯ÇÕ´Ï´Ù. ¿øÇÏ´Â ÆÄÀÏÀ» ãÀº ÈÄ¿¡´Â È®ÀÎÀ» Ŭ¸¯ÇϽʽÿÀ.
  3. Çü½Ä ¶óÀ̺귯¸® µË´Ï´Ù ÀÌÁ¦ ÂüÁ¶ ¸ñ·ÏÀ» ¼ö, À̸¦ üũ È®ÀÎÇÑ ´ÙÀ½ ÂüÁ¶ ´ëÈ­ »óÀÚ¸¦ Á¾·áÇÕ´Ï´Ù.
  4. ¸í·É ´ÜÃß¿¡ ´ëÇÑ form1 ±×¸³´Ï´Ù.
  5. ´ÙÀ½ Äڵ带 ÀÔ·ÂÇÕ´Ï´Ù:
          Private Sub Command1_Click()
    
          Dim x As Boolean
    
          'Call the Windows API function CloseWindow without making one
          'declare at all. Note that the CloseWindow API will close the current
          'window.
          x = CloseWindow(Me.hWnd)
    
          'Now print out the value of the constants in the type library
          'using message boxes.
          MsgBox mylibConst1
          MsgBox mylibConst2
          MsgBox mylibConst3
          MsgBox mystr
    
          End Sub
    						
  6. ÇÁ·Î±×·¥À» ½ÇÇàÇϰí, form1 ÃÖ¼ÒÈ­ÇÏ°í ¿ì¸®´Â ¿ì¸®ÀÇ Çü½Ä ¶óÀ̺귯¸®¿¡ Á¤ÀÇµÈ °¢ »ó¼ö ¸Þ½ÃÁö »óÀÚ¿Í °¢ »ó¼öÀÇ °ªÀÌ Ç¥½ÃµË´Ï´Ù ´ÙÀ½ Ç¥½ÃµË´Ï´Ù.

ÂüÁ¶

OLE 2 ÇÁ·Î±×·¡¸Ó ÂüÁ¶ º¼·ý 2

¼Ó¼º

±â¼ú ÀÚ·á: 143258 - ¸¶Áö¸· °ËÅä: 2004³â 7¿ù 1ÀÏ ¸ñ¿äÀÏ - ¼öÁ¤: 1.3
º» ¹®¼­ÀÇ Á¤º¸´Â ´ÙÀ½ÀÇ Á¦Ç°¿¡ Àû¿ëµË´Ï´Ù.
  • Microsoft Visual Basic 5.0 Professional Edition
  • Microsoft Visual Basic 6.0 Professional Edition
  • Microsoft Visual Basic 5.0 Enterprise Edition
  • Microsoft Visual Basic Enterprise Edition for Windows 6.0
  • Microsoft Visual Basic 4.0 Standard Edition
  • Microsoft Visual Basic 4.0 Professional Edition
  • Microsoft Visual Basic 4.0 Professional Edition
  • Microsoft Visual Basic 4.0 16-bit Enterprise Edition
  • Microsoft Visual Basic 4.0 32-Bit Enterprise Edition
Ű¿öµå:?
kbmt kbhowto KB143258 KbMtko
±â°è ¹ø¿ªµÈ ¹®¼­
Áß¿ä: º» ¹®¼­´Â Àü¹® ¹ø¿ª°¡°¡ ¹ø¿ªÇÑ °ÍÀÌ ¾Æ´Ï¶ó Microsoft ±â°è ¹ø¿ª ¼ÒÇÁÆ®¿þ¾î·Î ¹ø¿ªÇÑ °ÍÀÔ´Ï´Ù. Microsoft´Â ¹ø¿ª°¡°¡ ¹ø¿ªÇÑ ¹®¼­ ¹× ±â°è ¹ø¿ªµÈ ¹®¼­¸¦ ¸ðµÎ Á¦°øÇϹǷΠMicrosoft ±â¼ú ÀÚ·á¿¡ ÀÖ´Â ¸ðµç ¹®¼­¸¦ Çѱ۷ΠÁ¢ÇÒ ¼ö ÀÖ½À´Ï´Ù. ±×·¯³ª ±â°è ¹ø¿ª ¹®¼­°¡ Ç×»ó ¿Ïº®ÇÑ °ÍÀº ¾Æ´Õ´Ï´Ù. µû¶ó¼­ ±â°è ¹ø¿ª ¹®¼­¿¡´Â ¸¶Ä¡ ¿Ü±¹ÀÎÀÌ Çѱ¹¾î·Î ¸»ÇÒ ¶§ ½Ç¼ö¸¦ ÇÏ´Â °Íó·³ ¾îÈÖ, ±¸¹® ¶Ç´Â ¹®¹ý¿¡ ¿À·ù°¡ ÀÖÀ» ¼ö ÀÖ½À´Ï´Ù. Microsoft´Â ³»¿ë»óÀÇ ¿À¿ª ¶Ç´Â Microsoft °í°´ÀÌ ÀÌ·¯ÇÑ ¿À¿ªÀ» »ç¿ëÇÔÀ¸·Î½á ¹ß»ýÇÏ´Â ºÎ Á¤È®¼º, ¿À·ù ¶Ç´Â ¼ÕÇØ¿¡ ´ëÇØ Ã¥ÀÓÀ» ÁöÁö ¾Ê½À´Ï´Ù. Microsoft´Â ÀÌ·¯ÇÑ ¹®Á¦¸¦ ÇØ°áÇϱâ À§ÇØ ±â°è ¹ø¿ª ¼ÒÇÁÆ®¿þ¾î¸¦ ÀÚÁÖ ¾÷µ¥ÀÌÆ®Çϰí ÀÖ½À´Ï´Ù.

Çǵå¹é º¸³»±â