|
Anything in USER.DLL, USER32.DLL - I have no idea if there's a USER64.DLL as I'm using my FreeBSD computer at the mo
|
|
|
|
|
A lot of people let the naming convention of the threads mislead them. The difference in the two threading schemes is really more of a description of how they'll be used (although the "UI" name is not a great description since it doesn't necessarily involve dealing with a user interface).
|
|
|
|
|
No, but you can implement your own messaging system if you like.
To do this you need a message queue and a worker thread that empties it and acts on the message. Any other part of your code can lob messages onto the queue, at the head or tail depending on priority. (Message addition needs synching).
I have used this kind of design a lot in all sorts of code and it can simplify complex things massively.
==============================
Nothing to say.
|
|
|
|
|
I would only do this if the queues provided by the framework isn't sufficient, otherwise UI threads are just easy to make anyways (might as well use them as is).
|
|
|
|
|
how to right vector of pointers to binary file ?
every pointer have diffrent size ,and i need to save to file and restore from file
|
|
|
|
|
it makes no sense to write a pointer to a file.
Asaf Shay wrote: every pointer have diffrent size
pointers are always the same size (4 bytes in Win32, 8 bytes in Win64)
are you trying to write the structures that the pointers point to to a file?
|
|
|
|
|
There are several things wrong here.
First of, all pointers will be of the same size.
On a 32-bit OS, all pointers are 4 bytes or 32-bits and on a 64-bit OS, all pointers are 8 bytes or 64-bits.
Secondly, you do not want to persist pointers to a file, because they will not be valid when you read it back into the program as the address is not guaranteed to be the same every time the program is run.
So what you need is to have a vector of objects/data type instead of a vector of pointers. This is the recommended method.
Have a method of the object to return the data to be persisted.
Typically this must be a structure.
In the main program iterate through the elements of the vector, call the method that returns the data to be persisted and write it to a file.
You can use any of the file operation routines like CreateFile /WriteFile or fopen /fwrite to do this.
You would also need a method of the object to put back the data when you read it from the file.
|
|
|
|
|
hi,tanks for the comments,my problem is i can write to file and read from it only if my program is running,if i close the program and open again and try to read from the file i get run time error
"vector iterator not dereferencable"
case 'd':{
file = fopen("final_proj.bin","w+b");
t = arr.begin();
fwrite( (*t), sizeof(figure3d), 1, file);
system("cls");
cout << "saved to file successfully\n"<<endl ;
fclose(file);
flushall();
}
case 'e'://restore from file
{
file = fopen("final_proj.bin" , "r+b" );
t = arr.begin();
fread ((*t), sizeof(figure3d) , 1 , file);
temp.push_back(*t);
temp[0]->print();
/*arr.push_back(*t);*/
fclose(file);
}
|
|
|
|
|
It could be because you're having a vector of pointers.
Change that to vector of copyable objects.
|
|
|
|
|
After frustrating experiments with CTabCtrl based classes I am using simple property sheets to have a tabbed pane in static splitter. Does the job for me, with one exception.
The standard property frame is a pop-up of default dimensions ( taken from the max page ) and when changed to child I can move it to the correct position in the splitter.
And here is the "but" - the right and bottom dimension are not correct( but usable) and the only way I figured it out to adjust it is to get the parent (splitter) frame dimensions.
Works, and here comes another but - these are the whole splitter frame dimensions.
I would like to know if there is a easy way to get just the right pane dimensions.
BTW - the panes are created with constant sizes.
I could just hack it and make the sizes global variables.
Here is my very basic code:
void C_RightPane_Form::OnProperties()
{
CRect rect;
GetClientRect(rect);
C_Splitter_Static *pCFrameWnd = (C_Splitter_Static*) GetParentFrame( );
ASSERT_VALID(pCFrameWnd);
pCFrameWnd->GetClientRect(rect); // whole frame
// TODO need only right pane
if (m_pPropFrame == NULL)
{
m_pPropFrame = new CPropertyFrame1;
//CRect rect(0, 0, 0, 0);
CString strTitle;
VERIFY(strTitle.LoadString(IDS_PROPSHT_CAPTION1));
if (!m_pPropFrame->Create(NULL, strTitle,
WS_CHILD |
!WS_POPUP | WS_CAPTION | WS_SYSMENU, rect, this))
{
delete m_pPropFrame;
m_pPropFrame = NULL;
return;
}
//m_pPropFrame->CenterWindow();
m_pPropFrame->MoveWindow(0,0,rect.right, rect.bottom);
}
Thanks for your time.
Vaclav
|
|
|
|
|
|
first - sorry about my english
i have two vector of pointers: arr - contain info and i want to copy from him for example the second element to new vector of pointers that call temp and delete the element from arr .how it can be done ?
i write somting and it's not good but i only attach the that you see what i mean
int choose;
cout<<"choose index number of the object you want to delete:";
cin >> choose;
temp.push_back(arr[choose]);
delete arr[choose];
arr.erase(arr.begin()+ choose);
|
|
|
|
|
a1_shay wrote: delete arr[choose];
Why are you deleting this object?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> If it doesn't matter, it's antimatter.<
|
|
|
|
|
because this my exercise
the main idea is that i need to delete object.and later if the user choose case undo I WILL return from temp the object that i put out before
someone told me that i need to delete the object with delete and that only delete the object,from what i am traing i see that delete free the address of that pointer and that's why i can print the temp after that
void deleteobject(vector < figure3d *> &arr,int index,vector < figure3d *> &temp)
{
vector < figure3d * > :: iterator i=arr.begin();
temp.insert(temp.begin(),*i);
delete *i;
arr.erase(i);
temp[0]->print();
}
modified 1-Jun-12 18:14pm.
|
|
|
|
|
Well that will be difficult, considering you deleted the object you're pointing to.
delete arr[choose];
Doesn't remove the pointer from the array, it deletes the object pointed to by that pointer, and since you added the pointer to that object to the other vector, the pointer in the other vector now points to junk data.
Think of a pointer like an address, you gave your second vector an address to a house, then demolished the house. If it tries to go there, it won't find the house it expects to find.
|
|
|
|
|
i understand pointer .and that's why i wrote
temp.insert(temp.begin(),*i); //i save here the data not the address
to save the object before i delete it from the original
|
|
|
|
|
You'd be correct if insert took *i by value, but it takes it by reference (look at the method signatures here[^]). You're still giving it the object then deleting it. You need to explicitly make a copy of it.
|
|
|
|
|
can you please tell me how i need do that.becouse i try many things'and without succees
never mind thanks all
modified 1-Jun-12 18:56pm.
|
|
|
|
|
To preview xls file i call CreateFromFile or CreateFromClipboard and it works
But if xls file has password and i do not enter it then my program hangs. It gives switch to/retry message.
Is there any way to solve this problem
|
|
|
|
|
MKC002 wrote: Is there any way to solve this problem How about using Excel automation instead (where the password can be provided to the Open function)?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
I want to show excel file contents in my own window
|
|
|
|
|
Ok, so what's the problem?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
CreateFromFile hangs my program.
If excel file contains some password and i call CreateFromFile for that file, it asks me to enter password. If i click on cancel button and do not enter the password then my program hangs. It gives retry/switch-to message. How to solve this problem.
|
|
|
|
|
MKC002 wrote: How to solve this problem. Use Excel automation instead, where the password can be provided to the Open() function.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
I want to open excel file contents in my own window, not in excel window. Is that possible with excel automation?
|
|
|
|