Minimized another application

  • (2 Pages)
  • +
  • 1
  • 2

15 Replies - 3623 Views - Last Post: 26 December 2012 - 10:21 AM Rate Topic: -----

#1 Neph1x  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 110
  • Joined: 19-November 11

Minimized another application

Posted 25 December 2012 - 11:17 AM

Hy!
I need a help with checking if another application or games is minimized!
So if i minimize my game screen or exp. notepad application my vb application will sey me "app is minimized"

DO you have some idea for that?
Thank you!
Is This A Good Question/Topic? 0
  • +

Replies To: Minimized another application

#2 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 8392
  • View blog
  • Posts: 31,200
  • Joined: 12-June 08

Re: Minimized another application

Posted 25 December 2012 - 11:19 AM

Odd question - if you minimized it then wouldn't know it is minimized and not need a pop up telling you the action you just took two seconds before?
Was This Post Helpful? 0
  • +
  • -

#3 Neph1x  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 110
  • Joined: 19-November 11

Re: Minimized another application

Posted 25 December 2012 - 11:28 AM

i know that i was minimize that, but i making application for taking screenshots in games, so if user minimize his game than applications will not take screenshots! App taking screenshots let's say every 10 minit.
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 8392
  • View blog
  • Posts: 31,200
  • Joined: 12-June 08

Re: Minimized another application

Posted 25 December 2012 - 11:29 AM

See.. that sort of complete explanation is nice to know.

(Side note - see.. this is your original thread.. it doesn't needed a second one so I closed the other).
Was This Post Helpful? 0
  • +
  • -

#5 lucky3  Icon User is offline

  • Friend lucky3 As IHelpable
  • member icon

Reputation: 231
  • View blog
  • Posts: 765
  • Joined: 19-October 11

Re: Minimized another application

Posted 25 December 2012 - 11:36 AM

You can use user32.dll ShowWindow function. You'll need window handle for using it, and you can get it with FindWindow function. To use user32.dll functions, you decorate it with <System.Runtime.InteropServices.DllImport("user32.dll")>.

Edit: forgot to mention you need to import: System.Runtime.InteropServices

This post has been edited by lucky3: 25 December 2012 - 11:38 AM

Was This Post Helpful? 1
  • +
  • -

#6 Neph1x  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 110
  • Joined: 19-November 11

Re: Minimized another application

Posted 25 December 2012 - 11:40 AM

Oooh sorry dude i didn't see that!
my internet was blocked for a short time so I might accidentally post two times the same question! sorry

View Postlucky3, on 25 December 2012 - 11:36 AM, said:

You can use user32.dll ShowWindow function. You'll need window handle for using it, and you can get it with FindWindow function. To use user32.dll functions, you decorate it with <System.Runtime.InteropServices.DllImport("user32.dll")>.

Edit: forgot to mention you need to import: System.Runtime.InteropServices


could you explain a little better, I'm doing it for the first time!
Thank you!
Was This Post Helpful? 0
  • +
  • -

#7 lucky3  Icon User is offline

  • Friend lucky3 As IHelpable
  • member icon

Reputation: 231
  • View blog
  • Posts: 765
  • Joined: 19-October 11

Re: Minimized another application

Posted 25 December 2012 - 11:44 AM

No problem. For example FindWindow function:

    <System.Runtime.InteropServices.DllImport("user32.dll")>
    Public Shared Function FindWindow(
       ByVal lpClassName As String,
       ByVal lpWindowName As String) As IntPtr
    End Function



You can use it then with something like this:
Dim WindowHandle As IntPtr = FindWindow(Nothing, "Notepad")
Was This Post Helpful? 1
  • +
  • -

#8 Neph1x  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 110
  • Joined: 19-November 11

Re: Minimized another application

Posted 25 December 2012 - 12:04 PM

I'm stupid for that! I do not understand this.
I would appreciate it if you could give me a example!
I know rule is: Don't tell us to give you code!
but if you could make exception!

maybe when i minimize notepad msgbox will say it!

Thank you.
Was This Post Helpful? 0
  • +
  • -

#9 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 8392
  • View blog
  • Posts: 31,200
  • Joined: 12-June 08

Re: Minimized another application

Posted 25 December 2012 - 12:07 PM

Quote

I know rule is: Don't tell us to give you code!
but if you could make exception!

You get an exception and what do I tell the next person that wants an exception? What about the missed learning opportunity?
Was This Post Helpful? 0
  • +
  • -

#10 Neph1x  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 110
  • Joined: 19-November 11

Re: Minimized another application

Posted 25 December 2012 - 12:09 PM

Ok, sorry..

This post has been edited by Neph1x: 25 December 2012 - 12:10 PM

Was This Post Helpful? 0
  • +
  • -

#11 lucky3  Icon User is offline

  • Friend lucky3 As IHelpable
  • member icon

Reputation: 231
  • View blog
  • Posts: 765
  • Joined: 19-October 11

Re: Minimized another application

Posted 25 December 2012 - 12:11 PM

Well, I'll give you a very general example...
Open new Notepad window, that would remain untitled (don't save it and name it for this example to work).

Then open up new console project, and paste this code to it. If your notepad window is not minimized, the code will do it for you:

Edited the code. I agree with modi

This post has been edited by lucky3: 25 December 2012 - 12:12 PM

Was This Post Helpful? 1
  • +
  • -

#12 Neph1x  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 110
  • Joined: 19-November 11

Re: Minimized another application

Posted 25 December 2012 - 12:32 PM

Can i use this for Window Forms Application?
Was This Post Helpful? 0
  • +
  • -

#13 lucky3  Icon User is offline

  • Friend lucky3 As IHelpable
  • member icon

Reputation: 231
  • View blog
  • Posts: 765
  • Joined: 19-October 11

Re: Minimized another application

Posted 25 December 2012 - 12:51 PM

Sure you can.
Was This Post Helpful? 0
  • +
  • -

#14 Neph1x  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 110
  • Joined: 19-November 11

Re: Minimized another application

Posted 25 December 2012 - 04:37 PM

When i copy > paste this code to console project i getting errors
Was This Post Helpful? 0
  • +
  • -

#15 lucky3  Icon User is offline

  • Friend lucky3 As IHelpable
  • member icon

Reputation: 231
  • View blog
  • Posts: 765
  • Joined: 19-October 11

Re: Minimized another application

Posted 26 December 2012 - 12:14 AM

Neph1x if you're referring to the code in post #7, then remove Shared from function's signature. If this is not the case, please post your error message, so we won't need to guess how to help you ;)
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2