From: Darmadi on
Thanks Marc,

I'll take a look on it.

Regards,
Darmadi
From: Massimo Bighelli on
Hi Marc,

looking at your code using SCHTASKS.EXE
Interesting

What about Vista and Win7 no-Administrators?
What is in your Universe:runsafe(...) method?
(just RUN the command line?)
Why do you state that schtasks is language based?
Here is Vista64 ITA, and all parameters are in english.

THX

Massimo Bighelli
ARCA Sistemi S.r.l.




"Marc Verkade [Marti IT]" <marcatM(a)rtidotnl> ha scritto nel messaggio
news:4ae83bec$0$761$58c7af7e(a)news.kabelfoon.nl...
> Hey,
>
> We use the SCHTASKS.EXE to program tasks in the windows taskmanager.
> Thing is that SCHTASKS is language based. This is th eDutch version. Look
> at MSDN for english or other language versions.
>
>
> FUNCTION TaskAdd(cUserName AS STRING,cUserPassword AS STRING,dwSchema AS
> DWORD,sExtraScheme AS STRING,cTaskName AS STRING,cCommandLine AS STRING)
> AS LOGIC PASCAL
> LOCAL cParameters AS STRING
> LOCAL cSchema AS STRING
> LOCAL lRetValue AS LOGIC
>
> // Parameters
> cParameters:="/Create"
> cParameters:=cParameters + " /RU "+cUserName
> cParameters:=cParameters + " /RP "+cUserPassword
>
> DO CASE
> CASE dwSchema==DWSCHTASKS_SC_DAILY
> cSchema:="Dagelijks"
> // ST = "HH:MM:SS"
>
> cParameters:=cParameters + " /SC "+cSchema
> cParameters:=cParameters + " /ST "+sExtraScheme
>
> CASE dwSchema==DWSCHTASKS_SC_MINUTE
> cSchema:="Minuut"
> // MO = 1 - 1439
>
> cParameters:=cParameters + " /SC "+cSchema
> cParameters:=cParameters + " /MO "+sExtraScheme
>
> CASE dwSchema==DWSCHTASKS_SC_EVERY_HOUR
> cSchema:="Elk uur"
> // MO = 1 - 23
>
> cParameters:=cParameters + " /SC "+cSchema
> cParameters:=cParameters + " /MO "+sExtraScheme
>
>
> CASE dwSchema==DWSCHTASKS_SC_WEEKLY
> cSchema:="Wekelijks"
> // MO = 1 - 52
> // MLV Missing /ST!
>
> cParameters:=cParameters + " /SC "+cSchema
> cParameters:=cParameters + " /MO "+sExtraScheme
> CASE dwSchema==DWSCHTASKS_SC_MONTHLY
> cSchema:="Maandelijks" // Daily
> // /MO = 1 - 12
> // /D = Day
> // /ST = Time
> // /M = Month
>
> cParameters:=cParameters + " /SC "+cSchema
> cParameters:=cParameters + " /MO "+sExtraScheme
> CASE dwSchema==DWSCHTASKS_SC_ONCE
> cSchema:='"E�n keer"'
> // ST = "HH:MM:SS"
>
> cParameters:=cParameters + " /SC "+cSchema
> cParameters:=cParameters + " /ST "+sExtraScheme
>
> CASE dwSchema==DWSCHTASKS_SC_STARTUP
> cSchema:='"Bij opstarten"'
> // No options
>
> cParameters:=cParameters + " /SC "+cSchema
>
> CASE dwSchema==DWSCHTASKS_SC_LOGIN
> cSchema:='"Bij aanmelden"'
> // No options
>
> cParameters:=cParameters + " /SC "+cSchema
>
> CASE dwSchema==DWSCHTASKS_SC_NOT_ACTIVE
> cSchema:='"BIJ NIET-ACTIEF"'
> // No options
>
> cParameters:=cParameters + " /SC "+cSchema
> OTHERWISE
> // Other constants have to be defined.
> // LET OP: The dutch version OF SCHTASKS.EXE only recognizes dutch words
> here!
> // Maybe other localized versions only accepts words on the respective
> language!?
> ENDCASE
>
> // Clean he commandline
> cTaskName:=StrTran(cTaskName,">","")
> cTaskName:=StrTran(cTaskName,"<","")
> cTaskName:=StrTran(cTaskName,",","")
> cTaskName:=StrTran(cTaskName,":","")
> cTaskName:=StrTran(cTaskName,";","")
> cTaskName:=StrTran(cTaskName,"|","")
> cTaskName:=StrTran(cTaskName,"/","")
> cTaskName:=StrTran(cTaskName,"\","")
>
> // Task
> cParameters:=cParameters + " /TN "+cTaskName
> cParameters:=cParameters + ' /TR "'+cCommandLine+'"'
>
> // cParameters:="/Create /RU Domain\User /RP Pass /SC Dagelijks /ST
> 18:00:00 /TN Programatically_created_task /TR
> c:\windows\system32\notepad.exe"
>
> lRetValue:=Universe:RunSafe("","SCHTASKS.EXE",cParameters)
>
> IF Universe:IniFile:GetSetLogic("Settings" ,"ExportTask" ,FALSE)
> FErase(Universe:FileSpec:DrivePath+"TaskAdd.txt")
> MemoWrit(Universe:FileSpec:DrivePath+"TaskAdd.txt","SCHTASKS
> "+cParameters)
> END
>
> RETURN lretvalue
>
>
>
> --
> Grtz, Marc
>
>
> "Darmadi" <support(a)gfsoftindo.com> schreef in bericht
> news:hc830r$t52$1(a)aioe.org...
>> Thanks all,
>>
>> Actually I have a protection USB Key-Lock, what I want when user put in
>> the key, then system will automatically call my application.
>>
>> Why choose service?
>> Cause, the service could be stop during installation, so maybe some other
>> cases, I could update the service too.
>>
>> Hi Marc Verkade,
>> Could please send me the sample?
>> support(a)gfsoftindo.com
>>
>> Regards,
>> Darmadi
>>
>>
>> "Marc Verkade [Marti IT]" <marcatM(a)rtidotnl> wrote in message
>> news:4ae5f07b$0$783$58c7af7e(a)news.kabelfoon.nl...
>>> Hai,
>>> I prgram the scheduler to start my gui apps from a service.
>>> Perhaps that is the way to go?
>>>
>>> --
>>> Grtz, Marc
>>>
>>>
>>> "Ginny Caughey" <ginny.caughey.online(a)wasteworks.com> schreef in bericht
>>> news:011dd0e4$0$11375$c3e8da3(a)news.astraweb.com...
>>>> Darmadi,
>>>>
>>>> Could you use a scheduled task instead of a service for what you want?
>>>>
>>>> --
>>>>
>>>> Ginny Caughey
>>>> www.wasteworks.com
>>>>
>>>>
>>>>
>>>>
>>>> "Darmadi" <support(a)gfsoftindo.com> wrote in message
>>>> news:hc3270$s02$1(a)aioe.org...
>>>>> Geoff,
>>>>>
>>>>> the service itself don't use any GUI Class, only opening another
>>>>> application (using CreateProcess).
>>>>> The application was opened, but in Vista showing "Interactive services
>>>>> dialog detection"
>>>>>
>>>>> Regards,
>>>>> Darmadi
>>>>>
>>>>> "Geoff Schaller" <geoffx(a)softxwareobjectives.com.au> wrote in message
>>>>> news:oo3Fm.49917$ze1.49170(a)news-server.bigpond.net.au...
>>>>>> Darmadi,
>>>>>>
>>>>>> You probably haven't written your service correctly. There mustn't be
>>>>>> any GUI or anything needing client input or output... otherwise it
>>>>>> isn't really a service. You either build a small application to
>>>>>> consult settings or properties or what you want should really be a
>>>>>> scheduled task rather than a service.
>>>>>>
>>>>>> What are you trying to achieve with the service and what features
>>>>>> were you wanting to use?
>>>>>>
>>>>>> Geoff
>>>>>>
>>>>>>
>>>>>> "Darmadi" <support(a)gfsoftindo.com> wrote in message
>>>>>> news:hblu4e$96p$1(a)aioe.org:
>>>>>>
>>>>>>> Hi to all,
>>>>>>>
>>>>>>> I have test NT Services a sample from VO 2.8
>>>>>>> When running that service, and opening an application it showing a
>>>>>>> dialog
>>>>>>> "Interactive services dialog detection" in Ms. Windows Vista.
>>>>>>> How do I do to make it easier just opening an application only ?
>>>>>>> (Not
>>>>>>> displaying the "Interactive services dialog detection")
>>>>>>>
>>>>>>> Regards,
>>>>>>> Darmadi
>>>>>>
>>>>>
>>>
>>
>

From: Gerhard Bunzel on
Darmadi,

you can start a small application with a Tray-Icon and
RegisterDeviceNotification, that ist waiting on the Event WM_DEVICECHANGE
and than start your real application. To stop that 'Service-Application',
you can send a message, update your app and than start again to wait on your
USB Key-Lock.

Here you will find some infos:
http://msdn.microsoft.com/en-us/library/aa363432(VS.85).aspx


HTH

Gerhard



PS: Sorry about my english


"Darmadi" <support(a)gfsoftindo.com> schrieb im Newsbeitrag
news:hc830r$t52$1(a)aioe.org...
> Thanks all,
>
> Actually I have a protection USB Key-Lock, what I want when user put in
> the key, then system will automatically call my application.
>
> Why choose service?
> Cause, the service could be stop during installation, so maybe some other
> cases, I could update the service too.
>
> Hi Marc Verkade,
> Could please send me the sample?
> support(a)gfsoftindo.com
>
> Regards,
> Darmadi
>
>
> "Marc Verkade [Marti IT]" <marcatM(a)rtidotnl> wrote in message
> news:4ae5f07b$0$783$58c7af7e(a)news.kabelfoon.nl...
>> Hai,
>> I prgram the scheduler to start my gui apps from a service.
>> Perhaps that is the way to go?
>>
>> --
>> Grtz, Marc
>>
>>
>> "Ginny Caughey" <ginny.caughey.online(a)wasteworks.com> schreef in bericht
>> news:011dd0e4$0$11375$c3e8da3(a)news.astraweb.com...
>>> Darmadi,
>>>
>>> Could you use a scheduled task instead of a service for what you want?
>>>
>>> --
>>>
>>> Ginny Caughey
>>> www.wasteworks.com
>>>
>>>
>>>
>>>
>>> "Darmadi" <support(a)gfsoftindo.com> wrote in message
>>> news:hc3270$s02$1(a)aioe.org...
>>>> Geoff,
>>>>
>>>> the service itself don't use any GUI Class, only opening another
>>>> application (using CreateProcess).
>>>> The application was opened, but in Vista showing "Interactive services
>>>> dialog detection"
>>>>
>>>> Regards,
>>>> Darmadi
>>>>
>>>> "Geoff Schaller" <geoffx(a)softxwareobjectives.com.au> wrote in message
>>>> news:oo3Fm.49917$ze1.49170(a)news-server.bigpond.net.au...
>>>>> Darmadi,
>>>>>
>>>>> You probably haven't written your service correctly. There mustn't be
>>>>> any GUI or anything needing client input or output... otherwise it
>>>>> isn't really a service. You either build a small application to
>>>>> consult settings or properties or what you want should really be a
>>>>> scheduled task rather than a service.
>>>>>
>>>>> What are you trying to achieve with the service and what features were
>>>>> you wanting to use?
>>>>>
>>>>> Geoff
>>>>>
>>>>>
>>>>> "Darmadi" <support(a)gfsoftindo.com> wrote in message
>>>>> news:hblu4e$96p$1(a)aioe.org:
>>>>>
>>>>>> Hi to all,
>>>>>>
>>>>>> I have test NT Services a sample from VO 2.8
>>>>>> When running that service, and opening an application it showing a
>>>>>> dialog
>>>>>> "Interactive services dialog detection" in Ms. Windows Vista.
>>>>>> How do I do to make it easier just opening an application only ? (Not
>>>>>> displaying the "Interactive services dialog detection")
>>>>>>
>>>>>> Regards,
>>>>>> Darmadi
>>>>>
>>>>
>>
>