[RESOLVED] Context menu for TextBox
Hello 2 u, programmer :-)
How can I get standard context menu of TextBox (ThunderTextBox) using VB6 and/or WinAPI and add my own menu item(s) to it?
Someone wrote something like: "use standard menu from user32.dll, byt I can't recall the method."
So the question is... How? How to realize the functionality? Is it real at least?
P.S. The goal is to add custom item to standard context menu.
Re: Context menu for TextBox
If it's your program, it isn't hard. Somebody else's program is different
Re: Context menu for TextBox
Quote:
Originally Posted by
dglienna
If it's your program, it isn't hard. Somebody else's program is different
So... Where's the solution? Excuse me, but u wrote nothing except common words.
The problem is:
1. Where's no WM_INIT... messages it's only WM_CONTEXTMENU - so there's no handle to menu
2. I don't know the resource identifier within system dll to direct load the menu
And u said "it's not hard"... :-/
Re: Context menu for TextBox
What he said was if it is your program it is not that hard but if it is someone elses it is a different story. Meaning if you wrote the program and have the source code it is fairly easy. If someone else wrote it and you do not have the source then that is another matter.
Re: Context menu for TextBox
Gosh!
Men don't you read my first post?
I clearly noted "standard". Have I explain you "standard".
Re: Context menu for TextBox
Re: Context menu for TextBox
Quote:
Originally Posted by
dglienna
Have you SEARCHED for an answer?
Yes 2 days of searchin' via MSDN and internet (google, yandex, rambler).
And I didn't find anythin except "supress context menu" or "create your own menu and substitu standard one". But the question is: "How to get standard menu and change it (append item)"...
I apreciate your answers and hope your last link helps me.
1 Attachment(s)
Re: Context menu for TextBox
Unfortunately, I think, I can't understand that I need.
Ok. Here's an attachment.
The question still "How to do?"
P.S. Sorry, I didn't specify that the application is mine. I need to extend standard textbox's context menu. Standard means that the menu is not specialy created and show but generated by the control itself.
CH "I think I'm goin' crazy"
Re: Context menu for TextBox
So you can add, for example: DESTROY WORLD, or DELETE FILES?
That wouldn't be so good. That's why windows doesn't allow it.
You can create a CONTEXT MENU that lives in the taskbar with Windows 7
That, you can add items to
Re: Context menu for TextBox
Quote:
Originally Posted by
dglienna
That wouldn't be so good.
No way! I'm a friendly programmer. :-)
I created a program that helps me with my duties with my job.
There's a ServiceDesk that strores service calls. My job is analize the calls and make various report based on it. I create my own data base (mdb) and a cliend (vb6) to automate rut. (Export some information from ServiceDesk, import to my database, analyzing and reporting i've done). Now I work on my code to maximum automate rut.
There's primary actions that I've automated via hot-keys, but there's a secondary one that I wanna realize via context menu.
I just need to select part of text information in text box and have ability to select from context menu there the selection to store (there's a number of a textboxes). But there's a number of colleagues working with my application with its own habits (some of them like to use context menu instead of hot-keys to copy/paste)
I think its foolish to wrote so big project just for masking desructive things... If I would wish to write a virus or malware i'd like to use C++. :-)
I can realize my own context menu (that's not a problem) but on the spot i've got WinXP, at home Win7 and there's a different menues in both the systems. That's why I need smart solution to add items to standard menu
Uh...
Think I won't be banned for offtop :-)
Re: Context menu for TextBox
If you wrote the client, then you'd have to change it to create your menu. You can create a menu on the fly, but not from a different program.
Re: Context menu for TextBox
Quote:
Originally Posted by
dglienna
You can create a menu on the fly, but not from a different program.
Dear Dglienna, I don't need a different program. I just want standard menu of a standard control.
I misunderstand you or you misunderstand me.
If I will follow your logic then I need to create my own TextBox control. No, no, no! That a control? Write whole program in Notepad using mnemonics of processor :-)
I've explain that I've done. I've explain that I need. I've explain almost everything but there's no answer. Now I hope you will tell me "It's impossible" or "You have to do... to realize it".
Re: Context menu for TextBox
Dr. Dglienna, u realy POWER Poster! :-) (in good part)
Re: Context menu for TextBox
This is an API that you might be able to use. Notice that the button COLORIZES the menu items.
Code:
Option Explicit
Private Const MIM_BACKGROUND As Long = &H2
Private Const MIM_APPLYTOSUBMENUS As Long = &H80000000
Private Type MENUINFO
cbSize As Long
fMask As Long
dwStyle As Long
cyMax As Long
hbrBack As Long
dwContextHelpID As Long
dwMenuData As Long
End Type
Private Declare Function DrawMenuBar Lib "user32" _
(ByVal hWnd As Long) As Long
Private Declare Function GetSubMenu Lib "user32" _
(ByVal hMenu As Long, ByVal nPos As Long) As Long
Private Declare Function GetMenu Lib "user32" _
(ByVal hWnd As Long) As Long
Private Declare Function SetMenuInfo Lib "user32" _
(ByVal hMenu As Long, _
mi As MENUINFO) As Long
Private Declare Function CreateSolidBrush Lib "gdi32" _
(ByVal crColor As Long) As Long
Private Sub Command1_Click()
Dim mi As MENUINFO
With mi
.cbSize = Len(mi)
.fMask = MIM_BACKGROUND
.hbrBack = CreateSolidBrush(vbYellow)
SetMenuInfo GetMenu(Me.hWnd), mi 'main menu bar
.fMask = MIM_BACKGROUND Or MIM_APPLYTOSUBMENUS
.hbrBack = CreateSolidBrush(vbCyan)
SetMenuInfo GetSubMenu(GetMenu(Me.hWnd), 0), mi 'File menu (item 0)
.hbrBack = CreateSolidBrush(vbGreen)
SetMenuInfo GetSubMenu(GetMenu(Me.hWnd), 1), mi 'Edit menu (item 1)
.hbrBack = CreateSolidBrush(vbRed)
SetMenuInfo GetSubMenu(GetMenu(Me.hWnd), 2), mi 'Select menu (item 2)
End With
DrawMenuBar Me.hWnd
End Sub
Re: Context menu for TextBox
That's no the goal!
Thank you, but that's not a goal!
Yes, that's not a goal!
And u know what I mean!