|
Hello,
I'm working on an application that uses the Scheduled Task APIs... I am unable to get the "detailed status" that appears in the GUI from anything in the API.
For example, let's say I've got a scheduled task that has a bad user/password.... in the Win2003 GUI, the "Status" column has the following:
"The scheduled task did not run because an incorrect password or user name was entered"
However, nothing in the API can get me this error code (0x8007052E)... I've tried:
ITask.GetStatus = returns 0x41300 (Which is "Task is scheduled")
ITask.GetWorkItemData = return a 0 for the length of the data (so there is no application specific data)
ITask.GetExitCode = return 0 because the last time it did run, it ran fine
What am I missing?
Visuall C++ 6.0 using Microsoft Platform SDK for Windows Server 2003 R2
on Windows XP Prof SP2
|
|
|
|
|
|
I used Win32 and MFC.
I try launch exe file with commands line. How to this?
example: "c:\dir1\form.exe cmd1"
thanks
|
|
|
|
|
Assuming you want to do this programmatically, you could use the
CreateProcess() API - check out the first two parameters.
There's more useful info at Michael Dunn's MFC FAQs[^]
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Does ShellExecute helpful?
|
|
|
|
|
Take a look at ShellExecuteEx() in MSDN.
(Hint: you need the _T("open") verb.)
|
|
|
|
|
hi
do u know how can i disable expansion of what i've collapsed to definition which automatically occurs when i wait remaining on the line? i need not it to expand and want it to remain in the definition and collapsed until i manually toggle outlining.
thx
|
|
|
|
|
When determining if the value stored in an object is less than that stored in another object we define the operator ‘<’; how it is defined is very important. But how do you define the operator for a class with multiple data items, so that you get the correct results?
For reasons that I am not going to go into, we do not care what data is stored or what its actual value is. We simply need to be able to determine whether one object is less than another for the purpose of adding it to an STL container that requires the information.
One solution is to just do a simple ‘memcmp()’ , which does work under normal usage of this particular class. The reason it works is because the ‘data_type’ is normally an integral type.
The problem is that the data type is unknown, as the class is a template and the type is supplied by the user. If the data type is a class that contains no memory pointers, the above solution will still work. But if the data type is a class that contains a memory pointer, such as a ‘std::string’, then the above solution is invalid because comparing data pointers is not the same as comparing the data pointed to.
For the purposes of comparison, every piece of data (data_, f1_,…, and id_) must be used. The ‘memcmp()’ method produces the correct results for integral types, but every other method I have tried fails. The results of the comparison must be the same as that produced by the ‘memcmp()’ method.
Note that “(data_ < rhs.data_ || f1_ < rhs.f1_ || f2_ < rhs.f2_ || f3_ < rhs.f3_ || id _ < rhs.id _) ” does not work, nor other variations on that theme.
Example class:
class this_class
{
data_type data_;
bool f1_, f2_, f3_;
int id_;
public:
…
bool operator<(const this_class& rhs) const
{ return( memcmp(this,&rhs,sizeof(class)) < 0 ); }
};
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
try also sizof .
But, of course, you can't know the size of objects related to the class through pointers.
There isn't a solution, ... or, if you want, the solution is do not implement this operator, because it can't work correcty (as you tell) everytime.
Russell
|
|
|
|
|
Try the following:
data_<rhs.data_ ||<br>
(data_==rhs.data_ && f1_<rhs.f1_) ||<br>
(data_==rhs.data_ && f1_==rhs.f1 && f2_<rhs.f2_) ||<br>
(data_==rhs.data_ && f1_==rhs.f1 && f2_==rhs.f2_ && f3_<rhs.f3_) ||<br>
(data_==rhs.data_ && f1_==rhs.f1 && f2_==rhs.f2_ && f3_==rhs.f3_ && id_<rhs.id_)
Steve
|
|
|
|
|
Thanks, I was afraid something like that would be required. It works in debug mode, as it should, but fails in some cases in the release version; I need to look into why that is. Since the “operator<” may get called thousands of times in some cases I may make it a compile time option and stick to the “memcmp()” solution, as I suspect the call is cheaper than all those tests. I’ll need to run some tests to be sure.
I see no reason why anyone would use anything but built in data types in this class, but I would still like to leave the option open.
Thanks again.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
You could get the best of both worlds using something like Boost[^]'s TypeTraits[^] library. See this[^] example for an example of something similar (although not exactly what you want).
Steve
|
|
|
|
|
Thanks, I decided to go with the current solution (memcmp) and restrict the usage to integral types as per my original specifications. I tend to let my imagination run wild at times and was trying to add flexibility that even I would never use.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
I've been known to fall into that trap myself.
Steve
|
|
|
|
|
i've looked thru the official guid, very brief though...
|
|
|
|
|
Does this a c++ question ?
|
|
|
|
|
Hi every1, I need help related to image recognition using Genetic Algorithm.(GA)
Would greatly appreciate if anyone can send me any related information eg source code or notes that I can read or used as I am quite confused by the GA implementation in C++.
How an image is recognize/identified using GA?
Simple comparison like character recogntion, Neural network can performed task by training to identified the character, do GA able to perform similar task?
Can email to ray_luee@yahoo.com
Thanks
RayLuee
|
|
|
|
|
I have decided to bite the bullet and find out how to convince MFC that passing parameters to implement IMPLEMENT_DYNCREATE is feasible.
In a nutshell - IMPLEMENT_DYNCREATE access only the default constructor which has no parameters. Tiring to hack the RUNTIME_CLASS and the whole chain down to creation of the object is a nightmare.
The basic for this is that I have a need / want to use same view class with different "parameter". I am basically tired of building a copy of the view class and modifying its methods as required.
There are few articles in here which accomplish this using various approaches - RTTI, "Generic Class Factory" (no longer supported by the author) etc.
I am asking the forum to share experiences with these approaches.
Recommendations, comments etc.
Thanks for your help.
Vaclav
|
|
|
|
|
Hello all. So I have these three combo boxes. According to certain validations, I have to select one of them. I thought that simply calling CComboBox::SetFocus would be enough, yet it is not working. I also tried sending a WM_ACTIVATE messages to the combos, with the same results.
Any thoughts would be really appreciated. Thanks in advance.
FG.
Hope is the negation of reality - Raistlin Majere
|
|
|
|
|
From where you call this?
- NS -
|
|
|
|
|
From the CDialog::OnInitDialog method.
Hope is the negation of reality - Raistlin Majere
|
|
|
|
|
You should retun FALSE from OnInitDialog, if you explicitly set the focus. And use GotoDlgCtrl instead of SetFocus in Dialogs.
- NS -
|
|
|
|
|
I feel a little stupid now. I don't use wizads, but now that you mentioned it, I remebered this "return TRUE unless you're setting the focus" comment that the wizards places in the "return" of the OnInitDialog .
Thanks a lot!
Hope is the negation of reality - Raistlin Majere
|
|
|
|
|
This[^] article may interest you.
Steve
|
|
|
|
|
Thanks, very interesting indeed.
Hope is the negation of reality - Raistlin Majere
|
|
|
|