|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Force form to foreground?Hi,
How can I force a form to the foreground no matter what application is in front? Thanks! M O J O On Nov 13, 10:58 am, M O J O <m...@nospam.nospam> wrote:
> Hi, TopMost = True> > How can I force a form to the foreground no matter what application is > in front? > > Thanks! > > M O J O Thanks, Seth Rowe Hi Seth,
No TopMost will not do. The form cannot be TopMost. It's a hidden menu form and when he user presses Windows+I the menu form must show and come to the foreground (steal the foreground) without being topmost. Any other idea? Kind regards M O J O rowe_newsgroups skrev: Show quoteHide quote > On Nov 13, 10:58 am, M O J O <m...@nospam.nospam> wrote: >> Hi, >> >> How can I force a form to the foreground no matter what application is >> in front? >> >> Thanks! >> >> M O J O > > TopMost = True > > Thanks, > > Seth Rowe > Like the Outlook reminder window ... it steals the foreground without
being topmost. ???? Thanks! M O J O M O J O skrev: Show quoteHide quote > Hi Seth, > > No TopMost will not do. The form cannot be TopMost. > > It's a hidden menu form and when he user presses Windows+I the menu form > must show and come to the foreground (steal the foreground) without > being topmost. > > Any other idea? > > Kind regards > M O J O > > rowe_newsgroups skrev: >> On Nov 13, 10:58 am, M O J O <m...@nospam.nospam> wrote: >>> Hi, >>> >>> How can I force a form to the foreground no matter what application is >>> in front? >>> >>> Thanks! >>> >>> M O J O >> >> TopMost = True >> >> Thanks, >> >> Seth Rowe >> On Nov 13, 9:39 am, M O J O <m...@nospam.nospam> wrote:
Show quoteHide quote > Like the Outlook reminder window ... it steals the foreground without So, your trying to force a window to steal focus... Well, in the old> being topmost. > > ???? > > Thanks! > M O J O > > M O J O skrev: > > > > > Hi Seth, > > > No TopMost will not do. The form cannot be TopMost. > > > It's a hidden menu form and when he user presses Windows+I the menu form > > must show and come to the foreground (steal the foreground) without > > being topmost. > > > Any other idea? > > > Kind regards > > M O J O > > > rowe_newsgroups skrev: > >> On Nov 13, 10:58 am, M O J O <m...@nospam.nospam> wrote: > >>> Hi, > > >>> How can I force a form to the foreground no matter what application is > >>> in front? > > >>> Thanks! > > >>> M O J O > > >> TopMost = True > > >> Thanks, > > >> Seth Rowe- Hide quoted text - > > - Show quoted text - days you used to do that by calling SetForegroundWindow - the problem is that this won't always work anymore. Microsoft "fixed" this function in Windows98 timeframe to prevent exactly what your trying to do - steal the focus... Fortunately, there is a way around it. But, it involves a little more work - you have to couple the call with a call to AttachThreadInput. All-in-all your looking at several api calls. Here is an example in classic VB, by the great Karl Peterson: http://vb.mvps.org/samples/project.asp?id=ForceFore If you need help converting this to VB.NET, let us know. -- Tom Shelton Hi Tom,
It is already VB. :o) Well When I try this... Call ForceForegroundWindow(CLng(myWindowsForm.Handle)) ....I get this exception: "Attempted to read or write protected memory. This is often an indication that other memory has been corrupted." Any idea? Thanks! M O J O Tom Shelton skrev: Show quoteHide quote > On Nov 13, 9:39 am, M O J O <m...@nospam.nospam> wrote: >> Like the Outlook reminder window ... it steals the foreground without >> being topmost. >> >> ???? >> >> Thanks! >> M O J O >> >> M O J O skrev: >> >> >> >>> Hi Seth, >>> No TopMost will not do. The form cannot be TopMost. >>> It's a hidden menu form and when he user presses Windows+I the menu form >>> must show and come to the foreground (steal the foreground) without >>> being topmost. >>> Any other idea? >>> Kind regards >>> M O J O >>> rowe_newsgroups skrev: >>>> On Nov 13, 10:58 am, M O J O <m...@nospam.nospam> wrote: >>>>> Hi, >>>>> How can I force a form to the foreground no matter what application is >>>>> in front? >>>>> Thanks! >>>>> M O J O >>>> TopMost = True >>>> Thanks, >>>> Seth Rowe- Hide quoted text - >> - Show quoted text - > > So, your trying to force a window to steal focus... Well, in the old > days you used to do that by calling SetForegroundWindow - the problem > is that this won't always work anymore. Microsoft "fixed" this > function in Windows98 timeframe to prevent exactly what your trying to > do - steal the focus... > > Fortunately, there is a way around it. But, it involves a little more > work - you have to couple the call with a call to AttachThreadInput. > All-in-all your looking at several api calls. Here is an example in > classic VB, by the great Karl Peterson: > > http://vb.mvps.org/samples/project.asp?id=ForceFore > > If you need help converting this to VB.NET, let us know. > > -- > Tom Shelton > > It is already VB. :o) It may be VB, but it isn't VB.Net :-)I didn't download the code, but judging by the timestamp it was last updated while VB.NET was still pre-release. One thing you might need to do is update the API calls to the .Net equivalents, and for that you should see www.pinvoke.net After the conversion, let us know if the error disappears. Thanks, Seth Rowe On Nov 13, 11:45 am, rowe_newsgroups <rowe_em***@yahoo.com> wrote:
Show quoteHide quote > > It is already VB. :o) Seth, you are correct - it's VB Classic. I'm fairly sure, that I> > It may be VB, but it isn't VB.Net :-) > > I didn't download the code, but judging by the timestamp it was last > updated while VB.NET was still pre-release. One thing you might need > to do is update the API calls to the .Net equivalents, and for that > you should seewww.pinvoke.net > > After the conversion, let us know if the error disappears. > > Thanks, > > Seth Rowe indicated that in my post :) If not, I apologize to the OP. -- Tom Shelton Hi MOJO,
Yes, jsut as Tom stated, calling AttachThreadInput with SetForegroundWindow will definitely bring your window to foreground. But this is not a recommended design on Windows, normally, you should just call SetForegroundWindow. If the Windows finds that the end user is busy doing operations, it will flash your window with blue colors in the taskbar. This is a more recommended behavior than using AttachThreadInput. Furthermore, SetForegroundWindow Win32 API is encapsulated in the .Net Framework Form.Activate() method. Public Sub Activate() IntSecurity.ModifyFocus.Demand If (MyBase.Visible AndAlso MyBase.IsHandleCreated) Then If Me.IsMdiChild Then Me.MdiParentInternal.MdiClient.SendMessage(&H222, MyBase.Handle, 0) Else UnsafeNativeMethods.SetForegroundWindow(New HandleRef(Me, MyBase.Handle)) End If End If End Sub So you may call me.Activate() to bring the form to the foreground. Hope this helps. Best regards, Jeffrey Tan Microsoft Online Community Support ================================================== Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif ications. Note: The MSDN Managed Newsgroup support offering is for non-urgent issues where an initial response from the community or a Microsoft Support Engineer within 1 business day is acceptable. Please note that each follow up response may take approximately 2 business days as the support professional working with you may need further investigation to reach the most efficient resolution. The offering is not appropriate for situations that require urgent, real-time or phone-based interactions or complex project analysis and dump analysis issues. Issues of this nature are best handled working with a dedicated Microsoft Support Engineer by contacting Microsoft Customer Support Services (CSS) at http://msdn.microsoft.com/subscriptions/support/default.aspx. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights. On Nov 13, 8:16 pm, je***@online.microsoft.com ("Jeffrey Tan[MSFT]")
wrote: Show quoteHide quote > Hi MOJO, Hmmm... Learns something new each day. I know it's not> > Yes, jsut as Tom stated, calling AttachThreadInput with SetForegroundWindow > will definitely bring your window to foreground. But this is not a > recommended design on Windows, normally, you should just call > SetForegroundWindow. If the Windows finds that the end user is busy doing > operations, it will flash your window with blue colors in the taskbar. This > is a more recommended behavior than using AttachThreadInput. > > Furthermore, SetForegroundWindow Win32 API is encapsulated in the .Net > Framework Form.Activate() method. > Public Sub Activate() > IntSecurity.ModifyFocus.Demand > If (MyBase.Visible AndAlso MyBase.IsHandleCreated) Then > If Me.IsMdiChild Then > Me.MdiParentInternal.MdiClient.SendMessage(&H222, > MyBase.Handle, 0) > Else > UnsafeNativeMethods.SetForegroundWindow(New HandleRef(Me, > MyBase.Handle)) > End If > End If > End Sub > > So you may call me.Activate() to bring the form to the foreground. > "recommended", but there times when it makes sense - like the Outlook notification type windows as the OP mentioned. So, could you call AttachThreadInput and then call Form.Activate? I might have to try taht :) -- Tom Shelton Hi Tom,
Yes, if you really have such requirement, you may p/invoke AttachThreadInput and then call Form.Activate. Additionally, I am not sure if Outlook calls AttachThreadInput internally, but I do not think so. Because while I am performing daily works, the Outlook Reminder or New Item Alert dialogs will just flash in the task. It seems that they will not jump to the foreground rudely. Anyway, this is my usage experience of Outlook :-). Thanks. Best regards, Jeffrey Tan Microsoft Online Community Support ================================================== Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif ications. Note: The MSDN Managed Newsgroup support offering is for non-urgent issues where an initial response from the community or a Microsoft Support Engineer within 1 business day is acceptable. Please note that each follow up response may take approximately 2 business days as the support professional working with you may need further investigation to reach the most efficient resolution. The offering is not appropriate for situations that require urgent, real-time or phone-based interactions or complex project analysis and dump analysis issues. Issues of this nature are best handled working with a dedicated Microsoft Support Engineer by contacting Microsoft Customer Support Services (CSS) at http://msdn.microsoft.com/subscriptions/support/default.aspx. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights. HI guys,
Do you both make anti spam software to sell as everybody is setting there spam on top of all other applications and make with that using the computer impossible. Please don't support this so much? :-) CorI forgot to tell the reason not to support it to much, now this thread has
almost every search word in it to search how to do it on Internet. Cor On Nov 13, 10:40 pm, je***@online.microsoft.com ("Jeffrey Tan[MSFT]")
wrote: > Hi Tom, Your probably right thinking about it... When an outlook popup> > Yes, if you really have such requirement, you may p/invoke > AttachThreadInput and then call Form.Activate. > > Additionally, I am not sure if Outlook calls AttachThreadInput internally, > but I do not think so. Because while I am performing daily works, the > Outlook Reminder or New Item Alert dialogs will just flash in the task. It > seems that they will not jump to the foreground rudely. Anyway, this is my > usage experience of Outlook :-). > > Thanks. occurs, it does show up on top, and then fades out if ignored - but it doesn't steal the focus. -- Tom Shelton Hi Tom,
I'm not talking about the Outlook new message popup - I'm talking about the reminder popup. On my PC the reminder popup steals focus. :o) M O J OTom Shelton skrev: Show quoteHide quote > On Nov 13, 10:40 pm, je***@online.microsoft.com ("Jeffrey Tan[MSFT]") > wrote: >> Hi Tom, >> >> Yes, if you really have such requirement, you may p/invoke >> AttachThreadInput and then call Form.Activate. >> >> Additionally, I am not sure if Outlook calls AttachThreadInput internally, >> but I do not think so. Because while I am performing daily works, the >> Outlook Reminder or New Item Alert dialogs will just flash in the task. It >> seems that they will not jump to the foreground rudely. Anyway, this is my >> usage experience of Outlook :-). >> >> Thanks. > > Your probably right thinking about it... When an outlook popup > occurs, it does show up on top, and then fades out if ignored - but it > doesn't steal the focus. > > -- > Tom Shelton > On Nov 14, 2:21 am, M O J O <m...@nospam.nospam> wrote:
Show quoteHide quote > Hi Tom, Ok, those definately do....> > I'm not talking about the Outlook new message popup - I'm talking about > the reminder popup. On my PC the reminder popup steals focus. > > :o) > > M O J O > > Tom Shelton skrev: > > > > > On Nov 13, 10:40 pm, je***@online.microsoft.com ("Jeffrey Tan[MSFT]") > > wrote: > >> Hi Tom, > > >> Yes, if you really have such requirement, you may p/invoke > >> AttachThreadInput and then call Form.Activate. > > >> Additionally, I am not sure if Outlook calls AttachThreadInput internally, > >> but I do not think so. Because while I am performing daily works, the > >> Outlook Reminder or New Item Alert dialogs will just flash in the task. It > >> seems that they will not jump to the foreground rudely. Anyway, this is my > >> usage experience of Outlook :-). > > >> Thanks. > > > Your probably right thinking about it... When an outlook popup > > occurs, it does show up on top, and then fades out if ignored - but it > > doesn't steal the focus. > > > -- > > Tom Shelton- Hide quoted text - > > - Show quoted text - -- Tom Shelton On Nov 14, 1:53 am, Tom Shelton <tom_shel***@comcast.net> wrote:
Show quoteHide quote > On Nov 13, 10:40 pm, je***@online.microsoft.com ("Jeffrey Tan[MSFT]") IIRC for showing an application without stealing the focus, you have> wrote: > > > Hi Tom, > > > Yes, if you really have such requirement, you may p/invoke > > AttachThreadInput and then call Form.Activate. > > > Additionally, I am not sure if Outlook calls AttachThreadInput internally, > > but I do not think so. Because while I am performing daily works, the > > Outlook Reminder or New Item Alert dialogs will just flash in the task. It > > seems that they will not jump to the foreground rudely. Anyway, this is my > > usage experience of Outlook :-). > > > Thanks. > > Your probably right thinking about it... When an outlook popup > occurs, it does show up on top, and then fades out if ignored - but it > doesn't steal the focus. > > -- > Tom Shelton to override the sort-of "hidden" property ShowWithoutActivation to always return True. I used this a few years ago when I wrote a reminder program that operated like the Outlook reminder (fading in with a message unobtrusively, and then fading out if ignored by the user). Oh, the memories.... :-) Thanks, Seth Rowe Hi guys,
Thank you all for helping me out here!! I REALLY appriciate it. :o)) M O J OM O J O skrev: Show quoteHide quote > Hi, > > How can I force a form to the foreground no matter what application is > in front? > > Thanks! > > M O J O
Problem drawing a WMF File VB.NET2005 (and Working in VB6)
unsure of what I'm doing & need info check array size when variable = nothing Edit Menu Picking the right control Populating an ImageList Scroll picture box How to send something to Com Port. WebClient() Prepare yourself for ASP.Net Certification |
|||||||||||||||||||||||