本文整理汇总了C#中System.Windows.Forms.Form.CheckCloseDialog方法的典型用法代码示例。如果您正苦于以下问题:C# Form.CheckCloseDialog方法的具体用法?C# Form.CheckCloseDialog怎么用?C# Form.CheckCloseDialog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.Form
的用法示例。
在下文中一共展示了Form.CheckCloseDialog方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LocalModalMessageLoop
private bool LocalModalMessageLoop(Form form) {
try {
// Execute the message loop until the active component tells us to stop.
//
NativeMethods.MSG msg = new NativeMethods.MSG();
bool unicodeWindow = false;
bool continueLoop = true;
while (continueLoop) {
bool peeked = UnsafeNativeMethods.PeekMessage(ref msg, NativeMethods.NullHandleRef, 0, 0, NativeMethods.PM_NOREMOVE);
if (peeked) {
// If the component wants us to process the message, do it.
// The component manager hosts windows from many places. We must be sensitive
// to ansi / Unicode windows here.
//
if (msg.hwnd != IntPtr.Zero && SafeNativeMethods.IsWindowUnicode(new HandleRef(null, msg.hwnd))) {
unicodeWindow = true;
if (!UnsafeNativeMethods.GetMessageW(ref msg, NativeMethods.NullHandleRef, 0, 0)) {
continue;
}
}
else {
unicodeWindow = false;
if (!UnsafeNativeMethods.GetMessageA(ref msg, NativeMethods.NullHandleRef, 0, 0)) {
continue;
}
}
if (!PreTranslateMessage(ref msg)) {
UnsafeNativeMethods.TranslateMessage(ref msg);
if (unicodeWindow) {
UnsafeNativeMethods.DispatchMessageW(ref msg);
}
else {
UnsafeNativeMethods.DispatchMessageA(ref msg);
}
}
if (form != null) {
continueLoop = !form.CheckCloseDialog(false);
}
}
else if (form == null) {
break;
}
else if (!UnsafeNativeMethods.PeekMessage(ref msg, NativeMethods.NullHandleRef, 0, 0, NativeMethods.PM_NOREMOVE)) {
UnsafeNativeMethods.WaitMessage();
}
}
return continueLoop;
}
catch {
return false;
}
}
示例2: LocalModalMessageLoop
private bool LocalModalMessageLoop(Form form)
{
try
{
System.Windows.Forms.NativeMethods.MSG msg = new System.Windows.Forms.NativeMethods.MSG();
bool flag = false;
bool flag2 = true;
while (flag2)
{
if (!System.Windows.Forms.UnsafeNativeMethods.PeekMessage(ref msg, System.Windows.Forms.NativeMethods.NullHandleRef, 0, 0, 0))
{
goto Label_00AB;
}
if ((msg.hwnd != IntPtr.Zero) && System.Windows.Forms.SafeNativeMethods.IsWindowUnicode(new HandleRef(null, msg.hwnd)))
{
flag = true;
if (System.Windows.Forms.UnsafeNativeMethods.GetMessageW(ref msg, System.Windows.Forms.NativeMethods.NullHandleRef, 0, 0))
{
goto Label_0074;
}
continue;
}
flag = false;
if (!System.Windows.Forms.UnsafeNativeMethods.GetMessageA(ref msg, System.Windows.Forms.NativeMethods.NullHandleRef, 0, 0))
{
continue;
}
Label_0074:
if (!this.PreTranslateMessage(ref msg))
{
System.Windows.Forms.UnsafeNativeMethods.TranslateMessage(ref msg);
if (flag)
{
System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(ref msg);
}
else
{
System.Windows.Forms.UnsafeNativeMethods.DispatchMessageA(ref msg);
}
}
if (form != null)
{
flag2 = !form.CheckCloseDialog(false);
}
continue;
Label_00AB:
if (form == null)
{
break;
}
if (!System.Windows.Forms.UnsafeNativeMethods.PeekMessage(ref msg, System.Windows.Forms.NativeMethods.NullHandleRef, 0, 0, 0))
{
System.Windows.Forms.UnsafeNativeMethods.WaitMessage();
}
}
return flag2;
}
catch
{
return false;
}
}