|
Use CDateTimeCtrl . It can be validated.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Doing it "old school", you can use a call to sscanf(...) , which was designed for scanning a formatted string. For example, if you would build a string using printf(...) with a format string of "%02d/%02d/%02d" , you would scan that string back with that same format string, and check the return value of sscanf(...) to make sure you scanned out three tokens/values.
That would help you verify the format, but not the data... For example, scanning "99/88/77" would be successful, even though it is an invalid date.
Peace!
-=- James 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! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites
|
|
|
|
|
A nice article on codeproject site, "editable date time control", using date time edit control and programmer is validating the date based on format, if you check his code, you may get idea about date validation from edit control.
Anand
|
|
|
|
|
I am having an issue with malloc on Win2000 and WinXPPro. I am trying to repeat a real world scenario here. I have a loop that keeps calling malloc until it fails (use all virtual address space).
1) malloc 1100 rand() size blocks between 0 and 32 bytes.
2) malloc nSize block
3) malloc another nSize block
4) free 2)
5) repeat from 1 until any malloc fails
6) free all allocated memory
After process creation if use nSize>520184, this will continually use all virtual space until use nSize<=520184. Now use nSize>520184 will allocate 1-25 blocks then malloc fails. I can continually use nSize<=520184 and use all address space.
Basically once I have filled the address space with blocks <=520184 I can no longer use blocks >520184.
Anyone got any thoughts
|
|
|
|
|
Maybe you can refer to the intersting article about the allocations in MSDN:
Search "globalalloc" then rubrik "Allocations memory; the old-fashionned way"
Hope this will help you.
|
|
|
|
|
It sounds like your allocation pattern is causing heap fragmentation. I'm not sure whether Windows 2000 or XP automatically coalesce adjacent free blocks, or whether they leave those blocks as separate blocks. I suspect that if the code from the VC6 runtime library was used or adapted, they only join the block being freed with the next block if that is also free.
You can force a full coalesce of the heap by calling _heapmin . The documentation currently states that it's only supported by Windows NT but my reading of the source indicates it should also work on 2000, XP and 2003. Under the covers this function calls HeapCompact .
One strategy to prevent the fragmentation in the first place is to allocate different size blocks, or blocks with different lifetimes, from different heaps. You can create your own heap using HeapCreate .
The heap code is really meant for small variable-size blocks. If you're creating 512KB buffers, you might be better off calling VirtualAlloc directly.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Thanks for your thoughts. Different size blocks or different heaps is not applicable here. I have modified the loop to use malloc for small blocks and VirtualAlloc for the big blocks. This gives me more stability and memory usage. But, there is always one, this code is ANSI C only, so no access to VirtualAlloc.
If it is fragmenting memory then should this not be a gradual degredation? NOT as stated, use <=520184 and immedialty you cannot alloc more? There is something odd happending in the MS implemenation of a VMM!
|
|
|
|
|
I'm curious, why do you need to allocate so much memory from the heap, to the point where you exhaust it?
Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"
|
|
|
|
|
How to set the modified time of a file as the current time?I used setFileTime()but have confusions.Can anyone give idea with exmple.Thanks in advance.
|
|
|
|
|
|
CEdit in multi-line style has two length limit, one is max text limit, which can use SetTextLimit() to solve, another is line length limit(about 1024), Does any one know how to solve it?
I search for a long time, but cannot find the solution.
Is there possible to simply solve it?
|
|
|
|
|
fangzj wrote:
Does any one know how to solve it?
Solve what? Are you wanting the text limit increased, or the line length increased? Have you considered CRichEditCtrl ?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Thanks for your advise. But I just want to know it is possible to change the line length limit of a CEdit control in multi-line style. I donot want to use CRichEditCtrl or write my own control in my sample project.
|
|
|
|
|
fangzj wrote:
But I just want to know it is possible to change the line length limit of a CEdit control in multi-line style.
How are you verifying that each line of a multiline edit control is limited to 1024 characters?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
That is a very clear process:
In a dialog, put an edit control, tick multiline, horizontal scroll and auto hscroll options.
Then run the dialog app, in the edit control when you enter any character, in my test with '-', the line wraps another line if total number is great than 1024.
In fact, in any CEdit or CEditView app, like windows notepad.exe, the line wraps another line if total number is great than 1024.
|
|
|
|
|
That limit is apparently imposed by the Edit window class. Testing shows that the RICHEDIT window class does not share the same limitation. Would there be a fundamental reason to therefore not use CRichEditCtrl ?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I decide to write my own edit control from CWnd.
Ask this question, I just want to make clear that the Edit window class doe s have this limit. Microsoft should write it in the document, or update in the new version release.
Any way, Thanks!
|
|
|
|
|
fangzj wrote:
Ask this question...
What question?
fangzj wrote:
I just want to make clear that the Edit window class doe s have this limit.
Thanks for agreeing with me.
fangzj wrote:
Microsoft should write it in the document...
Agreed.
fangzj wrote:
...or update in the new version release.
Since it is not a bug, what's to update, especially since there is a work around (i.e., use the rich edit control)?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
hii..
how can i get the id's of resources of an exe ...
i want to pass the id's to the Find Resource function..
regards,
kedar.
|
|
|
|
|
I guess ResHacker will od the job:
www.users.on.net/johnson/resourcehacker[^]
All the label says is that this stuff contains chemicals "... known to the State of California to cause cancer in rats and low-income test subjects." Roger Wright http://www.codeproject.com/lounge.asp?select=965687&exp=5&fr=1#xx965687xx
|
|
|
|
|
where can I find multiple page internet explorer souce code?
thank u
|
|
|
|
|
I have a SDI project which has two views,left is a treeview,right is a list view.I want to place only one tabctrl at the botom of the two views which can over control each of the two views.How can I place the TabCtrl in the mainframe?
Thanks everyone!!!
|
|
|
|
|
Thank you all all the same!
I have solved the problem.
I used a ReBar,just created at the bottom.
|
|
|
|
|
hi all
I am maintaining an old app which works fine in 2000 and 98'
there is a printing issue which is not consistant across Windows XP boxes. On some it works fine and others it doesnt - on these "bad" ones the print preview has text is "off the page" and text is correct just too wide and large !
but as i say, on other XP pc's there is no problem and its all cool
On windows 2k and 98 there is no problem.
I figure this isnt the first time this problem has been encountered...
Is there a simple fix to make it work on all XP/2k/98 boxes or do i need to get down and dirty with the code and detect that i'm running XP and do appropriate things...also why does it work on some pc's and not others...is it a driver type issue?
cheers
Bryce
---
To paraphrase Fred Dagg - the views expressed in this post are bloody good ones.
--
Publitor, making Pubmed easy.
http://www.sohocode.com/publitor
Our kids book :The Snot Goblin
|
|
|
|
|
HI , I have already build application , now i am doing chaning in it.
I have added new items in Menu ,( say in File menu I added "Show Labels" item ).
But at runnig the application it shows "Show Labels" item Inactive ..
I checked its properties .. its all OK .
So where and how can I show it as Active item in SDI application.
thanx.
Regards.
|
|
|
|