Results 1 to 8 of 8

Thread: API call to lock toolbars?

  1. #1

    Thread Starter
    New Member brain_catcher's Avatar
    Join Date
    Jul 2006
    Posts
    4

    Question API call to lock toolbars?

    Is there an API Declaration that I can call via VBA to lock the position of the toolbars?

  2. #2
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: API call to lock toolbars?

    Most likely not, the Office toolbars are a custom control and there is no standard "lock position" message that I am aware of.

    You could try your luck in the Office Development forum. Make sure you post what version of Office you're using.

    Welcome to the forums.

  3. #3

    Thread Starter
    New Member brain_catcher's Avatar
    Join Date
    Jul 2006
    Posts
    4

    Re: API call to lock toolbars?

    Sorry i didnt mention the specific application. Im working in VBA for Autocad, and I wish to lock those toolbars that i accidentally move while I work. I already posted in AutoCAD's forum but they suggested to download some 3rd party application to lock these toolbars. But I want to lock it without loading 3rd party apps. If there's a thing like that, I thought that maybe there's an API call that I can use. just guessing.
    I'll try posting in Office Development. I hope VBA for other applications posts are also welcome in that thread. Thanks.

  4. #4
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: API call to lock toolbars?

    Ah, well that might be different, I'm not sure how AutoCAD's toolbars work, they are most likely different to Office's.

  5. #5
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: API call to lock toolbars?

    You may want to try something like this but modify for AutoCads VBA but they should be compaitble.
    VB Code:
    1. Dim oCB As Office.CommandBar
    2. Set oCB = Application.CommandBars.Item("Standard")
    3. oCB.Protection = msoBarNoChangeDock Or msoBarNoMove Or msoBarNoCustomize
    You will need to change it to reflect the toolbar name you want to lock.

    VBA is licensed from MS and should include the Office reference or similar.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  6. #6

    Thread Starter
    New Member brain_catcher's Avatar
    Join Date
    Jul 2006
    Posts
    4

    Re: API call to lock toolbars?

    Yes, in fact the VBA interface are the same.

    I loaded the MS Office 11 type library to have access for that Command Bar object and tried to set it to AutoCAD applications toolbar (coz AutoCAD doesn't have command bars) but I've got the 'type mismatch' error. Maybe because in MS Office its a Command Bar (custom control-as posted) and not a standard toolbar.
    Last edited by brain_catcher; Jul 28th, 2006 at 03:45 AM. Reason: spelling

  7. #7
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: API call to lock toolbars?

    Hmm, then try using MS Spy++ and see what the toolbars window class name is. Once you have that you can declare your objects as that type and should get you farther.

    Yes, to be licensed to integrate VBA IDE into an application you need to pay some decent $'s and you may have commandbars for the VBA IDE but will be different for AutoCads GUI.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  8. #8

    Thread Starter
    New Member brain_catcher's Avatar
    Join Date
    Jul 2006
    Posts
    4

    Re: API call to lock toolbars?

    I use EliteSpy and these are the results.

    Window Handle: 2163946
    Window Caption:
    Window Class: ToolbarWindow32
    Window Style: WS_CHILD WS_CLIPSIBLINGS WS_VISIBLE
    Rectangle: (374, 73) - (853, 102)
    Parent Handle: 2229562
    Parent Caption: AutoCAD Tools
    Parent Class: AfxWnd70

    Test made on one of the toolbars. In fact I can enable, disable, show and hide, by EliteSpy. But to lock, there is none.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width