|
if i use task scheduler service which is allready provided by microsoft than i have to execute a exeternal exe so my application will be depand on another exe.
but i want to execute a callback function at scheduled time if it is possible with task scheduler than please tell me.
if not than I think, i have to implement own task scheduler.
also i am looking for other windows service which works like task scheduler.
i want source code of that service so with the help of this service i can build own task scheduler.
if any body have idea for the same please share with me.
thanks & regards
bankey
|
|
|
|
|
Do you need to ITaskScheduler ?
|
|
|
|
|
thanks for quick reply
my problem :
suppose i have started my application but at scheduled time(i.e daily,weekly etc) i have to execute some code snippet example a function from my application which is i allready started.
is it possible ITaskScheduler if yes please tell me how can i do this?
thanks
bankey
|
|
|
|
|
For first question see Using the Task Scheduler[^] and for second question
<br />
HRESULT hr;<br />
ITaskScheduler *pITask;<br />
hr = CoInitialize(NULL);<br />
<br />
hr = CoCreateInstance(CLSID_CTaskScheduler,<br />
NULL,<br />
CLSCTX_INPROC_SERVER,<br />
IID_ITaskScheduler,<br />
(void **) &pITask);<br />
...<br />
...<br />
|
|
|
|
|
thanks for your observation on my problem.
i am using task scheduler as you are saying but here problem is that i have to use another executable but i want to execute a function.
i am trying to explain you as follows:
at no.5 the statement
hr = pITask->SetApplicationName ( T2COLE( (LPCTSTR) m_sProgramPath ));
here value of "m_sProgramPath " is c:/abc.exe
is there any method from i can call a function(e.g callback function ) "not another executable "which execute at scheduled time.
please help if you have any idea about the same.
HRESULT hr;
ITaskScheduler *pITask;
hr = CoInitialize(NULL);
1. hr = ::CoCreateInstance (
CLSID_CTaskScheduler,
NULL,
CLSCTX_INPROC_SERVER,
IID_ITaskScheduler,
(void **) &pISched );
2.hr = pISched->Activate ( T2COLE ( szTaskName ), IID_ITask, &pIUnk );
3.hr = pISched->NewWorkItem ( T2COLE ( szTaskName ), CLSID_CTask,
IID_ITask, &pIUnk );
4.hr = pIUnk->QueryInterface ( IID_ITask, (void **) &pITask );
5.hr = pITask->SetApplicationName ( T2COLE( (LPCTSTR) m_sProgramPath ));
6.hr = pITask->SetAccountInformation ( T2COLE( (LPCTSTR) m_sAccount),
T2COLE( (LPCTSTR) m_sPassword) );
7.hr = pITask->CreateTrigger ( &wTrigNumber, &pITaskTrig );
8.hr = pITaskTrig->SetTrigger ( &rTrigger );
9.hr = pITask->QueryInterface ( IID_IPersistFile, (void **) &pIFile );
10.hr = pIFile->Save ( NULL, FALSE );
thanks & regards
bankey
|
|
|
|
|
you use of hr = pITask->SetApplicationName ( T2COLE( (LPCTSTR) m_sProgramPath )); instead you can use
<br />
LPCWSTR m_sProgramPath = L"C:\\Windows\\notepad.exe";<br />
hr = pITask->SetApplicationName(m_sProgramPath );<br /> and...
--------- ------------- ----------
For call a function instead a program I dont know
|
|
|
|
|
thanks for your observation
but i have to prepare own scheduler program because i do not want to depand on other executable.
thanks & regards
bankey.
|
|
|
|
|
|
Just read about this function - The SetWaitableTimer function activates the specified waitable timer. When the due time arrives, the timer is signaled and the thread that set the timer calls the optional completion routine.
Any sufficiently gross incompetence is nearly indistinguishable from malice.
|
|
|
|
|
Hi all
I have a problem with scaling a bitmap in different DPI situations .
The problem is : I have a dialog box where a bitmap is statically present . So during runtime without calling LoadBitmap () this bitmap is loaded into the dialog with the default size which is same you see in dialog editor . But problem comes when I change system DPI from 96 to 120.
Now the dialog and all the controls behind the bitmap are resized while the bitmap remains the same. I tried to implement StretchBlt () to scale the bitmap to new size - I do not succeed as I do not know how to map it to new DPI . To pictorise it ...
................. <---- The parent dialog
. .
. |---------| .
. | |<-- Bitmap with original static size when DPI=96
. | | .
. | | .
. | | .
. | | .
. | | .
. |---------| .
. .
.................
Now what I want is , when I change DPI to 120 then it should resize itself *from* the top,left of original size to the new sized bitmap .
After implementing StretchBlt as below ..I got it stretched fully to windows limits not as I want ...
pBitmap->LoadBitmap(IDB_BITMAP_ADDON_10_NOE);
POINT ptSize;
GetClientRect(hDlg,&rect);
pBitmap->GetObject(sizeof(BITMAP), &bitmap);
ptSize.x = bitmap.bmWidth;
ptSize.y = bitmap.bmHeight;
fxFactor = ((float)ptSize.x/(float)(rect.right-rect.left)),
fyFactor = ((float)ptSize.y/(float)(rect.bottom-rect.top));
xOffs = ((long)rect.Width()-(long)(ptSize.x/fxFactor))/2;
yOffs = ((long)rect.Height()-(long)(ptSize.y/fyFactor))/2;
dc->StretchBlt(xOffs,
yOffs,
(long)(ptSize.x/fxFactor),
(long)(ptSize.y/fyFactor),
&dcTemp,
0, 0,
ptSize.x,
ptSize.y,
SRCCOPY);
Now we have the real width,height of the bitmap + the windows dimensions . I need the bitmap to be scaled evenly to the new dimension of dialog keeping this bitmap in the center of the dialog . So I need to calculate the coordinates of the new bitmap with following points
1) Coordinates of the windows( = Center point of window)
2) Height,Width of bitmap
Can anyone please advise me ?
redindian
redindian
|
|
|
|
|
I see you use of StretchBlt why it doesnt work?
------------ ------------ ----------
1)CRect Rect; GetWindowRect(&Rect);ScreenToClient(&Rect);
2)BITMAP bm;GetObject(handle to bitmap,sizeof(BITMAP),&bm);
|
|
|
|
|
Hi
Thanks for your several answers . In fact I use StretchBlt - but I am doing something wrong in calculating the offset , so the bitmap is stretched to the extreme limits of the dialog . I want the ratio between the size of the static bitmap and the dialog to be evenly increased so that the bitmap is not stretched to the limits. I am unable to calculate the coodinates .
Could you tell me how I can arrive at it with following inputs. I have the following
1) Static size of the bitmap - height/width
2) GetWindowRect(&rect)
I want to get the increased coordinates of the bitbap with the ratio maintained between the new size of bitmap to the new size of dialog .
I hope I do not confuse you . Please try to tell me how I calculate it
redindian
|
|
|
|
|
For example you can use of
(GetWindowRect/ScreenToclient) for retrives dimessions of the window and now you have left/right/top/bottom of window(Rect) now you can calculate these dimessions for bitmap <br />
<br />
<div class="ForumSig"><div style="padding: 0; margin: 0; background-color: rgba(170, 214, 255, 1); text-align: center; font-family: Arial; font-weight: bold; font-style: italic; font-size: 9pt"><br />
<div style="color: rgba(255, 255, 255, 1); width: 300px"><br />
<hr width="250" size="7">WhiteSky<hr width="220" size="7"></div></div></div>
|
|
|
|
|
Does your problem solve?
|
|
|
|
|
Hi Friends,
In my project, i am using DLLMain method.And also i am setting optional entry as DllMainCRTStartup.inspiteof these i am getting below errors.Anybody can help me regarding this?
Creating library C:\Program Files\Quark\QuarkDDS 4\QuarkDDS\XTension\OptimakerSXT2.lib and object C:\Program Files\Quark\QuarkDDS 4\QuarkDDS\XTension\OptimakerSXT2.exp
LINK : error LNK2001: unresolved external symbol _DllMainCRTStartup
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
C:\Program Files\Quark\QuarkDDS 4\QuarkDDS\XTension\OptimakerSXT2.xnt : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.
Raghavendra Pise
|
|
|
|
|
|
I had used some Property Sheets in a Project
which is resulting in a Memory Leak , I dont
know why its occuring ? can anyone put some
light on it
Vikas Amin
EATON
PUNE
|
|
|
|
|
|
Memory leaks are caused by calling new without calling a corresponding delete .
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
vikas amin wrote: ...which is resulting in a Memory Leak
How are you verifying this?
vikas amin wrote: I dont
know why its occuring ?
Neither do we (with a description like that).
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi
I used CListCtrl to create virtual list. I set LParam field in virtual list, but it not working properly. Kindly help
I also need to sort the list
KK
|
|
|
|
|
This a very well known and common problem. See microsoft knowledge base article 555375 here[^] for more information.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
Love it!
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi guys.
I have a problem. I want to delete/remove some character in the file; for example I want to remove 10 bytes of character from specific file.
Thanks.
|
|
|
|
|
Hi Mohammad
Use 2 files, one original file and another temperory file.
Copy wanted bytes from original file to temperoroy files and remove original file. Rename temperory file to original file's name
Best of Luck
Regards
KK
|
|
|
|