Exemple #1
0
 /// <summary>
 /// ��ȡʹ���ڴ�ӳ���ļ����ƽ��е�ʵ�����е�ϵͳ�ľ��
 /// </summary>
 /// <param name="systemName">ϵͳ��ʶ��</param>
 /// <returns>����ϵͳ�����ڵľ��</returns>
 public static IntPtr GetSystemHandle(string systemName)
 {
     FileMapping fileMapping = null;
     try
     {
         fileMapping = new FileMapping(systemName);
     }
     catch
     {
         return IntPtr.Zero;
     }
     if (fileMapping.IsFirstInstance)
     {
         fileMapping.Dispose(true);
         return IntPtr.Zero;
     }
     IntPtr hMainFormHandle = fileMapping.ReadHandleValue(0);
     fileMapping.Dispose(false);
     return hMainFormHandle;
 }