直接切入正題:
聲明:
private MessengerAPI
private MessengerAPI
msn = new MessengerClass();
msn
msn
private void msn_OnIMWindowCreated(object pIMWindow)
{
msnMsgWnd = (IMessengerConversationWnd) pIMWindow; //取得IM窗口句柄
#region Get IM Message
System
Guid guidCOM= new Guid(
IAccessible IACurrent=null; //IAccessible集
try
{
NativeWIN
IACurrent = (IAccessible)IACurrent
int _ChildCount = IACurrent
object[] _Children = new object[_ChildCount];
int _out;
NativeWIN
foreach(IAccessible _child in _Children)
{
string _accName = _child
}
}
catch(Exception ex)
{
throw ex;
}
#endregion
}
private void msn_OnIMWindowDestroyed(object pIMWindow)
{
msnMsgWnd = null;
}
Private void FindIMwindow()
{System
int _next =
do
{
hWndStart = NativeWIN
_next = hWndStart
}while(_next !=
}
#region API wrapper
public class NativeWIN
{
[DllImport(
public static extern IntPtr FindWindowEx(
int parent /*HWND*/
int next /*HWND*/
string lpszClass
string sWindowTitle);
[DllImport(
public static extern int AccessibleObjectFromWindow(
IntPtr hwnd
int dwObjectID
Guid refID
ref IAccessible ppvObject);
[DllImport(
public static extern int AccessibleChildren(
Accessibility
int iChildStart
int cChildren
[Out] object[] rgvarChildren
out int pcObtained);
}
public enum NativeMsg:long {
CHILDID_SELF =
CHILDID_
OBJID_CLIENT =
}
#endregion
From:http://tw.wingwit.com/Article/program/net/201311/13375.html