Notifications
Clear all

[Closed] get dotnet functions on max

Hey guys, I’m trying to implement a function to modify the padding of a dotnet listview displaying icons, I found this post:
http://qdevblog.blogspot.mx/2011/11/c-listview-item-spacing.html

but due to my basic understanding of how to apply dotNet in max I’m having trouble:
first I don’t know how to replace the “using” part to import the class, I’ve used DotNetClass and the path but get “undefined”
I also don’t get how to [DllImport(“user32.dll”)].

Should I just make a Dll and use it in maxscript? is there an easyer way?

3 Replies

you don’t need .net to set listview padding. you can do all with mxs:

LVM_FIRST = 0x1000 
LVM_SETICONSPACING = LVM_FIRST + 53   
windows.SendMessage listview.Handle LVM_SETICONSPACING 0 (MakeLong leftPadding topPadding)  

MakeLong function you can easily write yourself

Thanks Denis, I’ll give it a try!

It Works!,
just a couple of questions to better understand what is happening:

in the return function:
return (int)(((ushort)lowPart) | (uint)(highPart << 16));
basically what’s going on is there’s a logical OR operation that gives preference to the highest number (or maybe to the valid number depending if the ushort type is valid?)

what does windows.SendMessage does exactly?, why is it necessary to use it?

I found this:
https://msdn.microsoft.com/en-us/library/bb761176(VS.85).aspx
is there a difference between LVM_SETICONSPACING message and using it as a variable like we are doing it?