|
Hi,
I would like to know how to convert CString to int???
Thanks
Ehsan Behboudi
|
|
|
|
|
inVariable=_ttoi(CStringVariable)
or
even better
sscanf(CStringVariable, "%d", intVarible
-Steven Hicks
CPACodeProjectAddict
|
|
|
|
|
inVariable=_ttoi(CStringVariable)
or
even better
sscanf(CStringVariable, "%d", intVarible);
-Steven Hicks
CPACodeProjectAddict
|
|
|
|
|
|
Hi Mike,
I presume, the code snippet below can convert a string to long, and is the most fastest method.
ConvertStringToLong( char* szFieldValue,long &lValue )
{
//Validate the string
int nLength = sizeof(unsigned long);
char szBuffer1[ 8 ];
char szBuffer[ 8 ];
szBuffer1[nLength] = '\0';
memset( szBuffer1,0,nLength );
szBuffer[nLength] = '\0';
memset( szBuffer,0,nLength );
memcpy((void*) (szBuffer1 + nLength - stringLength ),szFieldValue,stringLength );
for( int i=0;i
|
|
|
|
|
Um, there must be a ton of stuff missing from this routine because it won't compile and I can see a few ways I can get it to crash.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
I know Tim, You can crash it very easily, B'coz I haven't freed the memory, and there are a couple of other mistakes as well. But my intention was only to, break the conventional approach on converting a string to int. Its just stupid to think that, someone else will do all the jobs for U. You may have to correct the mistakes, if thr are any.
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
How do I change the window background color in the OnPaint message from white to a different color ?
|
|
|
|
|
OnPaint() is where you draw the contents of the window, so you just create a brush of the color you want and fill the client area with that brush.
Alternatively, if you will always use the same color, create the brush first and set your window class up to use that brush for the background.
--Mike--
Ericahist | CP SearchBar v2.0.2 | Homepage | 1ClickPicGrabber New v2.0! | RightClick-Encrypt
You cannot truly appreciate Dilbert unless you've read it in the original Klingon.
|
|
|
|
|
OK,
another question:
if Im not creating a window class (using NULL) can I just somehow change the default brush for it ?
|
|
|
|
|
The Bestway to paint the background of ur window is in the WM_ERASEBKGND message.
Steps:
First map the WM_ERASEBKGND and then write the OnEraseBkgnd as follows.
<br />
BOOL CDesktopDlg::OnEraseBkgnd(CDC* pDC) <br />
{<br />
CRect rect;<br />
GetClientRect ( &rect );<br />
<br />
CBrush brush;<br />
brush.CreateSolidBrush ( RGB (255,0,0) );<br />
<br />
<br />
pDC->FillRect ( &rect, &brush );<br />
<br />
return TRUE;<br />
}<br />
Best Regards,
Jijo.
_______________________________________________________
Yesterday is history,
Tomorrow is a mystery,
But today is a present.
|
|
|
|
|
Thanx Jijo
|
|
|
|
|
I added a C file to a CPP proj and got an error complaing about the precompiled header thing. MSDN says I should create a subproject and stick the file in that. However, I would rather not create a new sub project for a number of reasons.
As a solution, I found that I could rename the .c to .cpp and get it to compile file. Everything works but I'm wondering if there is a ticking time bomb just waiting to happen after this program goes into production.
Thanks,
Al
|
|
|
|
|
change the compile setting for the C file to not use precompile headers.
Maximilien Lincourt
"Never underestimate the bandwidth of a station wagon filled with backup tapes." ("Computer Networks" by Andrew S Tannenbaum )
|
|
|
|
|
Is it possible to do that for a single file in VC7? MSDN seems to indicate that the only way to do this would be to stick it in its own sub-project.
In any case I would rather not change ANY environment settings because this is for inclusion into an open source project that can be compiled on many platforms/compilers. Renaming it to CPP seems to be the easy way out. It’s just a collection of functions so I really can’t see how it would hurt. But thought it would be good to check with you guys first.
|
|
|
|
|
Hi,
I would like to have an Editor ( IDE, including source code) , with Auto-complete feature,and syntax highlighting, just like what we have in Visual Studio. If anyone has got the URLs for the same, pl. do reply.
Thanks in Advance
Jagadeesh
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
http://www.icsharpcode.net/OpenSource/SD/
(Its for C# though...)
|
|
|
|
|
Thanks for the effort ABean.
But I forgot to mention one thing, I am looking for sourec code in VC++. If you know any, pl. help me by posting the URL.
Best Regards
Jagadeesh
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
Hi, I was curious if it was possible to disable clicks within a rich edit control without disabling the entire control. My problem is even though the user cannot type inside the control, he or she can still click inside of it. Once they do this, any new text written to the control by my app is printed in the new position clicked earlier by the user. Must I line scroll before each attempt to write to the control to prevent this problem. Or is there an easier way. Thanks.
|
|
|
|
|
Anonymous wrote:
Once they do this, any new text written to the control by my app is printed in the new position clicked earlier by the user.
Don't assume anything about the control or the cursor position within. When the control needs to be updated, set the cursor position accordingly, don't assume it's already correctly set.
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
Anonymous wrote:
I was curious if it was possible to disable clicks within a rich edit control without disabling the entire control.
You can subclass the control and handle click messages like WM_LBUTTONDOWN , WM_LBUTTONDBLCLK , and so on. The message handlers should be empty so that nothing happens in response to those messages.
--Mike--
Ericahist | CP SearchBar v2.0.2 | Homepage | 1ClickPicGrabber New v2.0! | RightClick-Encrypt
"Linux is good. It can do no wrong. It is open source so must be right. It has penguins. I want to eat your brain."
-- Paul Watson, Linux Zombie
|
|
|
|
|
it is possible to have a property sheet acting as a dialog bar ? what i want to do is a dialog bar with several pages.
thanks.
|
|
|
|
|
a dialog bar acting as a property sheet, sorry.
|
|
|
|
|
Hi,
I want to update the value shown in dialog box created using CDialog class at real-time. For eg., if i want to show the clock time read from the computer clock(say in secs), how should i go about doing it?Suppose, the value is that of a variable in the program running in the background.
Thanks
|
|
|
|
|
You'll need a control on the dialog template, probably an edit or static control. Using ClassWizard, create a member control variable (CEdit or CStatic ). When it comes time to update the control, use something like:
m_control.SetWindowText(whatever_the_text_is);
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|