Loading Partial CUI's at Startup

/ Published in: C#
Save to your folder(s)

Copy this code and paste it in your HTML
  1. Try
  2. 'Load Main CUI Name
  3. Dim mainCuiFiles As String = Application.GetSystemVariable("MENUNAME")
  4. mainCuiFiles += ".cui"
  5. Dim cs As New CustomizationSection(mainCuiFiles)
  6. 'set default directory for your custom cui
  7. Dim pwgscCui As String = DEFAULTDIR + "pwgsc.cui"
  8. 'Find out the current workspace settings name
  9. Dim ws As String = Application.GetSystemVariable("WSCURRENT")
  10. ' check to see if partial cui is loaded
  11. If cs.PartialCuiFiles.Contains(pwgscCui) = False Then
  12. 'if your cui isn't loaded it and refresh all workspaces
  13. Application.MenuGroups.Load(pwgscCui)
  14. 'refresh current workspace to show toolbars and menu's
  15. Application.SetSystemVariable("WSCURRENT", ws)
  16. Else
  17. 'refresh current workspace to show toolbars and menu's
  18. Application.SetSystemVariable("WSCURRENT", ws)
  19. End If
  20. Catch Ex As System.Exception
  21. System.Windows.Forms.MessageBox.Show(Ex.ToString, "ERROR LOADING")
  22. End Try

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.