Notifications
Clear all

[Closed] Bring Max Process to Front

same for me…
anyway, I put the SwitchToThisWindow method in my mxs extension … although I don’t know how it works and how it can help

Actually the very best use of this on Windows 10 is to combine both…

So you trigger switchToThisWindow() then trigger the toast notification… this way if the toast dissappears (side-note can we make it stay up until clicked?) then the user can see max is trying to get attention because it’s flashing on the taskbar.

Unfortunately not.

public void ShowBalloonTip (int timeout);

This parameter is deprecated as of Windows Vista. Notification display times are now based on system accessibility settings. (URL)

Even if we could, it could be overridden by another notification.

But having it flashing on the taskbar is good.

PD: If 3ds Max is minimized, it won’t be maximized, at least it doesn’t for me.

Here is another option that seems to work.

The good: no need to compile.
The bad: it won’t work if Max is minimized neither.

(
	
	fn SwitchToMax sender args =
	(
		form   = dotnetobject "MaxCustomControls.MaxForm"
		intPtr = dotnetobject "System.IntPtr" (windows.getMAXHWND())
		--hwnd   = dotnetobject "MaxCustomControls.Win32HandleWrapper" intPtr
		hwnd   = (dotnetobject "System.Windows.Forms.NativeWindow").FromHandle intPtr
		
		--form.Opacity = 0
		form.Show hwnd
		form.Activate()
		form.TopMost = true
		form.TopMost = false
		form.Dispose()
		
		sender.Dispose()
	)
	
	fn Notify =
	(
		NotifyIcon                 = dotnetobject "System.Windows.Forms.NotifyIcon"
		NotifyIcon.BalloonTipTitle = "3ds Max Notification"
		NotifyIcon.BalloonTipText  = "Task Completed!"
		NotifyIcon.Visible         = true
		
		/* Application Asterisk Error Exclamation Hand Information Question Shield Warning WinLogo */
		NotifyIcon.Icon = (dotnetclass "System.Drawing.SystemIcons").Asterisk
		
		dotnet.addeventhandler NotifyIcon "BalloonTipClicked" SwitchToMax
		dotnet.addeventhandler NotifyIcon "Click"             SwitchToMax
		
		NotifyIcon.ShowBalloonTip 0
	)
	
	try (destroydialog ::RO_TEST) catch()

	rollout RO_TEST "" width:242 height:72
	(
		label lb "A NOTIFICATION WILL BE SEND OUT IN: 5" pos:[12,24]
		timer clock "" interval:1000
		
		local counter = 5
		
		on clock tick do
		(
			counter -= 1
			if counter == 0 do
			(
				Notify()
				destroydialog RO_TEST
			)
			lb.text = "A NOTIFICATION WILL BE SEND OUT IN: " + (counter as string)
		)
	)
	
	createdialog RO_TEST
	
)

windows.SendMessage hwnd WM_SYSCOMMAND SC_RESTORE 0

Page 3 / 3