|
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.
|
|
|
|
|
OK, but why do you call the method without filling parameters with meaningful values?
I read a bit the documentation and it seems you cannot simply supply empty variants.
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]
|
|
|
|
|
Hello Force Code,
I'm not familiar with the IWebBrowser2 interface but after looking up the documentation for Navigate(), my gut feel is that the 2nd to the 5th parameters should be filled with VARIANT parameters that actually contain some information (rather than just being VT_EMPTY). Passing "NULL" might even be a better choice (I really don't know).
My suggestion is to look up the documentation for Navigate() for proper guidance and then pass in appropriate values for the 2nd to 5th parameters.
- Bio.
|
|
|
|
|
I've created a function to load a bitmap file. Load the BITMAPFILEHEADER, load the BITMAPINFOHEADER and then I get the data. If it needs to be flipped, I flip it.
My problem is that not all images can be loaded. I have created 3 images in Paint, all 64x64, 24-bit bitmaps. Two of them load just file, but the third one is warped - like it has been in a storm or something! No matter if I try to copy and paste it to a new bmp, it's still warped!
Anyone happens to know what may be the cause?
|
|
|
|
|
Gadjuka wrote: Anyone happens to know what may be the cause?
Probably. Seeing the loader code would make it much simpler
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Gadjuka wrote: Anyone happens to know what may be the cause?
A mistake in your code (i.e. my CPMRU is out of order tonight ).
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]
|
|
|
|
|
Is your pixel buffer DWORD aligned?
You may already know this, but there may be extra bytes at the end of each row of the image, so that the number of bytes in each row is divisible by 4 (i.e. DWORD aligned). The actual number of bytes per row is not the width (in pixels) multiplied by the number of bytes per pixel. Instead, it is the next higher number which is divisible by 4. The actual width in bytes is called the stride.
You can compute the stride using:
int s = ((w * bpp+31) / 32) * 4;
where s is the stride (number of bytes per row), w is the width of the image (in pixels, not in bytes), and bpp is the number of bits per pixel, in your case 24.
So then the size of the buffer into which you copy your pixels will be the stride times the height (number of rows) in the image.
This seems likely to be your problem, since your pixels are 3 bytes each, rather than 4 bytes each.
Hope this helps.
|
|
|
|
|
Actually - I didn't know!
As you say, it seems likely this is the cause of my problem. I'm gonna try this as soon as I get home!
If this doesn't help, I'll do as Mark said and post the code...
|
|
|
|
|
I thought my image was 64x64 and hence this that you have to have a width that is dividable by 4 shouldn't be a problem. But the image was really 65x64!
But with the information I got from you Californian2 I was able to fix so that my function now can load bitmaps of any size. Thank you very much!
|
|
|
|
|
Hi,
How can I use these menu notifications on MFC:
WM_COMMAND
WM_CONTEXTMENU
WM_ENTERMENULOOP
WM_EXITMENULOOP
WM_GETTITLEBARINFOEX
WM_MENUCOMMAND
WM_MENUDRAG
WM_MENUGETOBJECT
WM_MENURBUTTONUP
WM_NEXTMENU
WM_UNINITMENUPOPUP
I didn't find anything on the MSDN Library. Can anybody explain me the messaging routing of the menu object?
Thx
|
|
|
|
|
|
I know that, but I didn't find the wrapper (command-handler member function) for these messages in the CMenu class, e.g the command-handler member function for WM_CREATE is OnCreate etc. My idea is to inherit a class from CMenu and add the message handler-functions for these messages, is that correct?
|
|
|
|