|
Shilpi Boosar wrote: ...may be include it in stdafx.h.
Were you not paying attention? The errors are a direct result of windows.h being included unnecessarily.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
hai.
now i will tell u the problem....
i opened win32 application...and i had 3 files which reqd windows.h ...so i added windows.h in win32 files...
now i have one cpp file which is mfc support file..mfc support means using Cstring datatype..and AFxBeginthread and some other also...
so..now i have added that mfc support cpp file to my project...
which is having header files #include<afx.h> and <fxwin.h> and etc..related to mfc..
now i builded my program...it is throwing this error...
fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h>
|
|
|
|
|
While it's certainly possible to add MFC support to an existing Win32 Application, it would be much easier to just use AppWizard to create an MFC Exe application instead.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hello,
I am using CDatabase 's pen function t pen a database .Now I want to flag a message if the database desn't exist or it is not opening.
CDatabase::Open() does not return true r false so tried using try catch throw but the control does not go to catch part of the above block
What do I do ? I did the following
try
{
if (!CurrentDatabase.IsOpen())
CurrentDatabase.Open(_T(DatabaseName),FALSE,FALSE,_T("ODBC;"));
}
catch (CFileException* e)
{
AfxMessageBox("Check your Database");
throw;
}
Regards
Prithaa
|
|
|
|
|
As far as I am aware, CDatabase class will throw a Database exception (CDBException) and not CFileException.
|
|
|
|
|
Hello,
Thanks ,It worked.
I should have checked that.
Prithaa
|
|
|
|
|
You can find VC++ Interview Questions and Answers on all
topics Such as
<b>C++, MFC, Win32, COM, DCOM, STL, Multi-Threading, UML, OOAD,
Graphics libraries - LeadTools, OpenGL,
Data structures- Linked lists, Trees, searching and sorting.
</b>
Most Frequently Asked VC++ Interview Questions and
Answers collected from more than 100 real time interviews
and tests can be found at following link.
http://sumedh.shende.googlepages.com/
|
|
|
|
|
no advertisement on forum are allowed dude!
"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
|
|
|
|
|
It seems that his thread is a news but why he use of question icon instead news icon.!
|
|
|
|
|
thats great
this site is for helping people
if anybody does not want help then no need to raed that
and if anybody want then go and read that
i appreciate MR. textsumedh that is great job sir
and keep going
|
|
|
|
|
are you stupid , there is nothing.. p_ who are you i have never seen you here.. great!
"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
|
|
|
|
|
I am creating activex control in vc++6.0. I need to implement MyRegisterClass in my control class. Can anyone let e know how to implement it.
S.Yamini
|
|
|
|
|
Ok if I have a number (stored in a regular integer) and say that number is 51.... Is there a function to search the Integer and return how many numbers there are in the Integer? e.g. 51 has a 5 and a 1 in it so it should return 2.
I tried -> sprintf(IntLength, "%d", Prime); but I get compilation errors does anyone have any ideas?
Thanks of course in advance
|
|
|
|
|
Here sprintf() will convert your prime integer to the string representation. so it will not give you your answer that how many numbers in integer.
And Regarding to your error , check the type of variable IntLength used in sprintf() function.
|
|
|
|
|
technically you are not 100% correct. the return value of sprintf() is the number of characters stored in buffer so adapting the answer to the previous question Michael asked given by Naveen.R here[^] you could end up with
<br />
int IntLength;<br />
int n = 123456;<br />
char c[33] = {0};<br />
IntLength = sprintf( c, "%d", n ); <br />
|
|
|
|
|
Michael101 wrote: sprintf(IntLength, "%d", Prime);
Whats the error?
any way you can use the following function for it
int n = 12345678;<br />
int nCount = 1;<br />
while( n )<br />
{<br />
n = n/10;<br />
if( n > 0 )<br />
{<br />
nCount++;<br />
}<br />
}
|
|
|
|
|
Naveen.R wrote: nave
you are superfast dude!
"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
|
|
|
|
|
|
int iCount = 0;
int iurNumber= any number;
while(iurNumber !=0)
{
iurNumber /=10;
iCount++;
}
iCount will contain number of element integer have
"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
|
|
|
|
|
Michael101 wrote: ...but I get compilation errors...
Are we supposed to guess what those are?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I've never seen sprintf with this signature. Have you overloaded it yourself?
I think the error you are getting is because you are passing an integer instead of a char*.
Instead of:
sprintf(IntLength, "%d", Prime);
use:
IntLength = sprintf( someCharBuffer, "%d", Prime );
Or better yet, use one of the other solutions already given.
David
|
|
|
|
|
Hi everyone,
I'm working on a solution and I've come accross a problem which seems to be trickier than I expected! I've got an Integer and I need to put the numbers from that Integer into a character array! This array is used for other operations but I don't know how to extract the numbers in the Integer and place them in their own single element in the array. E.g. 47 needs to be over two diffent elements and so on.
Any ideas?
Thanks in advance, I appreciate the help
Michael
|
|
|
|
|
check the sprintf() function.
eg:
int n = 123456;<br />
char c[33] = {0};<br />
sprintf( c, "%d", n );
|
|
|
|
|
Legend
Worked like a charm! Thanks
|
|
|
|
|
you can also use itoa, _itot function!
"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
|
|
|
|