Get Window Pos?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Vancete
    No longer a forum member
    • May 2006
    • 97

    Get Window Pos?

    How can I get if my Window is in the top or in the bottom of all windows?
    Greetings!
  • RizlaUK
    Indigo Rose Customer
    • May 2006
    • 5552

    #2
    here is a function to do as you ask, you will need winapi plugin from the below site



    Code:
    -- add to global gunctions
    function IsAppTopLevel(sWindowName)
    	fHwnd = WinApi.GetForegroundWindow();
    	aHwnd = Application.GetWndHandle();
    	local ret = false
    	if fHwnd == aHwnd then
    		ret = true
    	end
    	return ret
    end
    
    -- example use
    if IsAppTopLevel("TopLevelWindow") then
    	Label.SetText("Label1", "App is on top");
    else
    	Label.SetText("Label1", "App is NOT on top");
    end
    Embrace change in your life, you never know, it could all work out for the best

    Comment

    • pem
      New Member
      • Dec 2007
      • 21

      #3
      Or if you dont want use plugin, you can use it :

      Code:
      -- add to global gunctions
      function IsAppTopLevel()
       local fHwnd, aHwnd
      	fHwnd = tonumber(DLL.CallFunction("user32.dll", "GetForegroundWindow", "", DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL));
      	aHwnd = Application.GetWndHandle();
      	if fHwnd == aHwnd then
      		return true
      	else
      		return false
      	end
      end
      
      -- example use
      if IsAppTopLevel() then
      	Label.SetText("Label1", "App is on top");
      else
      	Label.SetText("Label1", "App is NOT on top");
      end
      Enjoy it
      Last edited by pem; 08-08-2008, 03:14 PM.

      Comment

      • RizlaUK
        Indigo Rose Customer
        • May 2006
        • 5552

        #4
        the thing is, i should have known that, why not just call the dll, what am i thinking, guess im just getting to plugin dependant, lol
        Embrace change in your life, you never know, it could all work out for the best

        Comment

        • Vancete
          No longer a forum member
          • May 2006
          • 97

          #5
          Thanks a lot guys!:yes
          I will try It.
          Greetings!

          Comment

          • Imagine Programming
            Indigo Rose Customer
            • Apr 2007
            • 4252

            #6
            Is there also a way to set the window on top on runtime?

            thanks.
            Bas Groothedde
            Imagine Programming :: Blog

            AMS8 Plugins
            IMXLH Compiler

            Comment

            • RizlaUK
              Indigo Rose Customer
              • May 2006
              • 5552

              #7
              to set ontop (sticky)
              Code:
              Window.SetOrder(Application.GetWndHandle(),  HWND_TOPMOST);

              to set NOT ontop (not sticky)
              Code:
              Window.SetOrder(Application.GetWndHandle(),  HWND_NOTOPMOST);
              Embrace change in your life, you never know, it could all work out for the best

              Comment

              • Imagine Programming
                Indigo Rose Customer
                • Apr 2007
                • 4252

                #8
                LoL thanks Rizla, i should of looked there:P thanks
                Bas Groothedde
                Imagine Programming :: Blog

                AMS8 Plugins
                IMXLH Compiler

                Comment

                Working...
                X