|
Hello, I need to merge cells (2,2) and (2,3) in a word document doing word automation with visual c++.
It makes two weeks that I am trying to do this and I haven`t got any results.
Thanks
|
|
|
|
|
I have an algo which takes in an iterator range like Func(I beg, I end).
These are randomaccess iterators so I can do stuff like beg[i] which gives me back the ref to the ith element of the underlying container:
T& t = beg[i].
Now inside the algo I want to swap the contents of say beg[i] and beg[j], and all I have info about is the range. I dont have any info about the type T within my algorithm.
However to do a swap I need a temporary variable to store one of the values :
T& temp = beg[i];
beg[i] = beg[j];
beg[j] = temp;
However, as I said, theres no info on T coming into the algo, so how would I swap the contents using these randomaccess iterators since I very well cant define a 'temp'?
thanks,
ns
|
|
|
|
|
and why you don't use std::swap() ?
Robert-Antonio
"A flower walked around a meadow. She saw a beatiful human and plucked off his head."
|
|
|
|
|
|
T& was your problem. Make it T. But std::swap is better anyways.
John
|
|
|
|
|
std::swap was good.
But see, I couldnt use anything to do with T within my generic algo which has signature Func(I beg, I end), since only the range is coming in, not the type in the container.
Thanks,
ns
|
|
|
|
|
I see. You must make your algorithm a template function to do this.
template<class T>Func(I beg,I end)
John
|
|
|
|
|
You should've posted this link into the general section, as people use other programs than VC++ to code DirectX and Win32 applications as well. As you posted it here, it may be overlooked by some members who don't read this subsection of the forums.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Is there method to set DeviceCaps so as if system font changed?
System font changed and all sized in a dialog too,
but I want that all sized remained same,
is it possible to make by some CDC tune or
font Dialog or else change?
(Remaining system font changed)
thanks.
|
|
|
|
|
Maybe it's the language barrier, but what exactly are you asking?
Are you wanting to change the system font?
Are you wanting to know when the system font changes?
Something else?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Sorry for not good language,
(around people was preventing me from better check, sorry,
but I will try to write better nonetheless)
System font changed by yser,
but in my CDialog I want font at screen remains not changed,
the main purpose- control's distances remains not changed,
due to they are rendered according to system font.
For this purpose is need to chnge something at CDialog.
Is it only font?
It is roughly changed - not with decimal digits as system font.
So precise in control rendering is lost.
Or I can change spme DC properties?
|
|
|
|
|
Are you wanting a dialog's font to remain unchanged no matter what the system font is changed to? I'm sure this is possible, but it totally goes against good design. The user should be able to configure their system (e.g., fonts, colors, sizes, sounds) and all applications should reflect those changes.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Bitmaps are pixel- based,
and if you want to combine Dialog controls with pixel based controls you
get either big work with it to resize pixels,
to make picture seems correct - that's main benefit.
or just by compensating font,
you can get same without big work.
Design- is agreement between concrete user and developer as sailer of system,
and additional tune is good but cost, but may fully not in need.
Or user especially want to have system untuned, due to they pay for it.
___________
You wrong - in consideration that design is feature.
"design is not feature"
___________
fascists made you joke so easily, to deceve people -
that the are not fascists really! (behind the scene, they carve people)
Be careful !!
|
|
|
|
|
None of what you said makes any sense at all. Please state the exact problem you are attempting to solve. Otherwise, any help you hope to receive will be a guess at best.
From my last two responses to you, I've asked three yes/no questions, which you have not answered. If you can answer those accordingly, I can probably be of some assistance.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Are you wanting to change the system font? -User Wnats.
Are you wanting to know when the system font changes? - No. I know: At system setup.
Are you wanting a dialog's font to remain unchanged no matter what the system font is changed to? - Yeh.
I answered you questions directly.
|
|
|
|
|
vgrigor wrote:
Are you wanting a dialog's font to remain unchanged no matter what the system font is changed to? - Yeh.
This happens by default. When you right-click on the desktop and select Properties, and then go to the Appearance tab, you'll notice that there is no provisions for changing dialog box fonts. A dialog uses the font it was compiled with. This can be changed at run-time using the technique here.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
I now creating correction of this code,
to ActiveX and modeless and common use case.
But...
Dialog uses font that system defined by size.
|
|
|
|
|
Hi, I created a default SDI project and choosed container, I used RichEdit as the base class. Everything works ok.
But the problem is: if I insert any object into the document, when I exit from the program, it report and Assertion Error.
You can repeat the error easily:
1. Choose MFC exe from the wizzard
2. Choose SDI
3. choose none (no database)
4. choose containner and ActiveX document containner
..
in the end choose richedit view
compile and run
then insert any object into the document. Then exit. You will be able to find the "Assert Error"
Could any one help me?
|
|
|
|
|
I used your exact steps, and received no assertion error. If it was indeed an assertion, rather than an exception, you should have a file and line number. Yes?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Thanks for reply. You are right, I tried it again in another computer, it also works fine. So I think the VC in my work machine has problem.
Thanks again.
|
|
|
|
|
I created a project following your settings, except that I removed printing and print preview support from the application. Then I compiled it, ran it, and inserted a WordArt object from Word into the document content. Closed the application and answered 'No' to the question if I wanted to save the document. The application closed properly without any errors.
Could the error you specify be related to a certain, specific object ?
You should also look at the assertion error. These errors give a filename and line of the error where it is caused. Use the debugger to debug the code from this point forward, and you can see the ASSERT-statement that causes the assertion. Try posting this information and we can perhaps help you further.
However, I couldn't replicate your problem. You should check your code and more likely, your machine. Bugs in the ActiveX refer to the OLE support failing, thus leading to problems with COM. A reboot generally helps. As the Microsoft Word works precisely the same way as your default application, try posting your object there and then closing the program. If it asserts as well, the problem is with your computer, and not with the program.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
I copy the code project program on "All Topics, MFC / C++ >> Miscellaneous Controls >> Beginners>>Create your own control" On this program i face one problem is when I on class wizard add member variable on the variable type use CMyButton and then click OK after it will come out one message box that is say " Please ensure that "SubClassDemoDlg.h" contains the necessary #include directives for using your closs CMyButton (from file "MyButton.h"). The program still can work but I scared it can effect my program or not.
Thanks.
|
|
|
|
|
This is simply the Wizard warning you that you should include the header that defines CMyButton in the header of your dlg class as, if not, you will get errors caused by the compiler not being able to find the definition of CMyButton.
You have two options here:
1) Do as Class Wizard said and put the #include "MyButton.h" in the dlg header file (that's what I do)
2) put the #include into stdafx.h and it will be available to all the source files in your project. This could be a better move if that class is used a lot in different places.
If your program compiled without you using any of the options above it was because the definition of CMyButton was being included by some other header file used in the dlg class (but this could be just luck, don't rely on it, use one of the two options above)
HTH
|
|
|
|
|
Hi gurus!
I use CRecordSet to insert/read the data from the database.
I am inserting the file name into the database.
before I insert the file to the database I want to find out whether the file is already exit in the database. the files might have the different but they content of the files are the same. So I try to get each file name from the db and compare with the file about to insert.
I use the following code but the message box is displaying empty string eventhough the data are there in the db.
<br />
myRecordSet->m_pDatabase->ExecuteSQL("Select fileName from myTable");<br />
while(!myRecordSet->IsEOF())<br />
{<br />
MessageBox(myRecordSet->fileName);<br />
myRecordSet->MoveNext();<br />
}<br />
<br />
please point me out what/where am i doing wrong?
thanks
|
|
|
|
|
pnpfriend wrote:
myRecordSet->m_pDatabase->ExecuteSQL("Select fileName from myTable");<br />
while(!myRecordSet->IsEOF())<br />
{<br />
MessageBox(myRecordSet->fileName);<br />
myRecordSet->MoveNext();<br />
}<br />
The problem is that if you use a SQL statement to insert data into the recordset, it will not be visible until you requery it.
You can Close() and then Open() the recordset or else use Requery(). Please look into the help for the CRecordset class for more info (or just ask it here, if you have any more doubts )
|
|
|
|