PDA

View Full Version : Can't instantiate a Window "System.Windows" :(


cyfer
06-16-2009, 07:56 AM
every time i try to instantiate a window from System.Windows.Window
i get an error telling me that part of memory is corrupted !

window = dotnetobject "System.windows.window"
window.show()

ypuech
06-16-2009, 08:29 AM
I think MAXScript works with .NET Framework 2.0 so you can't use WPF classes etc.

Kameleon
06-16-2009, 08:55 AM
I did some tests in this post http://forums.cgsociety.org/showthread.php?f=98&t=741179&highlight=wpf but some users weren't able to run it... cant figure out why to this day.

Kramsurfer
06-16-2009, 03:37 PM
This Test code worked for me in 3ds Max 2009 x64 on Windows XP64 sp2 with DotNet 3.5 sp1 installed.

Kameleon: As did the code in the related link.

cyfer
06-18-2009, 12:24 AM
@ypuech

seems very true , i just had the impression that it supports framework 3
the ribbon thing is a typical WPF approach

@Kameleon

i've seen the thread when you posted it , the thing is on 32bit system ... it keeps throwing the error
however , confusingly enough ... Richard(Zeboxx) posted a Code that worked for a moment and i had the window then .... Cabooooom
the good news is ... i managed to come up with a new 32 crashing code ... look at the code below !

BTW , you mentioned ... copying the code from the VS to max ... i don't get it ... why can't you parse the Xaml Code and load the ui ?

@Kramsurfer

i guess the code below will work on 64bit with no problem , the point is ... this is not a normal behavior .... imagine a plugin that do not support 32Bit !


well , my test here was based on the assumption that ... maybe its the window thing and when i host a WPF Controls on a windows Form (Derived from MaxForm) ... it will hold
but it didn't

32bit users are very likely to crash with this .....

dotnet.loadassembly "WindowsFormsIntegration.dll"



the_form = dotnetobject "MaxCustomControls.MaxForm"
the_form.size = dotnetobject "System.Drawing.Size" 180 300


the_page = dotnetobject "System.Windows.Controls.page"
the_Button = dotnetobject "System.windows.controls.Button"
the_Button.Content = "Click Me"
the_Button.Height = 30
the_Button.Height = 60
the_page.Content = the_Button

the_Host = dotnetobject "System.Windows.Forms.Integration.ElementHost"
the_Host.AccessibleName = "theHost"
the_Host.Backcolor = the_Host.Backcolor.White
the_Host.Child = the_page
the_Host.Parent = the_form



the_form.showmodeless()

Blanks
09-15-2009, 04:06 PM
If I use your code I get the same error but in a selection window. When I click continue the window renders with the WPF button in it but it doesn't seem to be functional. Just thought I would let you know

CGTalk Moderation
09-15-2009, 04:06 PM
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.