|
Hi folks....
How do we switch the focus to another application using its filename in VC++???
heeellllpppp
Pooja
|
|
|
|
|
HWND hwnd = ::FindWindow(NULL,"Program name");
::PostMessage(hwnd,WM_SETFOCUS,0,0);
This should do it.
~Michael
|
|
|
|
|
Hey thanx...
this code works better:
CWnd *pWnd = FindWindow(NULL,”My Application”);
pWnd->SetForegroundWindow();
|
|
|
|
|
Hi all
I wrote a big MFC app wich uses MSXML.
I use it in this way:
MSXML2::IXMLDOMDocumentPtr pDoc(CLSID_DOMDocument)
pDoc->...
...
Few days ago I've installed MSXML 4.0.
Do I have to change my code in order to use the new version? to something like this:
MSXML2::IXMLDOMDocument2Ptr pDoc(CLSID_DOMDocument40)
Or my previouse code will be fine and use the new MSMXL objects?
thanks a lot!
|
|
|
|
|
Anonymous wrote:
Or my previouse code will be fine and use the new MSMXL objects?
Your current code should continue to work (providing Microsoft followed it's own rules on not changing interfaces in COM objects).
COM objects are designed to be backwards compatabile. The only reason you might need to change your CLSID or IID's is if you want to use newer functionality.
Michael
But you know when the truth is told,
That you can get what you want or you can just get old,
Your're going to kick off before you even get halfway through.
When will you realise... Vienna waits for you? - "The Stranger," Billy Joel
|
|
|
|
|
Ok, I understand that, but there are some fixes and performance improvments between the versions. Same Interface will have a better implementation in MSXML 4 then in previous versions, or maybe I'm wrong?
My question is: if I'll leave the code as its now, will it work in the best way and provide the best performance MSXML can provide?
thanks.
|
|
|
|
|
Over time, as I download various bits from the Internet, things tend to get widely distributed on my hard drives. In this particular instance, image files are all over the place, in download folders, in Administrator and User folders - it's a mess. I'd like to create a utility that allows me to enter a file descriptor - a regex might be a good way to do this - and a destination folder, then traverse the entire set of drives and their contained folders to send copies of matching files to the destination folder. Ideally the program would also detect version numbers or last modified dates and only copy the most current versions. What's got me stumped a bit is how to organize the search.
Should I enumerate the top level folders and process them first, then move down a layer and repeat, or should I follow a directory chain to its end before processing the next top level folder? What is a good data structure for keeping track of where I am in the process, and which folders have already been processed? In some ways, the process reminds me of the challenge of traversing rule bases in Prolog, without the cuts, and I never progressed far enough in that language to really get into the implementation details. While I'm at it, will Hidden and System folders be invisible to the process, or does that only apply to displays in Explorer?
Thanks for any suggestions... This might make for a decent Beginner article when it's completed, and I'll be sure to mention any who helped along the way.
Heard in Bullhead City - "You haven't lost your girl - you've just lost your turn..." [sigh] So true...
|
|
|
|
|
Roger Wright wrote:
Should I enumerate the top level folders and process them first, then move down a layer and repeat, or should I follow a directory chain to its end before processing the next top level folder?
I don't think it will make any difference, to the outcome, if you do it right.
Regardz
Colin J Davies
* WARNING * This could be addictive The minion's version of "Catch "
It's a real shame that people as stupid as you can work out how to use a computer. said by Christian Graus in the Soapbox
|
|
|
|
|
Directory searches are typically done using a recursive routine and going depth first. Using this approach you don't need to keep track of where you've been. You can get into a mess if you are moving files around etc. under the feet of code that is iterating files. It can be easier and certainly safer to use two passes, one to build the list of files that need to be moved (or whatever) and a second to do the work.
Neville Franks, Author of ED for Windows www.getsoft.com and coming soon: Surfulater www.surfulater.com
|
|
|
|
|
Good thought, and similar to the approach I was discussing with Colin in the wee hours this morning. But then it occurred to me (apparently in my sleep I was still working on it) this morning that the app could get really confused if some process made a change to the file structure after the first pass. That's probably a small risk, though. It might be entertaining and instructive to populate a tree control on the first pass and display it, then expand each node as it is being processed, changing colors or something to indicate completion. It certainly will be a good exercise for my edification!
Heard in Bullhead City - "You haven't lost your girl - you've just lost your turn..." [sigh] So true...
|
|
|
|
|
I'm using code like the following to Post some information and instead of using new and delete I'd like to use a smart pointer so I don't need to manually do the delete. I've read over the Boost smart pointer library but can't really see if this is possible. I do use boost scoped_ptr<> to good effect.
CMyClass::MyFunc()
{
CMyClass* pMyClass = new CMyClass;
PostMessage( WM_USER_MYMSG, reinterpret_cast<WPARAM>( pMyClass ), 0 );
}
LRESULT CMainFrame::OnUser_MyMsg( WPARAM wParam, LPARAM lParam )
{
CMyClass* pMyClass= reinterpret_cast<CMyClass*>( wParam );
delete pMyClass;
}
Neville Franks, Author of ED for Windows www.getsoft.com and coming soon: Surfulater www.surfulater.com
|
|
|
|
|
Well, you can modify the receiving code like this:
LRESULT CMainFrame::OnUser_MyMsg( WPARAM wParam, LPARAM lParam )
{
boost::scoped_ptr<CMyClass> pMyClass(reinterpret_cast<CMyClass*>(wParam));
}
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi Joaquín,
Thanks for the reply. I assume you mean by changing the new to use a boost smart ptr. If so which one, shared_ptr?
Neville Franks, Author of ED for Windows www.getsoft.com and coming soon: Surfulater www.surfulater.com
|
|
|
|
|
I know I can launch an HTML page with IE by using ShellExecute. But how do you create a popup window that doesn't have toolbars, status bar, etc.? Much like window.open in javascript.
|
|
|
|
|
|
When I load a xfdf file into the control it stops responding. This is strange since acrobat reader.exe loads xfdf's without a hitch. Anyone have a solution or ran into this before?
|
|
|
|
|
I don't understand... are you trying to implement the OCX on your application? Or is it that your getting an error with Adobe Acrobat Reader.. you should ask them, but if you mean like using it in your own application... I think you need a license for it and there is a lot of security built into it, probably the Adobe style anyways, you should ask them for more info.
Actual Linux Penguins were harmed in the creation of this message.
|
|
|
|
|
Very simple. Just drop the activex control from adobe acrobat reader into a form. When the src property is set to the path of an xfdf file the control hangs. Note that xfdf files are fully supported in the (free) adobe acrobat reader.exe.
|
|
|
|
|
I have a long CString that I am displaying in a multi-line edit box control using m_EditBoxVarName.SetWindowText("string");
Works great except that the line breaks (which I have as \n) show up as squirrely little vertical lines.
How do you format a CString so that the Edit Box will display:
This is the first line!
This is the second line!
instead of:
This is the first line!|This is the second line!
|
|
|
|
|
I forgot myself but I think its something like \n\t or something like that... Can anyone else help? I don't have alot of time to look into this problem since I am programming with DX and forgot some MFC.
Actual Linux Penguins were harmed in the creation of this message.
|
|
|
|
|
I got it - thanks. It is \r\n I forgot about PCs needing that extra character.
|
|
|
|
|
As an FYI if you use the richedit control you won't run into this. It can handle \n, \r, or \n\r without a problem. It's only the simple edit control that is this brain dead.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
|
|
|
|
|
Is there a (shortcut) way to convert a numeric to a character? For example, a numeric 9 to a character "9", or a numeric 365 to a character "365".
Neither 'static_cast', 'reinterpret_cast', nor '(char)' does it, and it doesn't matter if the number is signed or unsigned, no cast seems to do it.
Thanks for any insight.
William
Fortes in fide et opere!
|
|
|
|
|
_itoa(), _ltoa(), _ultoa() or simply sprintf()
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Thanks for replying.
itoa() did it!!
I appreciate the help.
William
Fortes in fide et opere!
|
|
|
|