I am using MS Word automation in my C++ project to create a Word document that contains several tables. I've been able to create the document and give it a specific format such as font sizes, paragrpah aligment...
My problem is that i am not capable of center a table. This is the code i use:
//get the range
oRange = oSelection.GetRange();
oTables = Doc.GetTables();
//try to center the paragraph where the table will be placed
oParagraphs=oRange.GetParagraphs();
oParagraphs.SetAlignment(1);
// Create a 5x5 table
oTable = oTables.Add(oRange,5,5,covTrue,covTrue);
But this doesn't seem to work, the table appears with left aligment.
You don't need to release the memory of these variables because they aren't allocated on heap but on stack. Defining char* q ="54321"; is the same as defining char q[6] = "54321";.
You only need to use delete/delete [] for variables created with new/new [].
Rule of thumb: You did not call new, you do not need to call delete.
For char* r = new char[MAX_PATH+1];
you would call delete[] r;
since you did a new[].
But this is one of the cases where it does not matter, since char is an integral type and as such has no constructor or destructor.
The difference between delete and delete[] is that delete[] calls the destructor of every item to be deleted, whereas delete calls only the destructor of the first item.
My opinions may have changed, but not the fact that I am right.
jhwurmbach wrote: But this is one of the cases where it does not matter, since char is an integral type and as such has no constructor or destructor.
This is true on most, but not all compilers. According to the standard, new must be deleted, and new[] delete[]'d.
There is no guarantee that the compiler implements new[] "on top of" new. It could even use different heaps for that!
Nur wer feige ist tötet Liebe durch das Wort allein [sighist] | [Agile Programming] [doxygen] If you look for evil in me you will find it whether it's there or not.
confused:hi all,
as we know..Internet Explorer stores information entered in the single fields of form when we submit it, so next time when you are filling the field with the same name, we are able to select value from dropdown list. I need a function that has field name as it's parameter and returns array of values stored in IE (so, I need to find where and how this information is being stored.) any help and any ideas are most welcome...
thanks in advance..
For a CListCtrl with the report style, is there an easy way to prevent the user from resizing the column headers? I was hoping there would be a style setting for this, but I can't find it.
If you implement a notification handler for HDN_BEGINTRACK and within that function set *pResult = TRUE, that will prevent the header sizing from happening. Unfortunately, the handler for HDN_DIVIDERDBLCLICK does not allow this override, so header sizing can still happen if the user double clicks a header divider. I don't know a way to change this behavior.
Perhaps there is something else I'm doing that's preventing your solution from working. But I can't find anything out of the ordinary. I just SubClassDlgItem() and set the extended style to include gridlines and fullrowselect.
If you use classwizard to insert a handler for HDN_BEGINTRACK in the list control, it incorrectly inserts a reflection handler, even though the notification is sent directly to the list control (ie not through the reflection mechanism). That's why the classwizard handler is marked =HDN_BEGINTRACK (= indicates a reflected notification).
You need to replace the line ON_NOTIFY_REFLECT(HDN_ENDTRACK, OnEndtrack) in the message map with ON_NOTIFY(HDN_ENDTRACK, 0, OnEndtrack). (See the MSDN knowledge base article Q281155)
"We are the knights who say Ni" (The Knights Who Say Ni)
Sorry guys, but it's still not working. I've tried changing the message map as directed, but nothing happens. The message is still not sent. (I've checked with a messagebox.)
I noticed that the MSDN article refers to CListView while I'm working with a CListCtrl. Could this have anything to do with it?
I am developing a password entry screen( VC++ dialog based application) I am storing password in registry in HKEY_LOCAL_MACHINE\\Software\\myapp
I want it to encrypt and make access denied.
How can we set permissions of a key or its subkey . I need that the access should be denied ,if somebody tries to delete this key the key shouldnot be deleted (ie key should be read only)
I am developing it for Windows NT/2000
Hoping for a positive response
Rohit Dhamija
Software Engineer
Divas Offshore Software Technolgy Pvt. Ltd.
i apologise if this message loads slowly (received a warning when i sent). i live way out back, very slow connection, and i get email longer than this no problem)
why did the one project i did compile include syntax
different to the text book example? (staugaard, jr. structured and object oriented techniques, 2nd edition)
using borland 5.5.1 free command line tools with a command promt screen setup for me be a student list advisor so i type in 'complink <filename> to compile. i don't want to bother him further on this matter. couldn't figure out how to get a project to compile with borland 4.5, but have succedded in getting one to run with 5.5.1. i thought all i would have to do is use the same #include, #endif, etc, and all would be well. i think the enum is wrecking things in some small part, i can't find any information to show me rules for using enum's in structs. this code is probably a bit cut up by now.
you may have to fix the word wrap
you may assume i am rather green at this
/* *************************************** */
/* Yahtzee header file: */
mehere wrote: Error E2209 Yahtzmain.cpp 12: Unable to open include file 'Yahzt.h'
Something is rotten with your include-path: the compiler does not find the header file to include. He is probably not searching the Dir where it sits.
Correct that and most (any?) of the errors are fixed.
The compiler ( being supid as toast but a workaholic;) ) tries to interprete the rest of your code anyway, and fails.
My opinions may have changed, but not the fact that I am right.
mehere wrote: Error E2209 Yahtzmain.cpp 12: Unable to open include file 'Yahzt.h'
I know it sounds silly, but are you sure your file is named 'Yahzt.h'? I once mistyped the filename for a class. I wanted to include the headerfile but it wasn't found. After half an hour searching for the error I checked filenames and found the problem
Linking yahtzee.exe:
linker Warning: No module definition file specified: using defaults
Linker Error: Play::DisplayScoreCat(ScoreCat) defined in module YAHTZMAIN.CPP is duplicated in module YAHTZ.CPP
/* **************** */
these 5 linker messages continue for all functions.
i am giving up and getting on with conceptual foundations study.
thanks again
kirk
Last Visit: 31-Dec-99 18:00 Last Update: 22-Sep-24 12:35