|
The name of the application isn't always guaranteed to be in the window title. Would it work better for you (what are you trying to do?) to get a list of EXE names such as outlook.exe?
Todd Smith
|
|
|
|
|
Use EnumProcesses. There is an article on how to do this in the MSDN online help. Search for Enumerating All Processes.
Cheers,
Tom Archer
Author - Inside C#, Visual C++.NET Bible
A total abstainer is one who abstains from everything but abstention, and especially from inactivity in the af
|
|
|
|
|
See this article.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Quick Question,
Anyone have a *good* way of blocking a UI thread until a child-process finishes executing?
Whats commonly used?
ps: This weather sucks.
|
|
|
|
|
WaitForSingleObject(hProcess, INFINITE); might be what you want.
|
|
|
|
|
If you mean completely block the UI thread, then just do a WaitForSingleObject(...,INFINITE) on the child process handle.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
If you said Pause the Thread...
If that is your question, you need to Use SuspendThread and ResumeThread functions...;)
Regards...
Carlos Antollini.
www.wanakostudios.com
Sonork ID 100.10529 cantollini
|
|
|
|
|
That worked, thanks guys...
|
|
|
|
|
Is it possible to create a CMap which maps CStrings vs. ints? that is
CMap <cstring, cstring&,="" int,="" int&=""> map;
I switched around the keys, and it works. I thought you can map just about anything against anything. Any ideas?
c:\program files\microsoft visual studio\vc98\mfc\include\afxtempl.h(129) : error C2440: 'type cast' : cannot convert from 'class CString' to 'unsigned long'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
c:\program files\microsoft visual studio\vc98\mfc\include\afxtempl.h(1324) : see reference to function template instantiation 'unsigned int __stdcall HashKey(class CString &)' being compiled
|
|
|
|
|
You got to overload the template function HashKey to work for CString s. Here's an example extracted from http://www.codeguru.com/cpp_mfc/excoll.shtml:
template<> inline UINT AFXAPI HashKey (CString& strKey)
{
LPCSTR key = strKey;
UINT nHash = 0;
while (*key)
nHash = (nHash<<5) + nHash + *key++;
return nHash;
}
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
yes, you can do this, but you have to provide the hash function.
see:
Q158541
PRB: C2440 Error When Using CMap and User Defined Key Type
or... use std::map . it's better and will gain you STL-credibility among your fellow programmers.
-c
There ain't no second chance
Against the thing with the forty eyes, girl
|
|
|
|
|
MFC containers suck. Use std::map and you won't have any trouble.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
|
|
|
|
|
Could you be more specific please?
Is it that they are not fast enough?
Best regards,
Alexandru Savescu
|
|
|
|
|
No support for algorithms, no easy compatibility with other containers, not standard, written only as a stopgap prior to STL, never intended to replace it.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
|
|
|
|
|
Can someone share a sample of code that deletes a file when the path is known. Thanks for any help.
Kyle
|
|
|
|
|
I'm surprised you didn't find DeleteFile yourself.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Me too! Being new to C++ I searched for "delete file" on this site and when I didn't find a clear answer I asked the silly question. I should have tried the on-line help first. Please accept my apology.
Kyle
|
|
|
|
|
Excuse my being too ironic. You don't have to apologize for anything at all, this is a free forum Regards.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Joaquin, you are very hard with that Guy...
He only wants to knows how to use the DeleteFile function...
if(DeleteFile("C:\\MyPath\\File.tmp"))
AfxMessageBox("The file was deleted...");
Best Regards
Carlos Antollini.
www.wanakostudios.com
Sonork ID 100.10529 cantollini
|
|
|
|
|
Hello
I want to put a paragraph of text into a char buffer, but I am not allowed to wrap the text onto a new line. Does anyone know how I can over come this
char buf[2000] = "text text text text text
text text text text text
text text text text text text text";
error C2001: newline in constant
error C2146: syntax error : missing ';' before identifier 'text'
error C2065: 'text' : undeclared identifier
error C2146: syntax error : missing ';' before identifier 'text'
...
|
|
|
|
|
char buf[2000] = "text text text text text "
"text text text text text "
"text text text text text text text";
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
You should be able to do this:
char buf[2000] = "text text text text\
text text text text\
text text text";
No generalization is 100% true.
Not even this one.
|
|
|
|
|
If all you want to do is wrap your source file to keep everything nice and tidy, the answer has already been posted.
If you want to embed line breaks in your text, just replace each newline with the character sequence '\n', as in:
char buf[2000] = "text text text text text \n"
"text text text text text \n"
"text text text text text text text";
--------
I don't think that I'm a sell-out but I do "Enjoy Coke!"... -- Bloodhound Gang, The Inevitable Return Of The Great White Dope
|
|
|
|
|
In my Doc I have this:
struct ItemInfo
{
CString name;
CString catagory;
CString description;
}itemInfo;
Then in my View I have this:
CMyDoc* pDoc = GetDocument();
<br>
CString itemName = GetItemName();
<br>
pDoc->itemInfo.name = itemName;
But the program aborts when it reaches the last line of code, why?
-Raffi
|
|
|
|
|
Excuse me if I'm pointing the obvious, but have you checked that pDoc is !=NULL ? Apart from this, the way you're accessing itemInfo seems OK to me.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|