|
yes i am doing this in MFC. when it enters out of range it should pop up a message.. that can be done.
|
|
|
|
|
If you provided a handler for the EN_KILLFOCUS notification, you could do validation at the time the control loses focus. Still not an optimal solution IMO.
"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
|
|
|
|
|
Can anybody tell me how to insert an icon in dialogue box ?
Regards,
Shaiju
|
|
|
|
|
in the resource editor add a picture control and set it's Type to Icon, then set the Image property to the ID of the icon...
|
|
|
|
|
You must use of LoadIcon for load icon and then use of SetIcon of course you need to a static control.
|
|
|
|
|
Can anybody explain me how to insert a Control Panel Icon in Edit box ?
Regards
|
|
|
|
|
Edit controls typically do not contain icons. What exactly are you trying to accomplish?
"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
|
|
|
|
|
Hi ALL,
I am using Propertysheet class in my project in which I add number of
pages in it.
I want to acccess pointer of this propersheet in one menu function.
void
CMainFrame::OnOpenWebSite()
{
COpenWebSiteShet openWebSiteDlg;
// COpenWebSiteShet derived from CProperSheet class.
if(ID_WIZFINISH == openWebSiteDlg.DoModal())
{
COpenWebSiteShet *pSheet = (COpenWebSiteShet*)GetParent();
}
pSheet is always get NULL handle. So how can get the correct handle of
propertySheet in Mainframe class.
Thanks in Advance
Om
|
|
|
|
|
You could try this :-
void
CMainFrame::OnOpenWebSite()
{
COpenWebSiteShet openWebSiteDlg;
// COpenWebSiteShet derived from CProperSheet class.
if(ID_WIZFINISH == openWebSiteDlg.DoModal())
{
COpenWebSiteShet *pSheet = &openWebSiteDlg;
}
the GetParent() is going to try and return the CMainFrame's parent, which is in most cases as you noted NULL, and you already have the address of the PropertySheet because you created it on the stack.
|
|
|
|
|
At the point you are calling GetParent() , the window associated with openWebSiteDlg has been destroyed. Once DoModal() has returned, you can only access openWebSiteDlg 's member variables.
"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
|
|
|
|
|
i have a console application.
how can i detect when the process is terminated through task manager?
i tried using SetConsoleCtrlHandler() function. it catches the signal when we end the task through task manager. but it can not detect when the process is terminated from the processes tab of task manager.
can anyone help me.
Thanks in advance.
|
|
|
|
|
harsha u wrote: how can i detect when the process is terminated through task manager?
you can't determine when application is cut off by TaskMagr!. there is no way except you put a monitoring application which monitor application at regular interval.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Thanks a lot Alok.
That gave me some clarification.
|
|
|
|
|
Hi,
Is there any way to load *.mht files from a stream and view them in a CHTMLView ?
I tryied the microsoft's sample that loads a string or html file using streams and it worked perfectly, but it does not working with
mht files.
Any ideas ?
Regards,
sdancer75
|
|
|
|
|
How to avoid warning LNK4224: /COMMENT is no longer supported; ignored in Visual 2005 .please reply me ASAP
|
|
|
|
|
What about removing the /COMMENT option from the linker command line (Project properties)?
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.
|
|
|
|
|
#pragma warning (disable: XXXX)
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
That's not really removing the source of the warning but just make it silent. Which is not really a good solution. Sure, you could do that with all your warnings but it is maybe better to find way it is complaining.
|
|
|
|
|
But there are some times that the warnings are not relevant or don't matter, due to the code.
I.E.
In the functions I added to the smartlist in my article:
warning C4181: Auf Referenztyp angewendeter Qualifizierer wird ignoriert
// In reference type the used qualifier will be ignored
REASON: BOOL FindAndRemoveElement(const ARG_TYPE searchValue);
warning C4018: '<=' : Conflict between signed and unsigned
REASON: if (pInfo->m_nCurPage <= (nInPages + (1 * (m_nPrintSel & PRALL))))
warning C4244: 'argument' : Conversion of 'const double' in 'int', possible loose of data
REASON: cbmGraphic.CreateCompatibleBitmap (pDC, 4 * GWIDTH, -4 * GHEIGHT);
SOLUTION: casting to the correct typ, but dont needed, but in this case I wanna lose the decimals by truncating and the constants must be float/double for other places to be used. And I have about 90 times this warning
warning C4308: Negative Ganzzahlkonstante in vorzeichenlosen Typ konvertiert
//Conversion of negative integer constant in unsigned type
REASON: file->Seek (-3 * sizeof (BYTE), CFile::current);
So I use
#pragma warning(disable:4244)
#pragma warning(disable:4018)
#pragma warning(disable:4181)
and from 116 warnings I go to just 1 of them
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
I think it is bad because you can miss important warnings (things that you didn't thought about). You should get rid of the warnings instead of silenting them. I only disable them on some rare occasions.
C4181: why do you put the const keyword then ? If it will be ignored ? It let you think that it is used but it isn't so it can lead to confusion. Why don't you just remove it ? This will lead to the same result without warning.
C4018: why do you mix signed and unsigned ? That probably results to a bad design. They don't have the same range so if you start with a signed number, stick to it. On some rare occasion you will need to mix them, but then use an explicit cast.
C4244:
Nelek wrote: SOLUTION: casting to the correct typ, but dont needed, but in this case I wanna lose the decimals by truncating and the constants must be float/double for other places to be used. And I have about 90 times this warning
Cast the complete block: (int)(4*GWIDTH)
Nelek wrote: warning C4308: Negative Ganzzahlkonstante in vorzeichenlosen Typ konvertiert
//Conversion of negative integer constant in unsigned type
REASON: file->Seek (-3 * sizeof (BYTE), CFile::current);
That's typically one of the warning you shouldn't neglect, because your code is wrong. The warning tells you that it converts the -3 to an unsigned, so the result won't be what you expect. It does that because sizeof returns an unsigned type and so, when doing the multiplication your compiler will convert the -3 to unsigned type so that it can multiply both operands.
|
|
|
|
|
Thanks for your answer.
C4181: I didn't know that it would be ignored. I put that in const to avoid changes in the function by error, but if it is ignored... then it is useless. Erased and warnings away.
C4018: casted in the places, warnings away
C4244: casted in the places, change the return in a function and the warnings away
C4308: changed to file->Seek (((UINT) -3) * sizeof (BYTE), CFile::current);
is that correct? I want to go back in 3 bytes to reread the last block because it contains particular info that i need to start the next block
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
Nelek wrote: C4308: changed to file->Seek (((UINT) -3) * sizeof (BYTE), CFile::current);
is that correct? I want to go back in 3 bytes to reread the last block because it contains particular info that i need to start the next block
Hi, in this case, the ((UINT)-3) will be converted to 3, advansing the position in the file instead of going back, the cast should be in the sizeof :
file->Seek (-3 * (long)sizeof(BYTE), CFile::current);
|
|
|
|
|
you are totally right. Thanks for avoiding me an assertion
EDIT: I executed the program with my first option and worked ok, but i have anyways changed it
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
Nelek wrote: But there are some times that the warnings are not relevant or don't matter, due to the code.
Compiler warnings are always relevant, else they would not exist.
"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
|
|
|
|
|
You are right... I wrote it in a false way.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|