Every WindowsCE system has coredll, and any Windows CE system which supports
Windows Forms will support GetCapture and SetForegroundWindow. The problem
with BringToFront is it doesn't work when your application goes behind a
window owned by another process. This code will work on any CE version which
supports .NETCF, if you want your code to work on the desktop too, then wrap
your calls to these P/Invoke functions with:-
if(System.Environment.OSVersion.Platform==PlatformID.WinCE)
{
}
Then they won't be called on the desktop.
Peter
--
Peter Foot
Windows Embedded MVP
http://www.inthehand.com |
http://blog.opennetcf.org/pfoot/
"McFar" <_NO_NO__REMOVE_@6784.com> wrote in message
news:ejMex%(E-Mail Removed)...
> Well...
> I am developing a pure .NET CF application and do not want to write it
> being
> platform depended...
> and using this function fill require that the plantform my application
> started on has coredll.dll module and SetForegroundWindow function.
> another reason is that when I use the code
> Caprure = true
> GetCapture
> Capture - false
> SetForegroundWindow
> it helps to activate and show my application window, but the screen still
> flicks
> (the desktop window or a window of some other active application is shown
> before activating of my application window)
> I do not know why it always happens, I know there is a BringToFron
> function
> but it seems does nothing
>
>
> "Peter Foot [MVP]" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Why don't you want to use any P/Invoke? You don't need to use the whole
>> of
>> the OpenNETCF code just for this function, just define the P/Invokes you
>> need:-
>>
> http://blog.opennetcf.org/pfoot/Perm...d-0950e9d16b10
>>
>> [DllImport("coredll")]
>> private static extern IntPtr GetCapture();
>>
>> [DllImport("coredll")]
>> private static extern bool SetForegroundWindow(IntPtr hwnd);
>>
>> Peter
>>
>> --
>> Peter Foot
>> Windows Embedded MVP
>> http://www.inthehand.com | http://blog.opennetcf.org/pfoot/
>>
>> "McFar" <_NO_NO__REMOVE_@6784.com> wrote in message
>> news:(E-Mail Removed)...
>> > and sorry I do not want to use any PInvoke calls like in opennetcf
>> > SetForegroundWindow(hwnd)
>> >
>> > "McFar" <_NO_NO__REMOVE_@6784.com> wrote in message
>> > news:(E-Mail Removed)...
>> >> In my pocket pc application (i write it on .NET CF) i show a dialog
> using
>> >> ShowDialog method, when user closes the dialog box my application
> become
>> > not
>> >> active and to activate it I sould go to Settings->memory->running
>> >> programs -> activat
>> >>
>> >> What the matter? If I do something wrong?
>> >> Please help me my pocket pc have a lot of such forms and it is not
> usable
>> >> when after any form closed my application become not active...
>> >>
>> >>
>> >
>> >
>>
>>
>
>