|
Hello,
I created a job for task scheduler but I didnt set the password, so the job will never be executed.
From I app I executed the job. The ciode is as follows:
code:--------------------------------------------------------------------------------
ITask *task;
hr = m_pITS->Activate( wjobname,
IID_ITask,
(IUnknown**) &task);
if ( FAILED ( hr ) )
return;
hr = task->Run();
if ( hr != S_OK ) {
MessageBox( m_Hwnd, "Could not execute job.", MAIN_APPNAME, MB_ICONERROR | MB_OK );
} else {
MessageBox( m_Hwnd, "Job executed successfully.", MAIN_APPNAME, MB_ICONINFORMATION | MB_OK );
}
task->Release();
--------------------------------------------------------------------------------
The problem is whether the job was executed or not (it is not executed coz I didnt give the user password) the function is always returning S_OK. So whatever may be the result I am getting the messagebox "job executed successfully".
Is it normal?
Karam
|
|
|
|
|
If you look in MSDN, you'll see:
"A return code of S_OK means that the request to run the work item has been made; it does not mean that the work item has started running. There may be a delay of a few seconds after Run returns before the work item actually starts running.
To determine whether the work item is running, call IScheduledWorkItem::GetStatus."
So, you're good checking that it was scheduled, you need to go further:
hr = task->Run();
if (SUCCEDED(hr))
{
HRESULT status;
BOOL started = FALSE;
while (TRUE)
{
::Sleep(250);
hr = task->GetStatus(&status);
if (FAILED(hr)) break;
if (SCHED_S_TASK_RUNNING == status)
{
started = TRUE;
break;
}
else if (SCHED_S_TASK_READY == status)
continue;
else
break;
}
if (started)
{
MessageBox(m_hWnd, "Job is running", ...);
}
else
{
MessageBox(m_hWnd, "Could not execute job", ...);
}
}
else
{
MessageBox(m_hWnd, "Could not start job", ...);
}
task->Release();
|
|
|
|
|
Thank you.
That is exactly what i require
If I face any problem I will come back.
|
|
|
|
|
Hi all,
Does anybody know why my drop down list won't drop down?
I've added items to it in the OnInitDialog overide (which calls the same CDialog function beforehand btw) and i can scroll through them using the keyboard. However, when I click the drop down button, the list doesn't appear - just a very small no. of horizontal lines appear below the text display window.
Can anybody help?
Thanks
Paul
|
|
|
|
|
I just had a brain-wave, and it worked.
The reason this was occuring was because when I created the control in the dialog editor, i only specified a control height which was that of the actual window for the combo box. I did not anticipate that windows would limit the actual drop down list to this space!!
It's silly things like this that hinder application development .. Live and learn i guess
|
|
|
|
|
Yup I experienced the same problem before..
weird huh...
|
|
|
|
|
Hi, please help mi with this problem. When compile my project it compiles all cpp files (not only changed one). When pressing F5 it wants to build it all and writes that obj files are not up to date or does not exist. This is happening over and over again even if i dont make any change to code. Do u have any suggestion why this is happening? - it happend accidentaly (i quess) after 3 months workings with the project ... Thanks
|
|
|
|
|
You could try loading up the workspace/solution, then doing a complete rebuild. Then close the workspace/solution, and close the IDE. Then restart, and reopen the IDE. This might fix the problem.
The actual problem persists in the project database. On a MS VC++ 6.0 platform, deleting the project database file might resolve the issue.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
|
Thank u very much. It worked..
|
|
|
|
|
Hello everyone. I want to draw edges for an Edit box. But I have to draw the lines inside the Edit box, because the edit box is too big. I tried to change the size of the Edit box, but I cannot make the height any smaller. The problem is that the line in the Edit box will be blocked by the Edit box. I tried to set the edit box to transparent, but I still cannot the lines.
Any idea about how to fix this problem?
Thanks a lot in advance.
Bin
|
|
|
|
|
Derive a class from CEditBox, handle OnDraw Event and now the whole Editbox control window is all urs to draw what ever you want to.
MSN Messenger.
prakashnadar@msn.com
|
|
|
|
|
Hi All,
Anybody know how to select the old DOS font in windows? The one with the little happy faces, playing card symbols and line drawing stuff? I'm looking for something along the lines of:
HFONT hFont = CreateFont(?????);
Thanks
Aaron
|
|
|
|
|
how about font type "System"
MSN Messenger.
prakashnadar@msn.com
|
|
|
|
|
No, that doesn't do it. At least not on my machine. I think these were in the 0-31 range, but I don't get anything for those. I did try other fonts, like "Comib Sans MS", and they all appear the way they should, I just can't get the little smiley characters. Maybe some of the other parameters needto be changed?
Here's what I tried to do:
case WM_PAINT:
// Paint the window's client area.
{
HDC hdc;
if(hFont == NULL)
{
hFont = CreateFont(0,0,0,0, FW_DONTCARE, FALSE, FALSE, FALSE, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FF_DONTCARE, "System");
//hdc = GetDC(m_hWnd);
}
PAINTSTRUCT ps;
hdc = BeginPaint(m_hWnd, &ps);
HFONT hOld = (HFONT)SelectObject(hdc, (HGDIOBJ)hFont);
SetTextColor(hdc, RGB(255,255,255));
SetBkColor(hdc, RGB(0,0,0));
RECT rc;
GetClientRect(m_hWnd, &rc);
int nY = 0;
for(int i = 0; i < 256; i += 64)
{
TextOut(hdc, 0, nY, &m_szBuff[i], 64);
nY += 24;
}
//DrawText(hdc, m_szBuff, 256, &rc, DT_LEFT | DT_WORDBREAK);
SelectObject(hdc, (HGDIOBJ)hOld);
EndPaint(m_hWnd, &ps);
}
return 0;
Thanks,
Aaron
|
|
|
|
|
Arial has all the facethings and other images like hearts, spades etc.
MSN Messenger.
prakashnadar@msn.com
|
|
|
|
|
Try using OEM_CHARSET instead of ANSI_CHARSET .
[From MSDN]
The OEM character set is typically used in full-screen MS-DOS sessions for screen display. Characters 32 through 127 are usually the same in the OEM, U.S. ASCII, and Windows character sets. The other characters in the OEM character set (0 through 31 and 128 through 255) correspond to the characters that can be displayed in a full-screen MS-DOS session. These characters are generally different from the Windows characters.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Thanks! Just what I was looking for!
|
|
|
|
|
Anybody care to explain what a "turncoat" is when used instead of exceptions?
|
|
|
|
|
andy_ecl wrote:
turncoat
??? What's a turncoat ?
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Hi there,
does anyone have a sample code for using buffer transfer mode with TWAIN instead of native mode?
Thanks,
Dudi
|
|
|
|
|
Ladies and Gents,
Wrote a Win 32 app, which ran nicely thankyou, within it I had aggregate structures containing up to 800K instances of a Point class. All was well.
When I ported it to run in under an MFC app, the delete of the top level container was taking > 5 seconds, where previously it was near instantaneous.
It uses STL containers, all the usual speed up tricks, but simply moving the classes into an MFC app causes it to run very very slow.... when deleting.
Anyone come across this?? Any idea's??
Cheers
Laurence
|
|
|
|
|
Are you compiling with debug enabled? MFC has a special new/delete for debug builds, that does a lot of memory leak checking. Great for debugging, but it slows it down a lot.
|
|
|
|
|
Thanks for the reply.
Tried it under Debug and Release, with the same Nett result.
Omitted the DEBUG_NEW macro from the classes in question anyway.
Cheers
Laurence
|
|
|
|
|