|
I get the impresion that Voxels is an object with actual behavior, and therefore shouldn't be written to a file like that. Things like virtual function table pointers can't be saved and restored that way. Also, it looks like Voxels is a relatively small object with a pointer to a huge array, so you wouldn't lose much performance by saving the simple members of Voxels individually. I would save the simple members of Voxels first and then save the array with one file.write call. To restore it, I'd create a Voxels object, read the simple members, and then allocate and read the array.
Also, I noticed you are using unsigned int for the size to write to the file. If you use size_t, the type will be adjusted properly if you migrate to a 64 bit system.
Nathan
|
|
|
|
|
It doesn't have that much behavior other than a constructor and a destructor to free the memory. The reason I was doing it this way was because I would be adding more data members to describe the data later. But you're probably right that it wouldn't add that much performance loss to write each data member. I'll have to time it and see.
I've made a workaround where I allocate 2 buffers, 1 for the object and one for the data, the rest of the code stays the same. That doesn't trigger the assertion. However I don't know if the object's memory gets freed or not since I'm still calling delete Voxels and not delete [] voxels;
|
|
|
|
|
Budric B. wrote: It doesn't have that much behavior other than a constructor and a destructor to free the memory. The reason I was doing it this way was because I would be adding more data members to describe the data later. But you're probably right that it wouldn't add that much performance loss to write each data member. I'll have to time it and see.
Watch out for the copy constructor and assignment operator, since the compiler will generate invalid forms and call them freely.
Budric B. wrote: I've made a workaround where I allocate 2 buffers, 1 for the object and one for the data, the rest of the code stays the same. That doesn't trigger the assertion. However I don't know if the object's memory gets freed or not since I'm still calling delete Voxels and not delete [] voxels;
I think that should work. The main difference between delete and delete[] is the way destructors are called, which shouldn't be a problem if it's just data.
Nathan
|
|
|
|
|
Is it possible to trap DDE messages from the shell?
I mean when a file is opened and it's open method is a DDE command rather than a command line. I have been trying to use SetWindowsHookEx() with no success so far, just wanted to see if I was fighting a lost battle.
|
|
|
|
|
I dont know about "trapping" them but you can monitor them. See the DDESpy Tool, it should have been installed in your Visual Studio/Common/Tools directory, the sources are available as a sample also.
|
|
|
|
|
I have tried DDESpy and I can see the conversation when I load something like Excel document but what I am trying to do is see the messages when something like a .GIF's 'open' verb is invoked which uses DDE to open it with 'OIS.EXE'.
The ultimate goal is to create a ShellExecuteHook which also works for DDE verbs.
|
|
|
|
|
I'm having the compiler give me
error C2327: 'ABC::m_strErrorMessageText' : is not a type name, static, or enumerator
And this is likely because I'm not putting the code together just the way it wants it.
Here's the code
class ABC
{
public:
CString m_strErrorMessageText;
const char* GetErrorMessageText(){ return ( (const char*)m_strErrorMessageText ); }
class DEF
{
public:
enum tagSource
{ INIT,
TERMINATE,
OPEN,
SQL
} Source;
char m_lpErrorText[256];
DEF(tagSource src){Source = src;}
};
class GHI
{
public:
error-> GHI() { m_strErrorMessageText = "Registry Information is missing. Please run BATCH_CONFIG.EXE to correct."; }
};
This code is to house various exceptions that may occur within a library and I'm trying to let each of the different exception types, DEF, GHI put text into the ABC::m_strErrorMessageText member in anyway they want to. The consumers of the library can then decide what exception types they wish to catch and simply use the ABC::GetErrorMessageText in order to get meaningful information. Any ideas on what I might still need to be doing here? Thanks.
Chris Meech
I am Canadian. [heard in a local bar]
|
|
|
|
|
Chris Meech wrote: GHI() { m_strErrorMessageText = "Registry Information is missing. Please run BATCH_CONFIG.EXE to correct."; }
Well GHI either needs an instance of ABC or you need to make that CString a static member of ABC. However based on your last comments in the post I have doubts about your design.
|
|
|
|
|
Thanks. Based upon your's and Mike's reply, I am going to have rethink my design. As well as remember a little more about nested classes.
Chris Meech
I am Canadian. [heard in a local bar]
|
|
|
|
|
You don't have a reference to an ABC object inside GHI's constructor. m_strErrorMessageText is an instance variable, not a static variable, so you need an ABC pointer/reference/object. Nested classes are only a definition scope - you don't automatically get a GHI instance member of ABC, for example.
DoEvents : Generating unexpected recursion since 1991
|
|
|
|
|
Mike, thanks for your excellent response. It explains things exactly and coupled with led mike's response, I'm going to have to re-design things. Not sure why the original designer used the nested classes. It seems superflous considering the original design had no members for the ABC class. Appreciate the quick explanation and help.
Chris Meech
I am Canadian. [heard in a local bar]
|
|
|
|
|
If you are using nested class then consider using 'friend' to control acess to members of the other classes. But you will still need a pointer/reference to access the in the first place.
|
|
|
|
|
I have added a List control as a resource on a dialog box. It is multicolumn and i have been able to set its column headers and width.
Now in my OnIinitDialog function i want to insert first row where the second column should have a check box instead of having any value.
Dont know how to add a check box as a item to a multilist column.
Please help me.
Dhiraj Kumar Saini
-- modified at 9:53 Wednesday 19th September, 2007
|
|
|
|
|
Dhiraj kumar Saini wrote: Dont know how to add a check box as a item to a multilist column.
One solution is here.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I want to add such a control in my dialog box which can house several pictures in it and can decrease and incease in size dynamically as i add pictures in it and also pictures can be of any type.
One thing more which i want is that each picture should have a caption at the bottom as a title of the picture and on taking mouse over it the title hsould change its colour from black to blue.
I f u have problem in understanding what i want to do just see webshot desktop which i am also trying to develop exactly same.
Please help me.
Thanks In Advance.
Dhiraj Kumar Saini
|
|
|
|
|
Dhiraj kumar Saini wrote: Please help me.
Help you what? Create your application? Read the first thread in this forum titled "How to get an answer to your question". Pay attention to item #2.
|
|
|
|
|
Dhiraj kumar Saini wrote: I want to add such a control in my dialog box which can house several pictures in it...
Use a static control with the SS_BITMAP style.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Heh. The OP had more specs. I think led mike is writing it for him
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Whew! That's a relief. I'd hate for the OP to have to go home this evening without having accomplished anything.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
For write a title on the bottom of image on your program you can use of CDC::(Textout or DrawText) and after any effect on the image you must get a hbitmap of it and use of it on any controls.
|
|
|
|
|
Hello,
when I compile my project, there is a fatel error "fatal error RC1015: cannot open include file 'winresrc.h". the file is under the directory "Z:\gen_tools\include", and I added the path "Z:\gen_tools\include" in "tools ->options->directories" too. I don't know what can I do with the error. Please help! thanks in advance!!
|
|
|
|
|
http://forums.microsoft.com/MSDN/ShowPost.aspx?postid=220223&siteid=1
check above link
|
|
|
|
|
thank you very much.
unbelievable, the path name under tool->option->directories is case sensitivity! I just input the path again with 'GEN', and it works!
best regards
|
|
|
|
|
Hi,
I have list control whose property is set to
"List1",IDC_CmdResp,"SysListView32",LVS_REPORT |
WS_BORDER | WS_TABSTOP,293,37,146,214,
WS_EX_DLGMODALFRAME | WS_EX_CLIENTEDGE | WS_EX_RIGHT |
WS_EX_STATICEDGE
Am displaying the data read from the serial port in the list control but there is lot of filckering.Below is the code to display the data in list control.Is there any thing am missing in the code.Why there is flickering?More flickering starts when i start deleting the data.If i don't delete i get assert error that maybe due to memory overflow of the list control.Plz help me out.
void CNgpptDialog::ReadSerialData(CString sIn)
{
CString pressure_data;
ptrCmdResp->SetRedraw(false);
pressure_data=sIn;
int counter = ptrCmdResp->GetItemCount();
ptrCmdResp->InsertItem(counter, "");// to insert a row
ptrCmdResp->SetItemText(counter, 0, pressure_data);// column0
ptrCmdResp->EnsureVisible(counter, FALSE); // Scrolls downwords.
if(counter > 150)// I start deleting first data when the number of items in the list control is > 150
{
ptrCmdResp->DeleteItem(0);
}
ptrCmdResp->SetRedraw(true);
int nIndex = ptrCmdResp->GetItemCount();
ptrCmdResp->RedrawItems(nIndex,nIndex);
}
}
Thanks in advance
|
|
|
|
|
Hi,
I am using NTGraph contrl an Active X control.
I need to erase a portion of the graph before plotting the new data each time.
But the control provides only cleargraph function which erases the whole graph completely.
Can anyone help me in this regards,
Thanks in advance.
with regards,
Dan
|
|
|
|