|
Hello All,
I am wondering if there is a way to add an item to menu that is displayed by right-clicking on application's title bar. e.g. if you right-click on IE's title bar, you'll see 'restore-minimize-maximize-close' etc.... can we add an item to such context-menu for any application?
Thanks for your help...
|
|
|
|
|
You can use GetSystemMenu() to get the menu and edit it.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I would like a company to do make a simplified version of Skype for me which includes functions as:
1. contact list
2. PC-to-PC phone with webcam showing(which is able to go through most of the firewalls)
As my team have no experience of making such a large application before, can anyone experienced give me an estimation of roughly how long is needed?
for my team consisting of two programmer who is having about 2 years experience on VC++ and socket programming.
Thanks very mcuh.
|
|
|
|
|
7 is a divine number
led mike
|
|
|
|
|
Brilliant system analysis and design by proxy
42 is far more significant.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Take the blue pill and proceed to the nearest exit.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
How to Call CMainFrame method from dialog
thax
|
|
|
|
|
<br />
CMainFrame* pFrame = (CMainFrame*)AfxGetMainWnd();<br />
pFrame->MyFunction();<br />
|
|
|
|
|
|
The reason why I asked this is , I had a very length process(unestimated time) on my dialog box and I need
to display progress bar on the MainFrame. wht I did is start a thread on the first line of the button press event
and from the thread I will calling the Function in the MAinFrame. I am able to acces the funcion, but it did not work.
May I know, if you have any smart idea to do this,
|
|
|
|
|
It would be better programming practice to use ::PostMessage() to post a WM_USER+ message back to the CMainFrame. You could define a user message such as:
#define WM_INC_PROGRESS WM_USER + 0x10
and then do something like:
int iProgressVal = 50;
CMainFrame* pFrame = (CMainFrame*)AfxGetMainWnd();
if(NULL != pFrame && ::IsWindow(pFrame->GetSafeHwnd()))
{
::PostMessage(pFrame->GetSafeHwnd(),WM_INC_PROGRESS,(WPARAM)iProgressVal,0);
}
And in the CMainFrame class you would need to add a handler for this custom message which changed the progress bar to the specified amount. Your code will work just fine like it is. The window message system is a valuable tool and can be used for basic cross-thread communication.
Best Wishes,
-Randor (David Delaune)
|
|
|
|
|
Thanks it worked, but the progress bar is displaing the progress after the completion of the lenghty process. I am looking around to move the progress bar to fro while the process is going on, so that the user will be able to understand that something in progress
I placed the below code in the thread and added a custom msg handler,
int iProgressVal = 50;
CMainFrame* pFrame = (CMainFrame*)AfxGetMainWnd();
if(NULL != pFrame && ::IsWindow(pFrame->GetSafeHwnd()))
{
::PostMessage(pFrame->GetSafeHwnd(),WM_INC_PROGRESS,(WPARAM)iProgressVal,0);
}
I dint not understand where I had gone wrong.
pls Advice.
|
|
|
|
|
Hi there
In Control Panel->Mouse->Pointers any user can change the mouse cursor pointer. How can I know when the cursor pointer is in normal, text, help, busy, resize..etc state?
I'm working in MFC.
|
|
|
|
|
You can't.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I've to develop a DLL in VC++. This DLL has to create a graphic
custom control into an existing Window and should be used by both
Visual C++ and Visual Basic applications. In VC++ i've no problem to pass
the parent Window HWND object to the DLL in order to create the
child control but, how can I let this work also in Visual Basic ?
My problem is that I don't know how Visual Basic can be interfaced
with a Visual C++ DLL in order to manage Window handles and
graphic controls.
Thanks a lot !!!
|
|
|
|
|
Have a look at ^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Hello everyone,
I am trying the continue function triggered by JIT debugger. As mentioned in MSDN,
[url]http://msdn2.microsoft.com/zh-cn/library/h22dk1y6(en-us).aspx[/url]
--------------------
Continue
Allows execution to continue, giving the exception handler a chance to handle the exception. This option is not available for certain types of exceptions. Continue will allow the application to continue. In a native application, it will cause the exception to be rethrown. In a managed application, it will either cause the program to terminate or the exception to be handled by a hosting application.
--------------------
I write the following program to try this feature and expect when click continue, the __except code block is executed, but actually even the JIT debugger is not displayed to let us select debugger. Do you know why and how to fix it to make it have expected function (when click continue, execute exception handler code block)?
#include "Windows.h"
int main()
{
int a;
int b;
int c;
__try
{
a = 100;
b = 200;
c = 300;
DebugBreak();
a = 400;
}
__except(GetExceptionCode() == EXCEPTION_BREAKPOINT ?
EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH)
{
return FALSE;
}
return TRUE;
}
thanks in advance,
George
|
|
|
|
|
Hi all
In DirectShow sample code, have lot define like CComPtr <ipin>,
if I use IPin* superseded CComPtr <ipin>, and then build and run is no error.
So, what difference between CComPtr <ipin> and IPin* ?
|
|
|
|
|
CComPtr is a smart pointer [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
And IPin is an interface used by DirectShow to connect filters together..
Don't try it, just do it!
|
|
|
|
|
Well, the difference stands between a standard pointer and a smart one. The exact nature of the interface is irrelevant to the OP context.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Hello All,
Please go through the following piece of code which is giving problem.
#include <iostream.h>
void main()
{
int angle = 2330,angul_step=55;//change angul_step to 60
float nAngle = (float)(angle / 10) - 2;
float nAngulationStep = (float)angul_step / 100;
float nFrames = (int)(nAngle/nAngulationStep);
int nPhaseFrames = (int)nFrames + 1;
cout<<"The nFrames is "<<nFrames<<endl;
cout<<"The nPhaseFrames is "<<nPhaseFrames<<endl;
}
The out put is in Debug mode.
The nFrames is 419
The nPhaseFrames is 420
The out put is in Release mode
The nFrames is 420
The nPhaseFrames is 421
In the same way: If you change the angul_step to 60 and run the out put in Debug and Release mode are
Debug mode:
The nFrames is 384
The nPhaseFrames is 385
The out put in Release mode is
The nFrames is 385
The nPhaseFrames is 386
I have replace Float with Double:
The output are different.
Debug mode:
The nFrames is 419
The nPhaseFrames is 420
Release Mode:
The nFrames is 420
The nPhaseFrames is 421
In the same way: If you change the angul_step to 60 and run the out put in Debug and Release mode are
Debug Mode
The nFrames is 385
The nPhaseFrames is 386
Release Mode
The nFrames is 385
The nPhaseFrames is 386
Changing float to double works only for specific numbers. The problem is unknown to me.
Please let me know if any one had this experience and solution.
I need to calculate the value "ROUNDDOWN((Angle-2)/AngulationStep)+1"
where Angle will be ((angle/10) -2) and angulation Step would be angul_step/100.
Thanks much.
Kishore
|
|
|
|
|
Kishore JP wrote: float nAngle = (float)(angle / 10) - 2;
float nAngulationStep = (float)angul_step / 100;
I would change these to:
float nAngle = (angle / 10.0) - 2.0;
float nAngulationStep = angul_step / 100.0;
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
(1) please use <pre> tags to surround code snippets.
(2) the following line
float nAngle = (float)(angle / 10) - 2;
is probably wrong, replace it with
float nAngle = ((float)angle / 10) - 2;
or
float nAngle = (angle / 10.0) - 2;
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Kishore JP wrote: float nAngle = (float)(angle / 10) - 2;
(angle / 10) is first computed as integer , and the integer-result is converted to a float . Subsequently, an integer 2 is subtracted, thereby being inplicitly converted to a 2.0 float .
The resulting float is assigned to nAngle .
Kishore JP wrote: float nAngulationStep = (float)angul_step / 100;
A integer-division of angul_step by (integer)100 is done, and the (integer)result is convertetd to a float.
Kishore JP wrote: float nFrames = (int)(nAngle/nAngulationStep);
A float -division is done, its decimals are thrown away (that is: rounded down) and the result is implicitly converted into a float.
Numerics in C/C++ require you to really know what you want to do. If you want to divide by a float-constant, you really must write a float into your code (as the others already showed you)!
B.T.W. Why do you use float ?
Do your math in double and round when you need it (e.g. when handing coordinates over to OpenGL)
If you really must use warting (e.g. writing nAngle instead of simply Angle ), which is completely obsolete in the days of IDEs and Intellisense, please do it meaningful, and distinguish integers and decimal values.
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|