아래 그림과 같이 InfoPath 양식을 강제로 종료하지 못하게 하는방법에 대한 설명입니다.
FormCode.cs 에 아래 소스를 추가합니다.
| #region 'X' 버튼 비활성화 private const int SC_CLOSE = 61536; private const int MF_BYCOMMAND = 0; private const int MF_GRAYED = 1; private const int MF_ENABLED = 0; // Récupère le handle d'une fenêtre à partir de son titre [DllImport("user32.dll", EntryPoint = "FindWindowA")] private static extern int FindWindow(string lpClassName, string lpWindowName); // Fonctions de gestions des menus systèmes windows [DllImport("user32.dll")] private static extern int GetSystemMenu(int hwnd, int revert); [DllImport("user32.dll")] private static extern int EnableMenuItem(int menu, int ideEnableItem, int enable); public static void Disable(int handle) { switch (EnableMenuItem(GetSystemMenu(handle, 0), SC_CLOSE, (MF_BYCOMMAND | MF_GRAYED))) { case MF_ENABLED: break; case MF_GRAYED: break; default: break; } } #endregion |
Form_Loading 메소드에 아래 소스를 추가합니다.
| int myWindow; myWindow = FindWindow(null, this.Application.Name); Disable(myWindow); |
참조 : http://social.msdn.microsoft.com/Forums/en/sharepointinfopath/thread/257f186f-3ab3-4ac4-9553-f71d100ad297
0 개의 댓글:
댓글 쓰기