[Closed] [SDK] pblock from HWND
Let’s say I have the HWND of a spinner control in max. I have no info about the control other than its HWND and that its class is a win32 ‘Edit’ control. It could be a spinner in a texmap, or an object, or a utility panel.
Is there any way I can find its parameter block using ONLY the HWND value?
I guess I could iterate every single reference in the file until I find a match…but is there a faster way?
why is every reference? if HWND is created (means dialog is shown) you can know who this dialog belongs to.
num="80"
HWND=134610P
windows.SendMessage HWND 0x0C 0 ((dotnetclass "System.Runtime.InteropServices.Marshal").UnsafeAddrOfPinnedArrayElement (dotnet.ValueToDotNetObject num (dotNetClass "Char[]")) 0)
all the ui with edit area or text can be edited by this way
all the ui with edit area or text can be edited by this way
if your in the sdk and you want to edit the spinner you’d do it like so…
ISpinnerControl* spinner = GetISpinner(hWnd);
spinner->SetValue(80.0f, TRUE);
ReleaseISpinner(spinner);
though I don’t think it has any effect on the pblock associated to it
and for those who prefer c# sdk
(
g = (dotNetClass "Autodesk.Max.GlobalInterface").Instance
s = g.GetISpinner (dotNetObject "System.IntPtr" SpinnerControl_hwnd)
if s != undefined do
(
s.SetValue 100 1
g.ReleaseISpinner s
)
)
because of mxs and sdk can Interoperate with each other , i think no need to absolutely distinguish between the two , it’s ok if it conveniently solved the problem , sdk is more efficient in most cases but need more programming knowledge
it’s ok if it conveniently solved the problem
what like killing your landlord so you don’t have to pay the rent ?
you are perfectionist
maybe for you , there’s no need to add python in max
I think you guys may have misunderstood what I’m trying to do (or maybe I’ve misunderstood your solutions)
I don’t want to get the ISpinnerControl, or the parent HWND or anything…I’m trying to access the ParameterBlock that the spinner UI is connected to.
So, for example, using ONLY the spinner HWND, I could access the keys associated with its parameter block controller.
How?
The problem is further complicated because it’s possible to have ISpinnerControls not connected to any parameter block (and I don’t see a way to get a pblock from an ISpinnerControl)…so it seems like I’d need to iterate existing parameter block param defs and run GetDlgItem on all the ctrl_IDs and match the resulting HWNDs to the HWND in question…
might make the solution a little easier… if you find the parent IRollupWindow HWND you can compare it to pblock->GetMap()->GetHWnd();