|
Subclass the button and handle the WM_RBUTTONDOWN and WM_RBUTTONUP messages. There are several articles on subclassing controls here on CP, just do a search.
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
|
void CssDlg::OnContextMenu(CWnd* pWnd, CPoint point)
{
HMENU hmenu,hmenuPopup;
hmenu = LoadMenu(AfxGetApp()->m_hInstance,(LPCTSTR) IDR_MENU1);
//you can use like this
if(pWnd->m_hWnd==m_Button1.m_hWnd)
hmenuPopup = GetSubMenu(hmenu, 0);
else
if(pWnd->m_hWnd==m_Button3.m_hWnd)
hmenuPopup = GetSubMenu(hmenu, 1);
TrackPopupMenu(hmenuPopup, TPM_LEFTALIGN | TPM_LEFTBUTTON,
point.x,point.y, 0, pWnd->m_hWnd, NULL);
DestroyMenu(hmenu);
}
|
|
|
|
|
I'm trying to decide when it's best to use a dialog based app and when to use a normal window.
What are the advantages and disadvantages of both methods ?
What basic rules should I use to decide which method to use ?
|
|
|
|
|
Just found the following article by Nish
http://www.codeproject.com/dialog/pretransdialog01.asp
which indicates a key difference "...is that in a dialog based application the focus is always on one of the child controls and not on the main dialog window."
He also gives a couple of ways to handle keyboard messages and accelerators.
Aside from this, are there any other big differences ?
|
|
|
|
|
What do you mean by a normal window ? A dialog box is also a normal window .
Are you speaking about the SDI (single document interface) framework ?
|
|
|
|
|
I mean a non-dialog window (eg. SDI or MDI).
|
|
|
|
|
Then it depends of the complexity of your program. The advantage of SDI/MDI apps is that they have the document/view architecture that can help a lot writing complex applications. But also, if you have a very simle app (two buttons and an edit box for example ), then it is a little bit overkill.
Of course, I'm speaking here about a SDI (or MDI) app when the view class inherits from a CFormView (to have a something similar as a dialog box).
-- modified at 15:56 Tuesday 2nd May, 2006
Also, what I forgot to say is that SDI/MDI apps offer more support for toolbars, menus, serialization, ...
|
|
|
|
|
I will be thankful if anyone can describes me the coding of " scientific calculator by Tahir Naeem".specially MFC functions in this calculator..........plzzzzzzzzzz.......
before 4th may 2006........plzzzzzzzzzzzzzzzzzzzzzz
I m waiting.........
|
|
|
|
|
Could you stop begging? plzzzzzzzzzz plzzzzzzzz plzzzzzzzz?
|
|
|
|
|
Is it possible to open Shared Memory in a C# Windows application, that was created in a C++ app using the CreateFile, CreateFileMapping API.
(& if it is possible, can I get a hint where to start looking for some "instructions" (e.g., sample code)?)
|
|
|
|
|
i am using visual c++ 2005 in my project,i am stuck in one step i.e., converting any image given to matrix, this matrix is very essential for the futher processing my project, can any one please help in telling me how to convert the given image to matrix
|
|
|
|
|
You have to be way more specific. How is your image stored? How are you reading it in?
John
|
|
|
|
|
to be more specific here matrix means a two dimensional array of interger,
here we have to find the intensity of each pixel and store then int he array
for example consider an image with resoultion 5x5 if the intesity of
0x0 pixel is 10 and 0x1 pixel is 20 then
the matrix will be
10 20 .. .. .. ..
.. .. .. .. .. ..
.. .. .. .. .. ..
.. .. .. and so on
|
|
|
|
|
|
thank u for the participation in solving the problem sir,
to be more specific here matrix means a two dimensional array of interger,
here we have to find the intensity of each pixel and store then in the array
for example consider an image with resoultion 5x5 if the intesity of
0x0 pixel is 10 and 0x1 pixel is 20 then
the matrix will be
10 20 .. .. .. ..
.. .. .. .. .. ..
.. .. .. .. .. ..
.. .. .. and so on
and one more thing is, i am not able to find a function in visual c++ 2005 to get the intensity of the pixel, for example C-language provides getpixel function, in vc++ this function is there but it operates only on bitmap files but i need to find intensity of the pixel even to jpg, and other forms of the image file
|
|
|
|
|
this is a really big task.
i recommend you look into something like GDI+, or a toolkit like CIXImage (here on CodeProject), or even a commercial product (for example, the one at the bottom of this post).
if you want to be able to read any kind of image file into a buffer that you can pick pixels from, you're going to have to spend some time and effort with a toolkit that can handle all the file format parsing for you.
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
thank u for posting ur suggestion sir,
is there any other way so that i can distinguish each and every pixel apart from intensity of the pixel
|
|
|
|
|
Hi,
AFIK there is no other way to distinguish pixels becuase an image is a record of intensity values.
But you can use the derivatives of the intensity value like brightness, contrast, color, gamma etc...
Regarding your first question...I second chris...because its a huge task to convert any image into a matrix form. Better you opt any tools or libraries. Or else do it for the widely used image formats instead of all.
Bye,
Cool Ju
Dream Ur Destiny
|
|
|
|
|
Hello all;
I have build an mfc application and added a microsoft web browser activex control to the application.
Now I need to record (save into a file) the position of user mouse clicks. How do i do that ??
Thanx
llp00na
|
|
|
|
|
|
I would like to create a program that would start another program running (multiple times but I'll start with just once). I'm not sure the best way to go about this, any thoughts? I was thinken maybe initiating a bat file. however I am not sure about how to go about this either. I've tried the open(c:\\M2.bat,...) function but I seem to get an -1 in the handle. any thoughts would be great.
I'm using C++ Builder.
Cheers*
|
|
|
|
|
Debs* wrote: I would like to create a program that would start another program running (multiple times but I'll start with just once).
See here.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
Cheers* Exactly what I needed.
|
|
|
|
|
how to determine programmly if the floating number gets this value?
its after beign printed out thru printf() that reveals the floating number equal to such strange value
|
|
|
|