|
Ok,
I know you must have thought abt it a lot,
i think i have a small perfect solution,
In your app when you click a button(you could copy text
from your app here)and go to the application(or an edit box in it)
you want to paste and click on it.
At this point you could find out the Process from it and Post a message
using PostThreadMessage
(ID_EDIT_COPY with a WM_COMMAND)
Let me know if it works...
|
|
|
|
|
I dot't understand to 100 % what you mean...
but do have to paste it to the clipboard and then post a message to Word or something to paste it??
Rickard Andersson@Suza Computing
ICQ#: 50302279 (Add me!)
E-mail: nikado@pc.nu
I'm from the winter country SWEDEN!
|
|
|
|
|
Yes, I mean you copy it to the clipboard and then
imitate the user action of Ctrl+V.
|
|
|
|
|
And if I send it to the window that has an edit or rich text box that is focused... will the clipboard text be pasted there then?
Rickard Andersson@Suza Computing
ICQ#: 50302279 (Add me!)
E-mail: nikado@pc.nu
I'm from the winter country SWEDEN!
|
|
|
|
|
I think it should, but as i told you
i have not tried it out, but you could imitate the
message sending.
|
|
|
|
|
Hey, I've been trying to make a function that replaces certain strings with other strings. I found an article on this site about it, and this is what I've been trying to us:
// instr is the string to search in
// oldstr is the string to search for
// newstr is the string to replace with
CString CMFC2Dlg::Replace(LPCTSTR instr, LPCTSTR oldstr, LPCTSTR newstr)
{
CString output(instr);
CString input_lower(instr);
CString oldone_lower(oldstr);
input_lower.MakeLower();
oldone_lower.MakeLower();
int pos=0;
while ( (pos=input_lower.Find(oldone_lower,pos))!=-1 )
{
input_lower.Delete( pos, lstrlen(oldstr) );
input_lower.Insert( pos, newstr );
output.Delete( pos, lstrlen(oldstr) );
output.Insert( pos, newstr );
}
return output;
}
The only problem is that when I use it, it gets stuck in an endless loop. Any ideas?
Thanks alot,
Emearg
|
|
|
|
|
At first sight, seems like you'd need to add lstrlen(newstr) to pos at the end of your while loop.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
|
This will definitely loop if oldstr is a subset of newstr. The suggestion of adding lstrlen(newstr) to pos should eliminate the problem. This prevents the .Find method from scanning the newstr text.
I ran this. It doesn't loop if newstr and oldstr are disjoint sets.
BTW: This kind of problem is extremely easy to solve if you step though the code. You will be a much more productive coder if you learn basic debugging techniques.
Good Luck,
Bill
|
|
|
|
|
I think it's case sensitive. Would've been nice if there was a CString::ReplaceNoCase() analog of CString::CompareNoCase() .
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
|
Insert a #define WINVER 0x500 prior to the inclusion of shlwapi.h . If this does not work, you might need to download a newer version of the platform SDK.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thanks. Where can i download the newest version of Platform SDK?
|
|
|
|
|
Follow the links from here.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I keep getting an "Automation server can't create obect." errors, and then no links appear...
|
|
|
|
|
Don't know. It worked OK for me. Keep trying, or use another machine (if you have it available.)
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
|
See the VC forum FAQ (Link at the top of the page)
--Mike--
Just released - RightClick-Encrypt - Adds fast & easy file encryption to Explorer
Like the Google toolbar? Then check out UltraBar, with more features & customizable search engines!
My really out-of-date homepage
Sonork - 100.10414 AcidHelm
|
|
|
|
|
i have a split window that i put a CFormView derived view into. How can I call this view's OnFilePrint function? I have a message map in this view:
BEGIN_MESSAGE_MAP(CDisplayPrintTemplate, CFormView)
ON_WM_ERASEBKGND()
ON_COMMAND(ID_PRINT_SELECTED,CFormView::OnFilePrint)
END_MESSAGE_MAP()
how can i send a message from CMainFrame to this view to print? I have tried the following, but nothing occurs. In the class itself i have a button that i press which has the ID_PRINT_SELECTED id, and it works fine..
CDisplayPrintTemplate* pForm = (CDisplayPrintTemplate*)m_wndSplitter.GetPane(1,0);
pForm->SendMessage(ID_PRINT_SELECTED);
i will continue to look for examples, if someone notices something small could you please help me out? thanks!
-dz
|
|
|
|
|
Seems like the message is not being properly routed. Are you handling by error this command somewhere else? (like for instance in your main frame window)
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I have changed my code to where i just call a member function - CDisplayPrintTemplate::ExternalPrint()
this in turn calls CFormView::OnFilePrint().. is there anything wrong with this? I know its a protected member, but i have tried the examples on message sending and i cant get any of my test functions to ever get called.. is it necessary to send a message or is a function call ok?
-dz
|
|
|
|
|
Have you tried Patrick's advice below? I think he's definitely pinpointed your error.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I have looked at the article, and tried the following:
CMainFrame
----------
#define WM_TESTING WM_APP + 0x100 // defined above IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
...
pForm->SendMessage(WM_TESTING,1,NULL);
CDisplayPrintTemplate
---------------------
#define WM_TESTING WM_APP + 0x100
..
BEGIN_MESSAGE_MAP(CDisplayPrintTemplate, CFormView)
ON_WM_ERASEBKGND()
ON_COMMAND(ID_PRINT_SELECTED,CFormView::OnFilePrint)
ON_COMMAND(WM_TESTING, TestMe)
END_MESSAGE_MAP()
..
void CDisplayPrintTemplate::TestMe()
{
AfxMessageBox("Testme");
CFormView::OnFilePrint();
}
the message never pops up.. i am just calling the function directly now.. im trying to figure out how to keep the print dialog from popping up.. thanks for all of your help
-dz
|
|
|
|
|
Well. Commands are not messages. Commands are IDs sent along the only message WM_COMMAND . Try the following:
pForm->SendMessage(WM_COMMAND,MAKEWORD(ID_PRINT_SELECTED,0),0); Hopefully, this will work. See the difference? The command ID it's stored in the wParam arg, not in the message parameter (which must be WM_COMMAND .)
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|