VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

create a menu in a userform

6 REPLIES 6
Reply
Message 1 of 7
contactALQK9
1099 Views, 6 Replies

create a menu in a userform

contactALQK9
Explorer
Explorer

Hello,

i would like to create a menu in a userform.

That was easy to do (thanks to api) to create a menu and submenu in vba 32 bits.

I managed to do it in vba 64 bits for Zwcad.

 

But I have a problem with vba 64 bits for Autocad.

when i use TrackPopupMenuEx , the menu appears in gray not enable to click.

 

If you have an idea to solve the problem ... thank you.

0 Likes

create a menu in a userform

Hello,

i would like to create a menu in a userform.

That was easy to do (thanks to api) to create a menu and submenu in vba 32 bits.

I managed to do it in vba 64 bits for Zwcad.

 

But I have a problem with vba 64 bits for Autocad.

when i use TrackPopupMenuEx , the menu appears in gray not enable to click.

 

If you have an idea to solve the problem ... thank you.

Tags (1)
Labels (3)
6 REPLIES 6
Message 2 of 7
norman.yuan
in reply to: contactALQK9

norman.yuan
Mentor
Mentor

Since everyone is using 64-bit AutoCAD with 64-bit VBA nowadays, there is no extra support for UI components except for those built into 64-bit VBA's tool box.

 

You might be able to find some third party UI components, but they are scarce, and not many people want to waste time to develop/maintain these types of stuff. Or, if you are really capable of raw Widows APIs, you could dig into that. IMO, trying to build an rather sophisticated UI with 64-bit VBA is waste of time/effort in most cases.

 

It would rather easy to build UI as you showed with .NET technology with AutoCAD .NET API. If your business application requires good UI, I'd say: do not waste your time with 64-bit VBA.

Norman Yuan

Drive CAD With Code

EESignature

0 Likes

Since everyone is using 64-bit AutoCAD with 64-bit VBA nowadays, there is no extra support for UI components except for those built into 64-bit VBA's tool box.

 

You might be able to find some third party UI components, but they are scarce, and not many people want to waste time to develop/maintain these types of stuff. Or, if you are really capable of raw Widows APIs, you could dig into that. IMO, trying to build an rather sophisticated UI with 64-bit VBA is waste of time/effort in most cases.

 

It would rather easy to build UI as you showed with .NET technology with AutoCAD .NET API. If your business application requires good UI, I'd say: do not waste your time with 64-bit VBA.

Norman Yuan

Drive CAD With Code

EESignature

Message 3 of 7
contactALQK9
in reply to: contactALQK9

contactALQK9
Explorer
Explorer

hello norman,

thanks for your answer but i'm not wasting time on vba.

i work on vba since 2003, so i'm not gonna waste time learning a new langage.

if you don't have the answer,  it's not a problem.

I hope someone still using vba 64 on autocad with api and will be able to give me a solution 🙂

best regard.

0 Likes

hello norman,

thanks for your answer but i'm not wasting time on vba.

i work on vba since 2003, so i'm not gonna waste time learning a new langage.

if you don't have the answer,  it's not a problem.

I hope someone still using vba 64 on autocad with api and will be able to give me a solution 🙂

best regard.

Message 4 of 7
ed57gmc
in reply to: contactALQK9

ed57gmc
Mentor
Mentor

Norman is not saying that you are wasting your time with VBA. I still find uses for it. But you're wasting your time trying to find a menu system in VBA. You're probably stuck with using button's. However, you can hide and show buttons based on context.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes

Norman is not saying that you are wasting your time with VBA. I still find uses for it. But you're wasting your time trying to find a menu system in VBA. You're probably stuck with using button's. However, you can hide and show buttons based on context.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

Message 5 of 7
contactALQK9
in reply to: contactALQK9

contactALQK9
Explorer
Explorer

Thank you Ed Jobe for your answer.

Yes i found a similar solution on web , using caption and listbox with hide/show methode.

so i guess it's the solution...

I just explained that the code based on api  that i'm  trying to use in vba64 for autocad is ok in zwcad vba64.

So i think it's a bit strange. vba64 should be the same no?

I tried to chek security commands on autocad but it didn't change anything in my vba script. so sad.

0 Likes

Thank you Ed Jobe for your answer.

Yes i found a similar solution on web , using caption and listbox with hide/show methode.

so i guess it's the solution...

I just explained that the code based on api  that i'm  trying to use in vba64 for autocad is ok in zwcad vba64.

So i think it's a bit strange. vba64 should be the same no?

I tried to chek security commands on autocad but it didn't change anything in my vba script. so sad.

Message 6 of 7
ed57gmc
in reply to: contactALQK9

ed57gmc
Mentor
Mentor

@contactALQK9 wrote:

So i think it's a bit strange. vba64 should be the same no?


Are  you asking about 32bit? No, they're not the same. One is compiled to 32 bit dll and the other is compiled to 64 bit dll. You can't compile a 32 bit control to 64 bit and expect it to work. Only certain elements of the control seem to be visible, but it won't function.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes


@contactALQK9 wrote:

So i think it's a bit strange. vba64 should be the same no?


Are  you asking about 32bit? No, they're not the same. One is compiled to 32 bit dll and the other is compiled to 64 bit dll. You can't compile a 32 bit control to 64 bit and expect it to work. Only certain elements of the control seem to be visible, but it won't function.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

Message 7 of 7
contactALQK9
in reply to: contactALQK9

contactALQK9
Explorer
Explorer

so i finaly solved my problem.

i had to add TPM_NONOTIFY 

 

so vba instruction became:

Ret = TrackPopupMenuEx(hMenu0, TPM_NONOTIFY Or TPM_RETURNCMD, pt.X, pt.Y, AutoCAD.Application.hWnd, ByVal 0&)

 

thanks to all.

i you need a sample code to add menu on userform in vba64 , i'm ok to help you 🙂 . bye

0 Likes

so i finaly solved my problem.

i had to add TPM_NONOTIFY 

 

so vba instruction became:

Ret = TrackPopupMenuEx(hMenu0, TPM_NONOTIFY Or TPM_RETURNCMD, pt.X, pt.Y, AutoCAD.Application.hWnd, ByVal 0&)

 

thanks to all.

i you need a sample code to add menu on userform in vba64 , i'm ok to help you 🙂 . bye

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report