DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Tue, 7 Aug 2007 10:00:00 -0700,    posted on: microsoft.public.dotnet.framework.compactframework        back       

Thread Index
  1    Carl Nagy
          2    ctacke/ ctacke[at]opennetcf[dot]com


Starting an Application Message Loop   
I need to know how to start an application message loop using .NET Compact 
Framework and without displaying a window.

BACKGROUND INFO:  I have a standalone application running under Windows CE 
5.0, coded in C# and using .NET Compact Framework 2.0.  It creates a single 
dialog window, but should not display that window until a hardware event 
occurs.  On way to implement this is to create the dialog, then wait on an 
AutoResetEvent until the hardware event occurs, then call ShowDialog() when 
the event is set.  This works fine.

However, my lead wants me to design the program so that it can receive 
WM_CLOSE messages and shut itself down, even while the dialog window is NOT 
being displayed.  (These messages will come from another software component 
in the system.)  I assume this means that I need to have a message loop 
running in my program while I am waiting for the hardware event to be set.  
If my program is just waiting on an AutoResetEvent, I will not have a way to 
receive messages.

The standard way to initiate a message loop for window messages is to call 
Application.Run(), and I could do this after creating a separate thread to 
wait for the AutoResetEvent.  However, calling Application.Run() causes the 
dialog window to be displayed.  Even if I set the visibility of the dialog 
window to false immediately, it still flashes on the screen momentarily.  
This doesn't look good.

QUESTIONS:  Is there some way to start an application message loop without 
calling Application.Run()?  Is there some way to prevent my dialog window 
from being displayed when Application.Run() is called?

- Carl
Date:Tue, 7 Aug 2007 10:00:00 -0700   Author:  

Re: Starting an Application Message Loop   
Witht he CF classes directly, no this isn't possible.  We do have a Run() 
overload that doesn't require a Form in the Smart Device Framework's[1] 
OpenNETCF.Windows.Forms.Application2[2] namespace.  It's simply a wrapper 
around the standard calls in a message pump.


-- 

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Managed Code in an Embedded World
www.OpenNETCF.com

[1] www.SmartDeviceFramework.com
[2] www.OpenNETCF.com/library/sdf


"Carl Nagy"  wrote in message 
news:2D7D7787-74B8-42AD-832B-F2962072595D@microsoft.com...

>I need to know how to start an application message loop using .NET Compact
> Framework and without displaying a window.
>
> BACKGROUND INFO:  I have a standalone application running under Windows CE
> 5.0, coded in C# and using .NET Compact Framework 2.0.  It creates a 
> single
> dialog window, but should not display that window until a hardware event
> occurs.  On way to implement this is to create the dialog, then wait on an
> AutoResetEvent until the hardware event occurs, then call ShowDialog() 
> when
> the event is set.  This works fine.
>
> However, my lead wants me to design the program so that it can receive
> WM_CLOSE messages and shut itself down, even while the dialog window is 
> NOT
> being displayed.  (These messages will come from another software 
> component
> in the system.)  I assume this means that I need to have a message loop
> running in my program while I am waiting for the hardware event to be set.
> If my program is just waiting on an AutoResetEvent, I will not have a way 
> to
> receive messages.
>
> The standard way to initiate a message loop for window messages is to call
> Application.Run(), and I could do this after creating a separate thread to
> wait for the AutoResetEvent.  However, calling Application.Run() causes 
> the
> dialog window to be displayed.  Even if I set the visibility of the dialog
> window to false immediately, it still flashes on the screen momentarily.
> This doesn't look good.
>
> QUESTIONS:  Is there some way to start an application message loop without
> calling Application.Run()?  Is there some way to prevent my dialog window
> from being displayed when Application.Run() is called?
>
> - Carl
> 
Date:Tue, 7 Aug 2007 12:41:31 -0500   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us