CGTalk > Software > Autodesk 3ds max > 3dsMax SDK and MaxScript
Login register
Thread Closed share thread « Previous Thread | Next Thread »
 
Thread Tools Search this Thread Display Modes
Old 05-10-2013, 02:28 PM   #16
denisT
MAX Doctor
 
denisT's Avatar
portfolio
Denis Trofimov
CA, USA
 
Join Date: Jul 2009
Posts: 9,424
Send a message via ICQ to denisT
Quote:
Originally Posted by lo
btw, if you are using max2014, you can just use
Code:
windows.getWindowPos

oh! at long last!
 
Old 05-10-2013, 02:29 PM   #17
denisT
MAX Doctor
 
denisT's Avatar
portfolio
Denis Trofimov
CA, USA
 
Join Date: Jul 2009
Posts: 9,424
Send a message via ICQ to denisT
here is my version:
Code:
fn windowRectAssembly = ( source = "using System;\n" source += "using System.Runtime.InteropServices;\n" source += "class User32\n" source += "{\n" source += " [DllImport(\"user32.dll\", EntryPoint=\"GetWindowRect\")]\n" source += " static extern bool GetWindowRect(IntPtr hWnd, out POS rect);\n" source += " struct POS\n" source += " {\n" source += " public int Left;\n" source += " public int Top;\n" source += " public int Right;\n" source += " public int Bottom;\n" source += " }\n" source += " public int[] GetWindowRect(Int64 hWnd)\n" source += " {\n" source += " POS rect;\n" source += " if (GetWindowRect((IntPtr)hWnd, out rect))\n" source += " {\n" source += " return new int[] { rect.Left, rect.Top, rect.Right, rect.Bottom };\n" source += " }\n" source += " return new int[4];\n" source += " }\n" source += "}\n" csharpProvider = dotnetobject "Microsoft.CSharp.CSharpCodeProvider" compilerParams = dotnetobject "System.CodeDom.Compiler.CompilerParameters" compilerParams.GenerateInMemory = true compilerResults = csharpProvider.CompileAssemblyFromSource compilerParams #(source) ((compilerResults.CompiledAssembly).CreateInstance "User32").GetWindowRect ) global getWindowRect = windowRectAssembly() fn getMaximumViewSize = ( local vp_hwnd = for c in (windows.getchildrenhwnd #max) where c[4] == "ViewPanel" do exit with c[1] /* s = getWindowRect vp_hwnd [s[3]-s[1]-4, s[4]-s[2]-4] -- not stricly enough because of this (-4) */ local xs = #(), ys = #() for c in (windows.getchildrenhwnd vp_hwnd) where c[4] == "Label" do ( s = getWindowRect c[1] join xs #(s[1], s[3]) join ys #(s[2], s[4]) ) [amax xs, amax ys] - [amin xs, amin ys] ) getMaximumViewSize()
 
Old 05-10-2013, 02:31 PM   #18
lo
the frequentest!
portfolio
Rotem Shiffman
Tel Aviv, Israel
 
Join Date: Jul 2005
Posts: 2,832
Well, that depends on what the OP is trying to achieve... I just thought they want the size of the viewpanel.
 
Old 05-10-2013, 02:33 PM   #19
lo
the frequentest!
portfolio
Rotem Shiffman
Tel Aviv, Israel
 
Join Date: Jul 2005
Posts: 2,832
Quote:
Originally Posted by denisT
oh! at long last!


You'll be surprised to hear that they even exposed SetWindowPos
 
Old 05-10-2013, 02:35 PM   #20
denisT
MAX Doctor
 
denisT's Avatar
portfolio
Denis Trofimov
CA, USA
 
Join Date: Jul 2009
Posts: 9,424
Send a message via ICQ to denisT
Quote:
Originally Posted by lo
Well, that depends on what the OP is trying to achieve... I just thought they want the size of the viewpanel.

he asked about maximum size of viewport. it's what getViewSize returns for maximized view.
 
Old 05-10-2013, 02:39 PM   #21
denisT
MAX Doctor
 
denisT's Avatar
portfolio
Denis Trofimov
CA, USA
 
Join Date: Jul 2009
Posts: 9,424
Send a message via ICQ to denisT
Quote:
Originally Posted by lo
You'll be surprised to hear that they even exposed SetWindowPos

wow! so wide expanse opens for rookies.
 
Old 05-10-2013, 02:39 PM   #22
momo2012
PRO
 
momo2012's Avatar
portfolio
momo
GaoXiong, Taiwan
 
Join Date: Feb 2013
Posts: 180
Quote:
Originally Posted by denisT
here is my version:
Code:
fn windowRectAssembly = ( source = "using System;\n" source += "using System.Runtime.InteropServices;\n" source += "class User32\n" source += "{\n" source += " [DllImport(\"user32.dll\", EntryPoint=\"GetWindowRect\")]\n" source += " static extern bool GetWindowRect(IntPtr hWnd, out POS rect);\n" source += " struct POS\n" source += " {\n" source += " public int Left;\n" source += " public int Top;\n" source += " public int Right;\n" source += " public int Bottom;\n" source += " }\n" source += " public int[] GetWindowRect(Int64 hWnd)\n" source += " {\n" source += " POS rect;\n" source += " if (GetWindowRect((IntPtr)hWnd, out rect))\n" source += " {\n" source += " return new int[] { rect.Left, rect.Top, rect.Right, rect.Bottom };\n" source += " }\n" source += " return new int[4];\n" source += " }\n" source += "}\n" csharpProvider = dotnetobject "Microsoft.CSharp.CSharpCodeProvider" compilerParams = dotnetobject "System.CodeDom.Compiler.CompilerParameters" compilerParams.GenerateInMemory = true compilerResults = csharpProvider.CompileAssemblyFromSource compilerParams #(source) ((compilerResults.CompiledAssembly).CreateInstance "User32").GetWindowRect ) global getWindowRect = windowRectAssembly() fn getMaximumViewSize = ( local vp_hwnd = for c in (windows.getchildrenhwnd #max) where c[4] == "ViewPanel" do exit with c[1] /* s = getWindowRect vp_hwnd [s[3]-s[1]-4, s[4]-s[2]-4] -- not stricly enough because of this (-4) */ local xs = #(), ys = #() for c in (windows.getchildrenhwnd vp_hwnd) where c[4] == "Label" do ( s = getWindowRect c[1] join xs #(s[1], s[3]) join ys #(s[2], s[4]) ) [amax xs, amax ys] - [amin xs, amin ys] ) getMaximumViewSize()


I've test ,works like a charm.thanks
 
Old 05-10-2013, 06:04 PM   #23
spacefrog
Frog of the posts
 
spacefrog's Avatar
Josef Wienerroither
Freelance
Vienna, Austria
 
Join Date: Sep 2002
Posts: 2,425
you even can set the viewpanel to any arbitrary size via script now ( at least in Nitrous), totally independent from the application window dimensions

Code:
nitrousgraphicsmanager.PinViewPanelSize <integer>width <integer>height nitrousgraphicsmanager.UnpinViewPanelSize()

or the whole application window

Code:
nitrousgraphicsmanager.SetAppWindowSize <integer>width <integer>height nitrousgraphicsmanager.SetAppWindowPos <integer>x <integer>y


And there's
Code:
nitrousgraphicsmanager.BackgroundProgressiveRender ingEnabled <bool>


now...
But i'm sure nobody has any use for this, especially not PowerPreview users


Quote:
what does it do if the active view is 0? (any extended viewport)


It simply captures the whole viewpanel DIB region.
Meaning you can't really use it for viewport captures (as i suggested above), becuase you always would get overlapping max windows with this capture method. But for viewpanel size info it's enough
__________________

PowerPreview: High Quality Nitrous Previews for 3ds Max 2012|2013|2014

[ Free Download (ScriptSpot) ]

Home of The Frogs | Online Portfolio
 
Old 05-10-2013, 06:17 PM   #24
denisT
MAX Doctor
 
denisT's Avatar
portfolio
Denis Trofimov
CA, USA
 
Join Date: Jul 2009
Posts: 9,424
Send a message via ICQ to denisT
Quote:
Originally Posted by spacefrog
now...
But i'm sure nobody has any use for this...

oh! how much the max was littered in recent times...
 
Old 05-10-2013, 06:17 PM   #25
CGTalk Moderation
Lord of the posts
CGTalk Forum Leader
 
Join Date: Sep 2003
Posts: 1,066,481
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 10:21 PM.


Powered by vBulletin
Copyright ©2000 - 2016, Jelsoft Enterprises Ltd.