|
reyyy wrote: how can i assign cin to this part
i don't really get you.
don't you see the following line in the sample i gave you previously ?
std::cin >> c;
this line waits for a user input, and puts the value typed into c.
then, the process is that once the value is set, you can test it (thus the if s)
|
|
|
|
|
Well, sorry, but i have used only global namespaces, and i don't know much about this form std:: ,
that's why i was aking how can i assign cin without std::
And btw, when i put user input, program closes, without giving back statements from cases.
|
|
|
|
|
that's exactly why i don't like the infamous using namespace . you do things, but don't know at all what you're doing actually.
cin is never defined in the global namespace (otherwise, you would have been able to write ::cin without any compiler errors - that's not the case).
don't worry about the std:: . simply see it as saying "cin is in the standard namespace".
when you say using namespace std; , then every identifier (which namespace is not precised explicitely like i do) will be searched in the namespace imported.
that's good practice to never use (or at least reduce significantly the use of) using namespace . if you really feel the need of it, then prefer if inside a method rather than at the beginning of a whole cpp or .h file. that's how problems come !
|
|
|
|
|
IMHO I suggest you ask her to change it to "int" main and return something rather than opting for "void" and return nothing. It's said as the best practice particularly for the "main()". Can I be right toxcct?
Press: 1500 to 2,200 messages in just 6 days? How's that possible sir?
Dr.Brad :Well,I just replied to everything Graus did and then argued with Negus for a bit.
|
|
|
|
|
VuNic wrote: IMHO I suggest you ask her to change it to "int" main and return something rather than opting for "void" and return nothing. It's said as the best practice particularly for the "main()". Can I be right toxcct?
If you want your main() function to return an exit code, then you could return an int , or char , or whatever. It is perfectly safe to have a void main, too.
Nobody can give you wiser advice than yourself. - Cicero
ப்ரம்மா
|
|
|
|
|
Hi,
Can explain me about the mail merge concept in Vb.Net, Crystal Report, Word Doc, Excel Document
Thanks
|
|
|
|
|
Hello,
I know what mail merge means for Word. I don't know what it means for others.
In Mail merge one letter or document is attached to name or addresses of people stored in a data file.
So suppose you have typed a letter and you want to post it to 100 persons and each of these letters should have the name printed on the document then mail merge enables you to do that.You have to type one letter ,store name address etc that is the individual details in a data file and attach both of them in the mail merge procedure.When printed you will get 100 letters with particular info in place of the letter.
Prithaa
|
|
|
|
|
Here Visual C++ / MFC forum
|
|
|
|
|
I have a multi lined richtext control (the native Win32 version).
As I add a new line of text I want to vertically scroll to the last line of added text. How do I do this? I recall trying in the past and running into problems, and I'd like to fix this once and for all. Are there certain specific style bits that need to be set? Something else? EM_LINESCROLL didn't seem to act like I thought it would.
|
|
|
|
|
I think the style ECO_AUTOVSCROLL set it with CRichEditCtrl::SetOptions may be the answer, combined by CRichEditCtrl::SetSel(-1,-1).
Society is composed of two great classes, those that have more dinners than appetite, and those who have more appetite than dinners
Fold with us! ¤ flickr
|
|
|
|
|
Will that do it all the time (I don't want that)? I need it to be explicitly controlled programatically.
|
|
|
|
|
I made some tests and what I said was wrong, sorry. However, I may have found a way to do so based on the behavior of CRichCtrlEdit.
If you scroll to the end of a richedit, you will see that when you add text the richedit will scroll automatically. If the last line is 'below' the visible area, the richedit will not scroll.
A way to automate this is by using CRichEdit::LineScroll. The problem is to get the number of lines to scroll.
I tried this way:
<br />
long iStart, iEnd;<br />
m_RichEditCtrl.GetSel(iStart, iEnd);<br />
<br />
int iIndex = m_RichEditCtrl.GetLineCount() - m_RichEditCtrl.GetFirstVisibleLine();<br />
CDC *pDC = m_RichEditCtrl.GetDC();<br />
CFont *pFont = m_RichEditCtrl.GetFont();<br />
CFont *pOldFont = pDC->SelectObject(pFont);<br />
CRect clientRect;<br />
<br />
m_RichEditCtrl.GetClientRect(&clientRect);<br />
<br />
TEXTMETRIC tm;<br />
pDC->GetTextMetrics(&tm);<br />
pDC->SelectObject(pOldFont);<br />
<br />
int iCount = (int)((double) clientRect.bottom / tm.tmHeight) + 1;<br />
<br />
m_RichEditCtrl.LineScroll(iCount);<br />
And to put the last line 'below ' the richedit scope:
<br />
m_RichEditCtrl.LineScroll(-1);<br />
It's not perfect, I didn't test all the cases, but it 'globally' works
Society is composed of two great classes, those that have more dinners than appetite, and those who have more appetite than dinners
Fold with us! ¤ flickr
|
|
|
|
|
Hi all.
I write install project, I debug it and now I wont release my project, but I have proble.
Problem is thet debug wersion works and release not ??
my project conteins some windows service and API to controll service [Install, Start, Stop, Remove,write ini file].
I write anoder instalator, but . . .
In this case I need release version of project.
If service is debug version windows colls debager avry time I try to start service.
|
|
|
|
|
This[^] article is for you...
|
|
|
|
|
I have written a message handler on WM_RELEASEDCAPTURE event of Tab control.
But my problem is that Tab control generating this event only when its TCS_BUTTONS style is set.
Can any one explain me about this behavior?.
|
|
|
|
|
Buttons need to capture the mouse in order to know when the user has released the mouse button so that it can know when to act, and how to draw itself (i.e. pressed or not). If your tabs are not acting as real buttons, there is no need for the tab control to know when the mouse was released.
That is my take on it...
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
I am aggree with your answer.
But its not given in MSDN that WM_RELEASEDCAPTURE will be fired only when TCS_BUTTONS style is set. Why is it so?
Can you tell me from where I can get more information on this point?
If its given in MSDN it will be more helpful for me.
|
|
|
|
|
Hi All,
Please help me with these,
I need to know the C++/COM (both included) datatypes that can hold the following types of numbers.
1. Packed BCD --> What datatype can be used to hold these numbers.
2. Packed HEX --> What datatype can be used to hold these numbers.
Please excuse if the Q's are silly, but it will be of great help if i get the answers.
Thanks & Regards,
Dhana
|
|
|
|
|
Unpack them, and use native types.
There are no "native" packed BCD/HEX types that I know of for either C++ or automation types.
I would unpack them in order to pass them across COM boundaries using automation-capable types, like double (VT_R8 ), and int (VT_I4 ).
If you really need to perserve the native binary data, you can allocate a BSTR using SysAllocStringByteLen(...) and stuff the binary data into the allocated memory. This is generally not something for the faint-of-heart, however...
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
Hi all,
After creating a thread:
HANDLE handle;
handle = (HANDLE) _beginthread( ThreadProc,0,&val);
Is it possible to pause the thread or put it in a standby mode?
Thanxs
Regards,
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
|
|
|
|
|
Of course. See the SuspendThread(...) function.
Edit -- If you are trying to selectively wake the thread up on certain events, create Win32 Event objects, and have the thread wait on them by using functions like WaitForSingleObject(...)/WaitForMultipleObjects(...) .
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
Hi, thanx alot James
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
|
|
|
|
|
Programm3r wrote: Is it possible to pause the thread or put it in a standby mode
Yes it is. You can use events:
<br />
HANDLE CreateEvent(<br />
<br />
LPSECURITY_ATTRIBUTES lpEventAttributes,
BOOL bManualReset,
BOOL bInitialState,
LPCTSTR lpName
);<br />
<br />
<br />
BOOL SetEvent(<br />
<br />
HANDLE hEvent
);<br />
<br />
<br />
BOOL ResetEvent(<br />
<br />
HANDLE hEvent
); <br />
<br />
<br />
<br />
<br />
<br />
DWORD WaitForSingleObject(<br />
<br />
HANDLE hHandle,
DWORD dwMilliseconds
);
You can also use these functions:
<br />
DWORD SuspendThread(<br />
<br />
HANDLE hThread
);<br />
<br />
<br />
<br />
DWORD ResumeThread(<br />
<br />
HANDLE hThread
); <br />
Also Creating critical sections suspends threads when they are trying to use same datas as other threads which are using it in the same time.
|
|
|
|
|
Hi, thanx alot newbie .... I think you can upgrade your screen name to not_a_newbie_any_more
Regards,
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
|
|
|
|
|
Programm3r wrote: Is it possible to pause the thread or put it in a standby mode?
Along with what others said...
Use _beginthreadex as you can also specify a flag CREATE_SUSPEND which creates the thread in suspended mode.
|
|
|
|