|
Ok., why using CString causes error?Is there any header file is missing?
|
|
|
|
|
#include <atlstr.h>
Maxwell Chen
|
|
|
|
|
Ya!! it solves the problem!
|
|
|
|
|
include the correct header buddy !
|
|
|
|
|
#include <atlstr.h>
Thanks!
Maxwell Chen
|
|
|
|
|
Sakthi_Vel wrote: For ATL program with no MFC support.
Starting from Visual C++ .NET, I think that ATL and MFC have merged together.
Maxwell Chen
|
|
|
|
|
Try using std::stringstream or boost::format[^]!
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
1) please read the thread before answering
2) what you suggest has already been proposed
3) CString works fine however, as it is an ATL class though.
|
|
|
|
|
toxcct wrote: 1) please read the thread before answering
Guilty
toxcct wrote: 2) what you suggest has already been proposed
Not really - you did just barely mention it with: "but Boost provides one".
I gave the link
toxcct wrote: 3) CString works fine however, as it is an ATL class though.
Thats true, but he explicitly asked for formating other than using CString but for the wrong reason
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
|
I need to free memory in CMyListCtrl.
void CMyListCtrl::OnDestroy()
{
UnInit();
CListCtrl::OnDestroy();
}
It's ok, but the comments says to add code after called CListCtrl::OnDestroy
So I try to find another way
BOOL CMyListCtrl::DestroyWindow()
{
UnInit();
return CListCtrl::DestroyWindow();
}
But it is not called by the framework.
Where should I do UnInit in this sample?
|
|
|
|
|
What is done in the UnInit()?
|
|
|
|
|
It calls GetItemData, so UnInit should be called before CListCtrl is destroyed.
I'm finding a right place to call UnInit .
|
|
|
|
|
GetItemData should be called before the call to CListCtrl::OnDestroy()
void CMyListCtrl::OnDestroy()
{
GetItemData( 0 );
CListCtrl::OnDestroy();
GetItemData( 0 );
}
|
|
|
|
|
Of course you should delete your own data before call the base class's OnDestroy function.
Your own data should be deleted first, and then the listctrl's internal data.
A Chinese VC++ programmer
|
|
|
|
|
Dear all
i have one file which includes a 150x4 array in D driver, how can i open it and print on the screen? that means i just want to see the output is right or wrong,thanks a lot.
my file was saved as excel formate.
Li Zhiyuan
11/1/2008
|
|
|
|
|
li zhiyuan wrote: my file was saved as excel formate.
True excel format (.xls) or CSV format (.csv)?
Maxwell Chen
|
|
|
|
|
.xls, microsoft office excel workbook is type
Li Zhiyuan
5/10/2006
|
|
|
|
|
Hi all,
Does anybody have any experience with Application Memory Management using a proprietary database?
We have hit a bit of a snag using the 2gig process address space with our product for customers who have large amounts of data. Our server manages several databases, each with 200+ tables, and up to 65,000 records in each table. Currently, when the server fires up, we load in all the databases into Virtual Memory regardless if they're needed or not. As part of the load process, we "reserve" the maximum number of possible memory for each table so we can easily add records to the end that table. We only commit to the number of records that are active. Problem is, Windows will only allow us to "reserve" up to the 2gig mark.
We've considered a few options:
- including only loading in the required databases - but it IS possible that at any given time, all databases will be required (Client/Server application).
- Writing a mechanism that would leave not recently used tables on disk until required.
- Use a process for each database - could get messy with mutex's etc.
A few questions:
- Does anybody have any experience here? What kind of mechanism does your software use?
- Is there a way to elegantly go beyond the 2gig limit?
- How does SQL/MySql handle large databases - ie: When a new record is added to the table - does it append the new record to the end of the allocated memory block?
Unfortunately for our market, the evil proprietary database is the way to go. We're not in a position to change to migrate to anything new at the moment.
Any information/suggestions you might have would be greatly appreciated.
Thanks.
Mike.
|
|
|
|
|
Have you considered using File Mapping[^]?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi Mark,
Thanks for your reply.
We are using CreateFileMapping(), MapViewofFile() etc. We use this basically to give names to blocks of memory. We load each table off disk into blocks of memory managed by CreateFileMapping/VirtualAlloc.
I guess the biggest problem is the addition of new objects to a table and the memory we reserve.
Each table has a maximum number of objects... We reserve up to the maximum size required for that table and commit up to the number of active objects. When we reserve memory, its counted towards the 2g process limit. We reserve the bytes so that when a new object is added, we just need to commit "objectsize" at the end of the last committed bytes, we're not moving memory around or doing any further juggling.
Is there something I'm overlooking with File mapping that might help us out?
Thanks again for your reply.
|
|
|
|
|
you can use mmap function to store the data or you can use timesten product.
Best,
Kevin Jo
http://www.upredsun.com
**Easily and automatically build tcp-based or udp-based network protocol source code**
|
|
|
|
|
Trying to create and access a WebBrowser control behind the scenes in a win32 console app:
::CoInitialize(NULL);
SHDocVw::IWebBrowser2Ptr brwsr = NULL;
HRESULT hResult;
hResult = brwsr.CreateInstance(__uuidof(SHDocVw::WebBrowser));
I can then call brwsr->get_Name, brwsr->get_FullName etc. with no problem.
brwsr->Navigate(...) is causing a runtime crash (with CoCreateInstance or CreateInstance.)
Here's the current method I'm using:
BSTR oURL;
oURL = SysAllocString(L"http://www.google.com");
VARIANT var;
var.vt = VT_EMPTY;
brwsr->Navigate((BSTR)oURL, &var, &var,
&var,&var);
SysFreeString(oURL); (which I copied and pasted from somewhere).
Have no idea if anybody still uses COM, but does someone know what I'm doing wrong.
|
|
|
|
|
Force Code wrote: Have no idea if anybody still uses COM, but does someone know what I'm doing wrong.
Nope. Nobody uses COM nowdays. But a long time ago (I was just a child), a wise COM guru told me: "Check always HRESULT s, my son!"
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
The fact that its crashing on the brwsr->Navigate call sort of rules out checking the return value.
What would you be using to access the web in a trivial win32 console app.
|
|
|
|