|
then, what's your question ?
where's your problem ?
what have you tried already ?
where are you blocked ?
|
|
|
|
|
I have to add a menu item on right clicking selected text, invoke my command handler and get the selected text, from any text document
1. How to add menu item to the existing windows generated menu
2. How to get the selected text to the menu handler program
|
|
|
|
|
Use WM_CONTEXTMENU .
The handler is called OnContextMenu ).
There you can use code like this:
CMenu menu; menu.LoadMenu( IDR_CONTEXT_MENUS);
CMenu* pContextMenu = menu.GetSubMenu( 1);
CMenu* pWorkMenu = menu.GetSubMenu( 2);
if( pWorkMenu) {
MergeMenu( pContextMenu, pWorkMenu);
}
pContextMenu->TrackPopupMenu( TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, this); Instead of MergeMenu , you might as well add an item.
For this to work, I have made a menu-resource where I place all my context menus as submenus.
The code that handles the selected menu item does so using the menu item IDs I gave in the resource.
The last paramter to TrackPopupMenu() defines theclass that is the parent for the menus and gets the command messages.
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|
|
Can we add the menu item via registry as we add menu items, on right clicking files,folder etc
|
|
|
|
|
i think you're wanting this[^]
|
|
|
|
|
What do you mean?
Where you get your menu text and menu ID does not matter: CMenu allows you to add arbitrary text and numbers.
You may as well load it from registry entries.
If you want to change a menu from a menu bar, you would need to handle WM_INITMENU or override CWnd::OnInitMenu .
There you can modify the menu - to the point of assembling a completely different menu.
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|
|
hi,
can anybody tell me what this function is going to return,
WINGDIAPI BOOL WINAPI BitBlt( IN HDC, IN int, IN int, IN int, IN int, IN HDC, IN int, IN int, IN DWORD);
Thanks in advance
Siddharth
|
|
|
|
|
it returns a BOOL only.
what you see around are the calling convention (find the definition of WINAPI - it's certainly like __cdecl) and see also how's defined WINGDIAPI
|
|
|
|
|
thanks
|
|
|
|
|
Hi all,
This might be a stupid question, but does VS 2005 (VC++) have a media player component?
Many thanx,
Regards
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
|
|
|
|
|
What you want exactly ?
Is it Windows Media player activeX control ?
|
|
|
|
|
I really thought it was a simple question, but ok ... I just wanted to know if VS 2005 had a Media Player form component that can be added to the form, thats all.
Thanx again,
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
|
|
|
|
|
|
Programm3r wrote: I really thought it was a simple question, but ok ...
Not seen much of forms. Obviously, looked in to MFC context.
|
|
|
|
|
My bad ...
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
|
|
|
|
|
In Visual Studio, open the Toolbox.
If Windows Media Player does not appear on the Components tab of the Toolbox, do the following:
Right-click within the Toolbox, and then select Add/Remove Items. This opens the Customize Toolbox dialog box.
On the COM Components tab, select Windows Media Player.
If Windows Media Player does not appear in the list, click Browse, and then open Wmp.dll, which should be in the Windows\System32 folder.
Click OK. The Windows Media Player control will be placed on the current Toolbox tab.
You can now select Windows Media Player in the Toolbox and add it
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
|
|
|
|
|
I have a question do you want to play movie files
|
|
|
|
|
Hi.
I am trying to display a graph in a dialog with data input from a file which i have put it in an array. How do i display the array with its data as the y-axis? This is what I have gotten so far and I am stuck here.
<br />
void CCTestDlg::OnOpenfile() <br />
{<br />
ifstream file;<br />
short data[10240];<br />
int iI;<br />
<br />
static char szFilter[] = "Binary files (*.bin)|*.bin|All files (*.*)|*.*||";<br />
<br />
DWORD dwFlags = OFN_HIDEREADONLY | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST;<br />
<br />
CFileDialog m_ldFile(TRUE, ".bin", NULL, dwFlags, szFilter);<br />
<br />
if (m_ldFile.DoModal() == IDOK)<br />
{<br />
m_filePath = m_ldFile.GetPathName();<br />
<br />
file.open (m_filePath, ios::in|ios::binary);<br />
<br />
if (file.is_open())<br />
{<br />
for (iI = 0; iI < 10240; iI++)<br />
{<br />
data[iI] = file.get();<br />
}<br />
<br />
file.close();<br />
}<br />
}<br />
}<br />
If in SDI, there is a OnDraw() function but how do I do it in a dialog?
Thanks in advance.
|
|
|
|
|
|
ReturnRain wrote: If in SDI, there is a OnDraw() function but how do I do it in a dialog?
Does this[^] help?
Short story: Define a control for that!
Don't do it on the dialog. Your control might even have no border, so it looks like the drawing takes place on the dialog.
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|
|
Hello.
I tried to follow the link above (the one that jhwurmbach gave) and define a picture control. But I just get lost somewhere. I dont know if I am doing it right.
I placed the picture control on the dialog and change its ID and type to rectangle. Then it stated to add #include SpectrumAnalyzer.h to dialog header and to add member variable to dialog. Meaning I have to created SpectrumAnalyzer.h first? What should I do next?
I tried to find in the internet on picture control with rectangle as its type but I just couldn't find it. Is there any link that will teach me step by step on picture control?
Thanks again in advance.
|
|
|
|
|
ReturnRain wrote: add member variable to dialog.
So, you have added the include-line at the top of your dialog class-header file (but below the #include "stdafx.h ").
Now you add the lines given in the SpectrumAnalyser-Article
public:
CSpectrumAnalyzer m_SpectrumAnalyzer_Ctrl; to your dialog header.
The Demo-project from the SpectrumAnalyzer article shows what to do in its CSpectrumAnalyzerDemoDlg -class (the two files SpectrumAnalyzerDemoDlg.h and SpectrumAnalyzerDemoDlg.cpp )
You probably want the Spectrum Analyzer to be shown right from the start, so the creation code (in the demo found in the OnScanBtn() button click handler) needs to be moved to the OnCreate -function of your dialog (add it using the Visual-C++ code wizard!).
ReturnRain wrote: s there any link that will teach me step by step on picture control?
You won't get more than the Article I linked shows you. Basic C++ and MFC knowledge is required beforehand.
Failure is not an option - it's built right in.
|
|
|
|
|
How can i get list of the names of all devices attached with current system in VC++?
|
|
|
|
|
Certainly not by repeating the question, and most positivley not after being provided with 5 links. Stop waiting for somebody to give you the answer and go do some research.
|
|
|
|
|
i need a c script to list the devices in the sytem. any one know this. help me.
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|