°´Ã¼ÀÇ À̺¥Æ® ¼Ò½º¸¦ ÁÖ¾îÁø Á¢µÎ»ç¸¦ °¡Áø ÇÔ¼ö¿¡ ¿¬°áÇÕ´Ï´Ù.
ComObjConnect(ComObject [, Prefix])
À̺¥Æ®¸¦ ÀÏÀ¸Å°´Â °´Ã¼.
°´Ã¼°¡ IConnectionPointContainer ÀÎÅÍÆäÀ̽º¸¦ Áö¿øÇÏÁö ¾Ê°Å³ª ¶Ç´Â °´Ã¼ÀÇ Å¬·¡½º¿¡ °üÇÑ À¯ÇüÁ¤º¸¸¦ ¿¶÷ÇÒ ¼ö ¾øÀ¸¸é, ¿¡·¯ ¸Þ½ÃÁö°¡ ³ªÅ¸³³´Ï´Ù. ÀÌ°ÍÀº ComObjError ¶Ç´Â try/catchÀ¸·Î ¾ï´©¸£°Å³ª ó¸®ÇÒ ¼ö ÀÖ½À´Ï´Ù.
[v1.1.22]+¿¡¼, IProvideClassInfo ÀÎÅÍÆäÀ̽º¸¦ °´Ã¼°¡ Áö¿øÇÏ¸é ±× Å¬·¡½ºÀÇ °üÇÑ À¯ÇüÁ¤º¸¸¦ ¿¶÷ÇÏ´Â µ¥ »ç¿ëµË´Ï´Ù. ±×·¸Áö ¾ÊÀ¸¸é, ComObjConnect´Â °´Ã¼ÀÇ IDispatch ÀÎÅÍÆäÀ̽º¸¦ ÅëÇÏ À¯Çü Á¤º¸¸¦ ¿¶÷ÇÏ·Á°í ½ÃµµÇϴµ¥, ÀÌ°ÍÀº ½Å·Ú¼ºÀÌ ¶³¾îÁý´Ï´Ù.
À̺¥Æ® À̸§ ¾Õ¿¡ ºÙÀÏ ¹®ÀÚ¿. À̺¥Æ®°¡ ÀϾ ¶§ È£ÃâÇÒ ÇÔ¼ö¸¦ °áÁ¤ÇÕ´Ï´Ù.
»ý·«Çϸé, °´Ã¼°¡ "¿¬°áÀÌ ²÷±é´Ï´Ù"; Áï, ½ºÅ©¸³Æ®´Â ´õ ÀÌ»ó ±×ÀÇ À̺¥Æ® °íÁö¸¦ ¹ÞÁö ¾Ê½À´Ï´Ù.
[v1.1.01+]: ÀÌ ¸Å°³º¯¼ö´Â ½ºÅ©¸³Æ®°¡ ÁöÁ¤ÇÑ °´Ã¼ÀÏ ¼ö ÀÖ½À´Ï´Ù. À̺¥Æ®°¡ ÀϾ¸é, ±×¿¡ »óÀÀÇÏ´Â ¸Þ½îµå°¡ È£ÃâµË´Ï´Ù. ù ¸Å°³º¯¼ö´Â º¸Åë ¼ûÀº this
¸Å°³º¯¼öÀÔ´Ï´Ù. ÀÌ ¸Å°³º¯¼ö´Â COM °´Ã¼ ¸»°í ½ºÅ©¸³Æ®¿¡-Á¤ÀÇµÈ °´Ã¼¸¦ ÂüÁ¶ÇÕ´Ï´Ù. °¢ À̺¥Æ®¸¶´Ù ¸Þ½îµå¸¦ Á¤ÀÇÇÏÁö ¾Ê°í ¸ðµç À̺¥Æ®¸¦ ³ªÆ÷ÇÏ·Á¸é __Call ¸ÞŸ-ÇÔ¼ö¸¦ Á¤ÀÇÇϽʽÿÀ.
È¿°úÀûÀ¸·Î ComObjConnect¸¦ »ç¿ëÇÏ·Á¸é, ¸ÕÀú °ü½ÉÀ» µÐ À̺¥Æ®¸¦ ó¸®ÇÒ ÇÔ¼ö¸¦ ½ºÅ©¸³Æ®¿¡ ÀÛ¼ºÇØ¾ß ÇÕ´Ï´Ù. "À̺¥Æ®-ó¸®ÀÚ"¶ó°í ÇÏ´Â ±×·± ÇÔ¼ö´Â ±¸Á¶°¡ ´ÙÀ½°ú °°½À´Ï´Ù:
PrefixEventName([Params..., ComObject]) { ... event-handling code ... return returnValue }
Prefix´Â ¿©·¯ºÐÀÌ °í¸¥ Á¢µÎ»çÀÔ´Ï´Ù. ¹Ý¸é¿¡ EventNameÀº ÇÔ¼ö°¡ ó¸®ÇØ¾ß ÇÏ´Â À̺¥Æ®ÀÇ À̸§ÀÔ´Ï´Ù.
Params´Â À̺¥Æ®°¡ °¡Áø ¸Å°³º¯¼ö¿¡ »óÀÀÇÕ´Ï´Ù. À̺¥Æ®¿¡ ¸Å°³º¯¼ö°¡ ¾øÀ¸¸é, Paramsµµ ¿ÏÀüÈ÷ »ý·«µÇ¾î¾ß ÇÕ´Ï´Ù. ComObject´Â ¼±ÅÃÀûÀÔ´Ï´Ù. ±×¸®°í ParamsÀÇ °³¼ö°¡ ¿Ã¹Ù¸£°Ô Á¤ÀǵǾî ÀÖÀ» °æ¿ì¿¡¸¸ »ç¿ëÇØ¾ß ÇÕ´Ï´Ù; ±× ¾È¿¡ ComObjConnect¿¡ °Ç³Þ´ø ¿ø·¡ Æ÷Àå °´Ã¼¸¦ °¡¸®Å°´Â ÂüÁ¶°¡ µé¾î ÀÖ½À´Ï´Ù. "ComObject"´Â ¿©·¯ºÐÀÇ ½ºÅ©¸³Æ® ¹®¸Æ¿¡ ¸Â°Ô º¸´Ù ÀǹÌÀÖ´Â À̸§À¸·Î ±³Ã¼µÇ¾î¾ß ÇÕ´Ï´Ù.
À̺¥Æ® ó¸®ÀÚ´Â ¹Ýȯ °ªÀÌ ÀÖÀ» ¼ö ÀÖ´Ù´Â »ç½Ç¿¡ ÁÖ¸ñÇϽʽÿÀ. COM-Á¾¼ÓÀû À¯ÇüÀÇ °ªÀ» µ¹·ÁÁÖ·Á¸é, ComObject(type, value)¸¦ »ç¿ëÇϽʽÿÀ. ¿¹¸¦ µé¾î, return ComObject(0,0)
´Â variant À¯ÇüÀÇ VT_EMPTY¸¦ µ¹·ÁÁÝ´Ï´Ù. ÀÌ°ÍÀº ÀÚ¹Ù½ºÅ©¸³Æ®¿¡¼ undefined
¸¦ µ¹·ÁÁÖ´Â °Í (¶Ç´Â ¾Æ¹«°Íµµ µ¹·ÁÁÖÁö ¾Ê´Â °Í)°ú µ¿µîÇÕ´Ï´Ù.
À̺¥Æ® 󸮸¦ ÄÑ·Á¸é ComObjConnect(yourObject, "Prefix")
¸¦ È£ÃâÇÕ´Ï´Ù.
°´Ã¼¿Í ¿¬°áÀ» ²÷À¸·Á¸é (À̺¥Æ® 󸮸¦ ÁßÁöÇÏ·Á¸é) ComObjConnect(yourObject)
¸¦ È£ÃâÇÕ´Ï´Ù.
¸Å°³º¯¼ö °³¼ö¸¦ ¾ËÁö ¸øÇϸé, °¡º¯ ÇÔ¼ö¸¦ »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù.
ComObjCreate, ComObjGet, ComObjActive, ComObjError, WScript.ConnectObject (MSDN)
ie := ComObjCreate("InternetExplorer.Application") ; »óÀÀÇÏ´Â ½ºÅ©¸³Æ® ÇÔ¼ö¿¡ Á¢µÎ»ç¸¦ "IE_"·Î ÇÏ¿© À̺¥Æ®¸¦ ¿¬°áÇÕ´Ï´Ù. ComObjConnect(ie, "IE_") ie.Visible := true ; ÀÌ°ÍÀº IE7¿¡¼ Á¦´ë·Î ÀÛµ¿ÇÏÁö ¾Ê´Â´Ù°í ¾Ë·ÁÁ® ÀÖ½À´Ï´Ù. ie.Navigate("http://ahkscript.org/") #Persistent IE_DocumentComplete(ieEventParam, url, ieFinalParam) { global ie if (ie != ieEventParam) s .= "ù ¸Å°³º¯¼ö´Â »õ Æ÷Àå °´Ã¼ÀÔ´Ï´Ù.`n" if (ie == ieFinalParam) s .= "¸¶Áö¸· ¸Å°³º¯¼ö´Â ¿ø·¡ Æ÷Àå °´Ã¼ÀÔ´Ï´Ù.`n" if ((disp1:=ComObjUnwrap(ieEventParam)) == (disp2:=ComObjUnwrap(ieFinalParam))) s .= "µÎ Æ÷Àå °´Ã¼ ¸ðµÎ °°Àº IDispatch ½Çü¸¦ °¡¸®Åµ´Ï´Ù.`n" ObjRelease(disp1), ObjRelease(disp2) MsgBox % s . "Finished loading " ie.Document.title " @ " url ie.Quit() ExitApp }