|
I'm trying to build a utility that runs a few console commands and directs the output to an edit control.
i.e. Click a button, it copies some files, and the output of the xcopy command shows up in an edit control.
Another desired result (for an entirely different project down the road) - is to be able to interact with the console application. (end user can give input as needed to the application)
It seems like a fairly easy thing to accomplish (fingers crossed), but I'm having a hard time finding sample source code to work from.
Can you point me in the right direction?
===
The workflow that I'm trying to implement is as follows:
1. Copy files from e:\tiff to c:\clients\$customer name$\tiff
2. Convert images from tiff to jpg (I can do this via command line, requires command line parameters - meaning c:\convert.exe /s:conversiontemplate.txt )
3. Create thumbnail size images (also via command line)
4. Create html for web photo album
5. Copy other files to directory for CD-ROM (autorun.inf, drive.ico, etc.)
6. Upload html docs, images to web server. (using dundas tcp-ip)
I want to put these commands in an MFC app so that my receptionist can just click a button and have all the magic happen. I want the output in an edit control so that if there is a problem, the receptionist can copy/paste the output into an email and have me troubleshoot the process.
(Maybe even have a send-to-steve button that handles that part)
===
|
|
|
|
|
skallestad wrote:
...and the output of the xcopy command shows up in an edit control.
Take a look at the MSDN article Q190351, and the one titled "Creating a Child Process with Redirected Input and Output."
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Thank you. That is the perfect starting point for me!
|
|
|
|
|
hi,
i want to disable the possibility to change the label of an item of a CTreeCtrl. SetReadOnly() namely makes it possible that the user can't edit the item's label, but the edit control box is still displayed and that shouldn't happen.
Any ideas ?
Thanks in advance!
|
|
|
|
|
I got it. Maybe someone is interested in how i did it, so here is the solution. If the message TVN_BEGINLABELEDIT is send, i dispatch the follwoing notification: SendMessage(TVM_ENDEDITLABELNOW, (WPARAM) (BOOL) TRUE, 0);
Looks simple, isn't it?!
|
|
|
|
|
Handle TVN_BEGINLABELEDIT , returning TRUE to prevent editing.
|
|
|
|
|
|
What is the simplest way to kill an MFC dialog based application?
|
|
|
|
|
alt+F4 works pretty well.
*.*
cin >> knowledge;
|
|
|
|
|
Find the handle of the window (FindWindow or EnumWindows work well), then send it a WM_CLOSE message.
If this causes it to ask to save data, and you don't want that, use DestroyWindow instead, although this is very brutal.
|
|
|
|
|
|
I am having a problem using the CEdit class and the CRgn class. I am using the CRgn to make a roundedrect and then setting the region to the CEdit control during PreSubClassWindow ( I am actually trying to make a class that is derived from CEdit that is a rounded edit control ). However it seems that the region is only having an effect on the border of the CEdit. The white part ( the part you type in ) is still a rectangle. Any Ideas why this is happening?
|
|
|
|
|
Friends,
I have a vector of pointers:
vector< PhoneRecord*> phonerecs(MAX);
I want to pass this vector to a function so I can add things to it outside of main().
The function declartion is:
void addPhoneRecord(PhoneRecord* records[]);
and call it from main() using something like:
addPhoneRecord(phonerecs);
The error I'm getting is:
error C2664: 'addPhoneRecord' : cannot convert parameter 1 from 'class std::vector<class PhoneRecord *,class std::allocator<class PhoneRecord *> >' to 'class PhoneRecord *[]'
I understand I'm not passing this correctly...
I'm sure this is a somewhat easy solution, but I can't seem to pinpoint it.
Thanks in advance!
|
|
|
|
|
|
Dave, thanks again for your quick and informative reply.
Allow me to include better code representation:
My function definition is:
void addPhoneRecord(string& name, string& address, string& phone, PhoneRecord* records[])<br />
{<br />
Name* nameEntry = new Name();<br />
nameEntry->set_name(name);<br />
Address* addressEntry = new Address();<br />
addressEntry->set_address(address);<br />
PhoneRecord* phoneEntry = new PhoneRecord(nameEntry, addressEntry);<br />
phoneEntry->set_phoneNumber(phone);<br />
<br />
records.push_back(phoneEntry);<br />
}
When I call it from main I'm using:
addPhoneRecord(name, address, phone, &phonerecs.back());
All of the setting functions and the like work like they should, and properly.
The error I'm getting is:
error C2228: left of '.push_back' must have class/struct/union type
If I comment out the records.push_back(phoneEntry); it compiles fine, but I get the standard WinXP error report problem.
Any suggestions?
Thanks again.
|
|
|
|
|
Since you are actually trying to use the vector as a vector (instead of just an array as you indicated in your previous message), you should pass a reference to the vector into the function. The last parameter should be: vector< PhoneRecord*>& records - then you will be able to use the push_back member.
Dave
http://www.cloudsofheaven.org
|
|
|
|
|
Dave,
Thank you again. You're a master.
|
|
|
|
|
My program uses API calls and now that I have converted my program from a simple console app to a windows service, I cannot use all of the same API calls. If anybody is familiar with this type of problem, please fill me in with possible fixes. Thanks!
|
|
|
|
|
A little more information would be useful here...
What do you mean when you say that you cannot use all the same API calls? Is it not compiling? Or not running? If it isn't running, what error is produced? What APIs aren't working?
Dave
http://www.cloudsofheaven.org
|
|
|
|
|
services start before a lot of the system has initialised and they have no logged on user generally
there is a bunch of info about what u can and cant do on ms
what exactly are u trying to do?
"there is no spoon" biz stuff about me
|
|
|
|
|
I need to use CWnd::FindWindow to find out if the game "Freelancer" is running. If I use NULL as the first parameter and "Freelancer" as the second, it also finds windows explorer windows that are in a "Freelancer" directory. Therefore, I need to also specify the classname in the first parameter. The problem is, how do I determine Freelancer's classname? I tried GetWindowInfo, but that returned an ATOM number that varies; not good!
|
|
|
|
|
Spy++ will tell you. It's the string after the string in quotes (which is the window title). For example, this window I'm typing into is called "The Code Project- Free Source Code and Tutorials - Microsoft Internet Explorer" and is of the class named "IEFrame".
Alternatively, try GetClassName .
|
|
|
|
|
Friends,
I'm trying to create a function so I can print the conents of a STL list from main(). It looks like:
<br />
void TraverseAndDisplay(list< PhoneRecord>::iterator& itor, const list< PhoneRecord>& l) <br />
{ <br />
while (itor != l.end()) <br />
{ <br />
cout << *itor++ << " "; <br />
} <br />
cout << endl; <br />
}
Unfortunately, because PhoneRecord is not a primitive data type (it's my own class), the default operator != won't work.
The exact error I'm getting is:
error C2679: binary '!=' : no operator defined which takes a right-hand operand of type 'class std::list<class PhoneRecord,class std::allocator<class PhoneRecord> >::const_iterator' (or there is no acceptable conversion)
Obviously I need to overload the != to work. I don't know how to overload the != operator to work for iterators in this case?
Thanks in advance for your help!
|
|
|
|
|
Can you please repost the code, using < and > for the angle brackets so that we can see the template parameters?
Dave
http://www.cloudsofheaven.org
|
|
|
|
|
Sorry about that. It's reposted. Ignore the space after the < and before PhoneRecord.. it was making it a smiley.
|
|
|
|