Posts: 1,769
Threads: 410
Joined: Feb 2003
I'm trying to build a service monitor exe and it works fine on my machine but it won't work on our server. i think it's due to the service calls.
shouldn't this work?
Services.clsServices ses._create
Services.clsService se
foreach se ses
,_s.from(_s se.DisplayName "[]")
_s.setfile("D:\Documentation\test-ken.txt" -1)
Posts: 12,035
Threads: 139
Joined: Dec 2002
What Windows version?
---
OT: qmserv service is running?
Posts: 1,769
Threads: 410
Joined: Feb 2003
server 2003 sp 2
developed on XP pro sp2
Posts: 12,035
Threads: 139
Joined: Dec 2002
Don't know, I have only 2003 without SP, and the code works well.
Try this.
out
int scm=OpenSCManager(0 0 SC_MANAGER_ENUMERATE_SERVICE)
if(!scm) end _s.dllerror
int i n ne=64*1024/sizeof(ENUM_SERVICE_STATUS)
ARRAY(ENUM_SERVICE_STATUS) a.create(ne)
if(!EnumServicesStatus(scm SERVICE_WIN32 SERVICE_STATE_ALL &a[0] ne*sizeof(ENUM_SERVICE_STATUS) &i &n 0))
,CloseServiceHandle scm
,end _s.dllerror
for i 0 n
,out a[i].lpDisplayName
CloseServiceHandle scm
Posts: 1,769
Threads: 410
Joined: Feb 2003
it flashes a quick OSD box that says "No reports unassigned".
are we missing a dll?
Posts: 12,035
Threads: 139
Joined: Dec 2002
Don't know from where is the OSD. Do you get an error in QM output?
Posts: 1,769
Threads: 410
Joined: Feb 2003
not on my machine, it works fine on the xp just not on the server 03.
Posts: 1,769
Threads: 410
Joined: Feb 2003
wait...something screwy is going on with my 'compile exe'....it is working perfectly now...
thanks.
Posts: 12,035
Threads: 139
Joined: Dec 2002
ken gray Wrote:wait...something screwy is going on with my 'compile exe'....it is working perfectly now...
thanks.
Works when you make exe from the macro?
Posts: 1,769
Threads: 410
Joined: Feb 2003
yours works now. my original code still doesnt.
thanks!
Posts: 1,769
Threads: 410
Joined: Feb 2003
i'm trying to find out if a service is in a stopped state and so i made a slight change to your code to this one. but i get a list with each stopped service in there twice. did i do it wrong?
if(!EnumServicesStatus(scm SERVICE_WIN32 SERVICE_INACTIVE &a[0] ne*sizeof(ENUM_SERVICE_STATUS) &_i &n 0))
thanks.
Posts: 12,035
Threads: 139
Joined: Dec 2002
I get normal list. If you need only 1 service, use QueryServiceStatus.
out
int scm=OpenSCManager(0 0 GENERIC_READ)
if(!scm) end _s.dllerror
int sc=OpenService(scm "quickmacros2" SERVICE_QUERY_STATUS)
if(sc)
,SERVICE_STATUS z
,if(QueryServiceStatus(sc &z))
,,if(z.dwCurrentState=SERVICE_RUNNING) out "running"
,,else out "stopped or paused"
,CloseServiceHandle sc
else out _s.dllerror
CloseServiceHandle scm
Posts: 1,769
Threads: 410
Joined: Feb 2003
where are you getting the service name? my machine shows "Quick Macros" not "quickmacros2"; how can i query using the name in the Services window?
i can't seem to find in via MSDN
Posts: 12,035
Threads: 139
Joined: Dec 2002
"quickmacros2" is service name.
"Quick Macros" is display name.
Both are in service properties dialog.
Don't know how to query using display name without enumerating.
Posts: 1,769
Threads: 410
Joined: Feb 2003
DOH!!!!
right ABOVE the display.... :roll:
geeez....thanks for everything.
works great!!!