|
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?
|
|
|
|
|
Have you tried via ClassWizard (Ctrl+W)?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
What do you mean with "via ClassWizard"? Creating a class inherited from CMenu?
When I tried to adding an event handler to the menu resource via the Event Handler Wizard I only found the messages COMMAND and UPDATE_COMMAND_UI
|
|
|
|
|
blackbondi wrote:
What do you mean with "via ClassWizard"?
Via means by way of.
blackbondi wrote: Creating a class inherited from CMenu?
Among other things, like adding member/control variables, and creating event handlers.
blackbondi wrote: When I tried to adding an event handler to the menu resource via the Event Handler Wizard I only found the messages COMMAND and UPDATE_COMMAND_UI
The list of messages will depend on what object you currently have selected. For you to only be seeing COMMAND and UPDATE_COMMAND_UI, you probably have a menu item selected.
What version of Visual Studio are you using?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Yes but like so I can't add the event handler for the two messages I want. The version is Visual Studio 2008.
|
|
|
|
|
I even can't inherit a class from CMenu via ClassWizard, because it isn't listed in the "Base class" combobox
|
|
|
|
|
It depends to your work,what do you need?
|
|
|
|
|
I want to implement the messages.
WM_MENURBUTTONUP
WM_MENUDRAG
thx
|
|
|
|
|