|
Hi!Dear,
I just want to register in the website
www.c-sharpcorner.com. but after I filled in my email address and my nickname,it never sent password to my email box.I am my email address is correct.my email address is:libingmomer@163.com,passward is "libing". I dont know where is the problem.Maybe it treat my email address as a invalid one.
Now I prefer my honoured you can register a nickname and a password on this website for me to login.
Thanks!
|
|
|
|
|
Hi,
I would like to store great numbers on a primitive type. Is unsigned long int primitive type that can hold the greatest non-negative number? Or which primitive type I can use?
Kind Regards,
-
When in doubt, push a pawn!
-
|
|
|
|
|
Take a look at hyper it holds either a signed or unsigned 64bit number. i.e. unsigned hyper int - will give you a 64bit unsigned integer
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
Hi Mr. Kancidrowski,
I used hyper but compiler(Visual C++ 2005 Express Beta) gave me compiler error.
Regards,
-
When in doubt, push a pawn!
-
|
|
|
|
|
2005! Wow, you are keen! I am still running either V6.0 or 2003.
What was the error message?
BTW, call me Ant. It needn't be formal!
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
unsigned long ul = -1;
so
ul == 0xFFFFFFFF
TOXCCT >>> GEII power
|
|
|
|
|
The error:
when I use the CFile object to write com1(computer seriel port 0) with 270 bytes, the code "pfile->Write(lpchar, 270)" will sometimes throw a CFileException::diskFull exception;
Could u tell me why and In what condition the system will throw the exception
"CFileException::diskFull", when I am writting a seriel port?
Any Suggestions.
Thanks.
Hello World!
|
|
|
|
|
Hi,
I'm doing the beginning VC++ Dialog Box tutorials on this site, and I noticed when I add a member variable to a control(using the Class Wizard) and select Category: Value, the Wizard adds an initialization line in the Dialog constructor.
However, when I add a member variable and select Category: Control with say, Variable Type: CListBox, the Wizard doesn't add anything to the Dialog constructor. Shouldn't the class objects that are members of the class also get initialized in the Dialog constructor? If the answer is yes, how would I do that?
|
|
|
|
|
No you do not need to initialize other classes within the dialog class. They take care of their own initialization.
If you take a look at the header file for the dialog you will see a line like
CListBox m_ListBoxControl;
This instantiates a CListBox object and calls its constructor.
Similarly, when you create and launch a dialog
CMyDialog myDialog; This instantiates the CMyDialog object and calls its constructor
myDialog.DoModal();
calls the dialog DoModal function.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
Hi,
Thanks for responding.
I’m having trouble verifying your explanation. As far as I can tell, a declaration of a member object in a class doesn’t instantiate the member object and call it's constructor. The code below demonstrates that. I declared a class Car with one member object of type Age:
#include <iostream>
using namespace std;
class Age
{
public:
int years;
Age()
{
cout<<"Age constructor called";
}
};
class Car
{
public:
Age a;
};
int main()
{
cout<<"Was a constructor message displayed?"<
|
|
|
|
|
You need to construct an object of class Car in order for an object of class Age to be constructed.
You have missed this out!
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
This is what you said:
-------
"If you take a look at the header file for the dialog you will see a line like
CListBox m_ListBoxControl;
This instantiates a CListBox object and calls its constructor."
-------
My test code shows that your statement is incorrect--just declaring a member object in a .h file does not instantiate the object and call it's constructor. Now, you seem to be saying something different.
Anyway, as far as I can tell, the class Wizard never instantiates the object in a .cpp file with a line like:
CListBox m_ListBoxControl;
which would create the object and call it's default constructor. But, I don't think a statement like that is appropriate for a class member anyways--I think object members of a class get instantiated when an object of the class is created.
I do see this line:
CCodeProject_Dialog2Dlg dlg;
in CCodeProject_Dialog2App::InitInstance(). I guess that must call the default contructor of the object m_ListBoxControl because it's a member of the CCodeProject_Dialog2Dlg class, and in the creation of 'dlg' it gets called somehow.
However, looking around the files, now I don't see the default constructor that's called for 'dlg':
CCodeProject_Dialog2Dlg dlg;
The only constructor I see is:
-------
CCodeProject_Dialog2Dlg::CCodeProject_Dialog2Dlg(CWnd* pParent /*=NULL*/)
: CDialog(CCodeProject_Dialog2Dlg::IDD, pParent)
-------
which has one paramemter, so it can't be the defautlt constructor, and if the programmer defines a constructor, then they have to provide their own default constructor. Where is the default constructor that's called?
|
|
|
|
|
7stud wrote:
My test code shows that your statement is incorrect
You are not going to get code to execute if you are not using it! In the context of your original question I thought I had explained that you do not need to initialize the composite class objects. You do need to instantiate the class that holds these composites however. Sorry if you did not understand this.
When a class is instantiated then all other composite classes within that class are instantiated, if they are defined in the manner discussed earlier.
With regards to the Dialog class constructor.
CCodeProject_Dialog2Dlg dlg;
Does calls the constructor
CCodeProject_Dialog2Dlg::CCodeProject_Dialog2Dlg(CWnd* pParent )<br />
: CDialog(CCodeProject_Dialog2Dlg::IDD, pParent)
NOTE: When the header has 1 parameter that is defaulted (in this case to NULL) you do not need to pass that parameter as long as you want the default behaviour.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
NOTE: When the header has 1 parameter that is defaulted (in this case to NULL) you do not need to pass that parameter as long as you want the default behaviour.
How is the one parameter defaulted to NULL? If I write a constructor like this:
CSomeClass::CSomeClass(a, b, c, d /*All parameters in every function in this project are NULL*/)
{}
Do all the parameters of every function in the project have default values of NULL?
NEVER MIND...I SEE THAT THE DEFAULT VALUE FOR THE SINGLE PARAMETER IS IN THE HEADER FILE.
Thanks for your help.
|
|
|
|
|
It is a good thing that you are questioning what people tell you.
Just to clarify. If you write something like that in the .cpp file it is as a reminder that the parameter is defaulted to NULL
CCodeProject_Dialog2Dlg::CCodeProject_Dialog2Dlg(CWnd* pParent /*=NULL*/)
If you look in the .h file you will see the constructor defined something like
CCodeProject_Dialog2Dlg(CWnd* pParent = NULL)
Note if you have more than one parameter, all parameters after the first one that you default must have default values.
i.e These are OK
Function(int *A = NULL, int *B = NULL, int *C = NULL)
Function(int *A, int *B = NULL, int *C = NULL)
Function(int *A, int *B, int *C = NULL)
These are not
Function(int *A = NULL, int *B, int *C = NULL)
Function(int *A = NULL, int *B, int *C)
Function(int *A, int *B = NULL, int *C)
7stud wrote:
Thanks for your help.
Your welcome
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
I have a simple program with classes derived from CWinApp and CFrameWnd. In my CMainWnd public: CFrameWind child class I have a menu that has one item, Item1. If I select the item it displays "Hello World" but if I resize or move the window the client area will refresh and the text will disappear from the dc.
Questions:
1. What should be in scope in OnDraw()?
{
}
2. What should be in scope OnMenuHelloWorld
{
}
|
|
|
|
|
you must call the function that is responsible for drawing inside the
OnDraw()
the OnDraw function is called by the operating system when any update occurs in the program so if you resize the window this is update so the windows will call the OnDraw function inside which will call your drawing function. by this way it wont disapear
|
|
|
|
|
Hello,
I am using VC++ 6 and I can't figure out why a ComboBox will not show list of items with a vertical scroll bar. I have the Type set to Dropdown, Ownerdraw set to No, and Vertical scroll checked.
When I click on the dropdown, I get the first item in the list with a VERY tight vertical scroll bar.
I have six items in my list, but all I can see is one at a time in the dropdown.
What am I doing wrong?
Thanks,
Murrah Boswell
|
|
|
|
|
|
Well shoot a monkey! How simple it is!
Thanks!
|
|
|
|
|
What happens when a critical secion is deleted while a thread is waiting for it?
Is this even documented?
we are here to help each other get through this thing, whatever it is Vonnegut jr.
sighist Fold With Us! || Agile Programming | doxygen
|
|
|
|
|
From what I can read from MSDN docs (see docs for EnterCriticalSection ):
- If a thread terminates while it has ownership of a critical section, the state of the critical section is undefined.
- If a critical section is deleted while it is still owned, the state of the threads waiting for ownership of the deleted critical section is undefined.
|
|
|
|
|
Hi guys,
I am wondering whether wht I am doin is right or not... first one is....
1) I am trying to read an IMAGE file through fstream class. (donno whether it is right or not)
2) If i used it, how can i read the data in it, so that I can use tht data to create another image file.
3) I know the header information of tht file, so that I can skip its header information block and start off with the actual image data.
4) but how can i tell tht i have skipped off the header info and then the current reading data is the actual image data. But i can say tht it is having a 128byte header.
more info... each pixel is stored in 2 bytes... since line offset is twice the width.... and it is a 12bit grey scale image...
any suggestions or ideas are appreciated...
thanks in advance....
Suman
|
|
|
|
|
Hi everyone,
I'm programming database using ODBC and Access. I try to bind data from database to a ComboBox. I have added a new class CProductSet derived from CRecordset, and a member variable of type CProductSet in the Dialog. When I compiled the program, VC++ appeared alot of error messages:
c:\temp\control\productset.h(14) : error C2504: 'CRecordset' : base class undefined
c:\temp\control\productset.h(16) : error C2629: unexpected 'class CProductSet ('
c:\temp\control\productset.h(16) : error C2238: unexpected token(s) preceding ';'
c:\temp\control\productset.h(33) : error C2061: syntax error : identifier 'CFieldExchange'
C:\Temp\Control\ProductSet.cpp(17) : error C2653: 'CRecordset' : is not a class or namespace name
C:\Temp\Control\ProductSet.cpp(17) : error C2065: 'classCRecordset' : undeclared identifier
C:\Temp\Control\ProductSet.cpp(19) : error C2065: 'CDatabase' : undeclared identifier
C:\Temp\Control\ProductSet.cpp(19) : error C2065: 'pdb' : undeclared identifier
C:\Temp\Control\ProductSet.cpp(20) : error C2448: '<unknown>' : function-style initializer appears to be a function definition
C:\Temp\Control\ProductSet.cpp(20) : error C2143: syntax error : missing ';' before ':'
C:\Temp\Control\ProductSet.cpp(21) : error C2448: '<unknown>' : function-style initializer appears to be a function definition
C:\Temp\Control\ProductSet.cpp(42) : error C2065: 'CFieldExchange' : undeclared identifier
C:\Temp\Control\ProductSet.cpp(42) : error C2065: 'pFX' : undeclared identifier
C:\Temp\Control\ProductSet.cpp(43) : error C2448: '<unknown>' : function-style initializer appears to be a function definition
C:\Temp\Control\ProductSet.cpp(58) : error C2653: 'CRecordset' : is not a class or namespace name
C:\Temp\Control\ProductSet.cpp(63) : error C2653: 'CRecordset' : is not a class or namespace name
I think there is something wrong with my program. Could you please tell me how to fix and the steps how to bind data from database to a specific control?
Thank you very much.
Thanks for reading!
|
|
|
|
|
Hi,
I am a new to the vc++. I am working on a project which will make the 3-D object(four characters) rotated. I used the CFont function and create the object, I didn't know how to change the color of the background and the object, see my ((codes as follows:
font.CreateFontIndirect(&lf);
CFont *pFont = pDC->SelectObject(&font);
pDC->SetTextColor(RGB(110, 185, 250));
CFont* pOldFont = (CFont*)pDC->SelectObject(&font);
pDC->SetBkMode(APOQUE);
pDC->SetTextColor(::GetSysColor(COLOR_3DDKSHADOW));
pDC->TextOut(100, 100, "PLAY", 4);
pDC->SetTextColor(::GetSysColor(COLOR_BTNHIGHLIGHT));
pDC->TextOut(97, 97, "PLAY", 4);
Meanwhile, I am wondering how can I rotate the object, can I use "lfOrientation or lfEscapement"
Thank you for any suggestion!
|
|
|
|
|