|
What you are trying to achieve is can easily be done in this way. My project is running fine.
Basically in your interface class you have to derive the classes in this manner.
class MyPPTApplication : public TOleHelper
{
// Operations
public:
LPDISPATCH GetPresentations();
}
This is just a hint how in my project I have achieved this for PPT.
In this way you have to get all the methods for Word, call the method in proper order & you will get the required result. GetPresentations does nothing it internally call this method
LPDISPATCH result = 0;
InvokeHelper(0x7d1, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&result, NULL);
I do not know what is the use of you Dll, if it is to show the Word application then you have to create your own container object that is a whole big area in it's respect.
|
|
|
|
|
Hi,
Thanks for the reply. The purpose of my DLL is to wrap the code that you have suggested so that I dont have to do this in my applications. Besides which, the msword9.h documentation is so sparse, I find it can take quite a while to figure out what objects i need, what methods to call and what the parameters mean.
For example, to insert a table into a document, you need need to get all kinds of objects (app, document, selection, range, table) and I dont want to have to do this each time I want to insert a table so I have a InserTable(rows, columns) method.
I guess I could still do what you proposed when I want to do the lesser used objects/methods, I could call them with InvokeHelper.
Thanks
Tony
|
|
|
|
|
Hi all,
How to unselect the selected text in the rich edit control when clicked on selected text?
Manjunath S
GESL
Bangalore
|
|
|
|
|
What you are asking for is actually the default bahaviour.
|
|
|
|
|
I have used the CRicheEditView. I am selcting the character in the editor. When i clcik on the selected character it getting deselected and cursor is moving into begining of the charcter. How to avoid his deselction and movement of cursor?
Raghu
|
|
|
|
|
I have a button on a list, something like whenever you select a row, move the button to that row. So I implement this in OnLvnItemchangedList event:
void CMyDlg::OnLvnItemchangedList(NMHDR *pNMHDR, LRESULT *pResult)
{
...
CRect rec;
...
m_myBtn.MoveWindow(rec);
m_myBtn.ShowWindow(SW_SHOW);
m_myBtn.BringWindowToTop();
InvalidateRect(rec);
m_myBtn.RedrawWindow();
}
It works, but I cannot see the button.
If the mouse moves over the button, it shows then I can see it.
I don't know why, maybe there's something wrong in my last two source code rows. Can anyone explain how to solve this??
Thank you in advance !!
|
|
|
|
|
Check the coordinates of the button and you will see why you dont see it
Greetings from Germany
|
|
|
|
|
hi KarstendK,
I don't understand what you mean. When I move the mouse over the button, it shows.
|
|
|
|
|
i downloaded a source code named mpeg2dec, but when i began to compile it i got such an error.
I am not sure why it occurred. The original project is a vc6 project. I use vc2005. So, who recognize this error and how to resolve it?
The original error is:
1>c:\program files\microsoft visual studio 8\vc\include\stdlib.h(592) : error C2485: '__restrict' : unrecognized extended attribute
Does it because VC2005 not support __restrict keyword?
Thanks
modified on Friday, July 25, 2008 2:01 AM
|
|
|
|
|
I would expect it to be the other way around, VS2005 to recognize __restrict and VC6 not to if anything.
Check that your source isn't intended to be compiled with GCC/glibc which makes extensive use of __restrict. As the error is showing in stdlib.h a standard header file I'm guessing something you've included before stdlib.h has messed with the Compiler by doing something like a #define __declspec or a #define restrict. I've only ever seen that sort of thing when someone is attempting to get cross compatibility with GCC. It's just a guess though, could be something else entirely.
"The secret of happiness is freedom, and the secret of freedom, courage."
Thucydides (B.C. 460-400)
|
|
|
|
|
ok. when i delete the line : #define restrict __restrict
all is ok.
thanks
|
|
|
|
|
That would do it
"The secret of happiness is freedom, and the secret of freedom, courage."
Thucydides (B.C. 460-400)
|
|
|
|
|
Hi all,
I want to overload a function to do a simple processing. Only one argument is used in two cases, std::string variable and std::wstring variable. I want to try out it without overloading.
Took a tour in Google and I feel that there is a way to do using templates. I never work on with those. Can you guys give me a help. I just want to do a simple test. If I'm correct templates is a long section to completed.
Your help really valued to me.
Thanks
I appreciate your help all the time...
CodingLover
|
|
|
|
|
template<typename stringtype="">
void foo(StringType str)
{
// Do processing here.
}
string str;
wstring wstr;
foo(str);
foo(wstr);
-Saurabh
|
|
|
|
|
Thanks for the quick replay.
I found that in most of documents templates are define as follows.
template <class t=""></class>
So, what's the different with your answer and this?
By the way, can't I pass values by reference. I tried it and working fine. But give a warning there.
<br />
see reference to function template instantiation 'int <br />
GetString<std::string xmlns:std="#unknown">(T &)' being compiled<br />
<br />
with<br />
[<br />
T=std::string<br />
]<br />
</std::string>
I appreciate your help all the time...
CodingLover
|
|
|
|
|
sorry forgot to include code tags in the post...correct code is
template<typename StringType><br />
void foo(StringType str)<br />
{<br />
}<br />
<br />
string str;<br />
wstring wstr;<br />
<br />
foo(str);<br />
foo(wstr);
you can pass by reference, use this code.
template<typename StringType><br />
void foo(StringType& str)<br />
{<br />
}
-Saurabh
|
|
|
|
|
It's ok, I got it. How about the second part. Pass value by reference?
I appreciate your help all the time...
CodingLover
|
|
|
|
|
this isnt templating but another method
void MagicStringFunc(char* format,...)
{
va_list args;
va_start(args,format);
string MyString;
wstring MyWideStr;
if(*format == '%')
switch(*++format)
{
case 'w':
case 'W':
MyWideStr+= va_arg(args,wstring);
break;
case 's':
case 'S':
MyString+= va_arg(args,string);
break;
}
va_end(args);
}
you get the basic idea so you can send format strings like printf kinda IE "%s"for string or for widestring in this case "%w"
int main()
{
MagicStringFunc("%s","TEST STRING");
MagicStringFunc("%w",L"TEST WIDESTING");
}
it might be overkill for this situation but can be handy if you a dealing with different languages etc where you need to handle a few options with the same function.
it is also easier to build upon this function if you want to handle an unknown number of params and you can even mix the types up sweet as
modified on Friday, July 25, 2008 7:29 AM
|
|
|
|
|
Hi all,
Please anyone can tell me how can i stop enter special cahracters (@,#,$,%,^,&,*,~,!) in Editbox.
Thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
You can perform it in three ways.
One is override PreTranslateMessage.
Another one is to subclass your Editbox.
Also there is another one derive your custom editbox from CEditBox, on WM_CHAR message you can disbale special character.
|
|
|
|
|
Subclass CEdit and override subclass OnPreTranslate(). you can also do it with the EN_CHANGE event in your dialog class but that would require some logic of storing the string, comparing it with the previous one, finding if the new character is the one which you DON'T want etc etc.
Hope it helps.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Can you show any example of this.
Thanks.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
Hi,
there is an excellent Codeproject article called CFilterEdit: Use Regular Expressions to filter your input by Ben Hanson. This can serve you well as a base clase for your problem.
http://www.codeproject.com/KB/edit/FilterEdit.aspx[^]
There are already some sample derived classes like
* CCurrencyEdit
* CDateTimeEdit
* CFloatEdit
* CIntEdit
* CUIntEdit
* CUIntRangeEdit
* CSpin
So long,
Stefan
|
|
|
|
|
Hi all;
i m using this on PreTranslateMessage(MSG* pMsg)
if (pMsg->message == WM_KEYDOWN && (pMsg->wParam == VK_RETURN))
{
UINT CtrlID = ::GetDlgCtrlID( pMsg->hwnd );
// Check whether its that of your button.
if( CtrlID != IDOK &&
CtrlID != IDCANCEL && )
{
pMsg->wParam = VK_TAB;
}
}
for using both on Tab key and enter key on controls execpt button controls.
Now on presssing Tab key the button is clicked.
I dont want to press button on Tab key.
Please tell me what can i do?
I m waiting for ur valuable suggestions.
Thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
modified on Friday, July 25, 2008 1:17 AM
|
|
|
|
|
The simple solution just remove the tab stop style from button controls.
modified on Friday, July 25, 2008 2:19 AM
|
|
|
|