Results 1 to 15 of 15

Thread: Bring active window on the top..?

  1. #1

    Thread Starter
    Lively Member Atte's Avatar
    Join Date
    Feb 2004
    Posts
    79

    Bring active window on the top..?

    My application is calling an other process. If that process is already runnning then my application does not open a new instance, but use AppActivate.

    How can i bring this activated application window to the front (from Windows toolbar)..?

    thks for any help...

  2. #2
    Frenzied Member Mike Hildner's Avatar
    Join Date
    Jul 2002
    Location
    Des Moines, NM
    Posts
    1,690
    Something like this? Me.WindowState = FormWindowState.Normal or .Maximized

    HTH,
    Mike

  3. #3

    Thread Starter
    Lively Member Atte's Avatar
    Join Date
    Feb 2004
    Posts
    79
    the problem is that i'm calling the application from different process..

  4. #4
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949
    "the problem is that i'm calling the application from different process.."

    What do you mean by "process"? Project? Procedure? Solution? Another language?
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

  5. #5

    Thread Starter
    Lively Member Atte's Avatar
    Join Date
    Feb 2004
    Posts
    79
    It's a different Windows Form Project (exe) running in windows as an independent process... Both in same vb.net Solution.

  6. #6
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949
    Hi,

    "Something like this? Me.WindowState = rmWindowState.Normal or .Maximized"

    instead of Me use ProjectName.FormName
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

  7. #7
    Frenzied Member Mike Hildner's Avatar
    Join Date
    Jul 2002
    Location
    Des Moines, NM
    Posts
    1,690
    Wow, taxes, I didn't know one could do that. Cool.

  8. #8

    Thread Starter
    Lively Member Atte's Avatar
    Join Date
    Feb 2004
    Posts
    79
    That's about what i supposed it to be from beginning (i'm quite new with .net), but in my Solution i can't refer to other Projects...

    I must have some base thing wrong..?

  9. #9
    Frenzied Member Mike Hildner's Avatar
    Join Date
    Jul 2002
    Location
    Des Moines, NM
    Posts
    1,690
    taxes may know, I sure don't - you can't even reference another project unless it's a .dll.

    I just tried putting Me.WindowState = FormWindowState.Normal in the Activated event - that seems to work just fine, but not sure if that's what you want.

    Mike

  10. #10

    Thread Starter
    Lively Member Atte's Avatar
    Join Date
    Feb 2004
    Posts
    79
    Me.WindowState = FormWindowState.Normal works fine....

    The point and problem is that i'm not calling Me. but other Project.

    Any idea how to set "normal window state" to other application (say Calculator for example) without opening a new instance of it..?

    With Shell i can set the windows state, but don't know how to avoid opening always a new instance....

  11. #11
    Frenzied Member Mike Hildner's Avatar
    Join Date
    Jul 2002
    Location
    Des Moines, NM
    Posts
    1,690
    Oh - I see what you're saying now - I thought the form that you wanted to bring up from the taskbar was your own code.

    Not sure if there's anything in .NET to do that, but maybe an API call like SetWindowPos would help http://msdn.microsoft.com/library/de...tWindowPos.asp or the BringWindowToTop function.

  12. #12
    Frenzied Member Mike Hildner's Avatar
    Join Date
    Jul 2002
    Location
    Des Moines, NM
    Posts
    1,690
    ok - I just re-read your posts. If the form you want to bring up from the task bar is your own code, then the Me business will work.

    I have this code in WindowsApplication1 - the title of the form is "Form1"
    VB Code:
    1. Private Sub Form1_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Activated
    2.         Me.WindowState = FormWindowState.Normal
    3.     End Sub

    This code is in WindowsApplication2
    VB Code:
    1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    2.         AppActivate("Form1")
    3.     End Sub

    And that works.

  13. #13

    Thread Starter
    Lively Member Atte's Avatar
    Join Date
    Feb 2004
    Posts
    79
    Sorry, i was not too clear in my msgs...
    Thks yrs, i'll check the link...

    I'm getting a bit frustrated with this problem, as AppActivate works simply and perfectly if the application is not minimized in the windows toolbar...

  14. #14

    Thread Starter
    Lively Member Atte's Avatar
    Join Date
    Feb 2004
    Posts
    79
    i missed yr latest, that looks good... will try it.

  15. #15

    Thread Starter
    Lively Member Atte's Avatar
    Join Date
    Feb 2004
    Posts
    79
    And that works. Thanks a lot, i knew there's an easy way out...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width