Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Service Listing
#1
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?

Code:
Copy      Help
Services.clsServices ses._create
Services.clsService se

foreach se ses
,_s.from(_s se.DisplayName "[]")

_s.setfile("D:\Documentation\test-ken.txt" -1)
An old blog on QM coding and automation.

The Macro Hook
#2
What Windows version?

---

OT: qmserv service is running?
#3
server 2003 sp 2
developed on XP pro sp2
An old blog on QM coding and automation.

The Macro Hook
#4
Don't know, I have only 2003 without SP, and the code works well.

Try this.

Code:
Copy      Help
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
#5
it flashes a quick OSD box that says "No reports unassigned".

are we missing a dll?
An old blog on QM coding and automation.

The Macro Hook
#6
Don't know from where is the OSD. Do you get an error in QM output?
#7
not on my machine, it works fine on the xp just not on the server 03.
An old blog on QM coding and automation.

The Macro Hook
#8
wait...something screwy is going on with my 'compile exe'....it is working perfectly now...

thanks.
An old blog on QM coding and automation.

The Macro Hook
#9
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?
#10
yours works now. my original code still doesnt.


thanks!
An old blog on QM coding and automation.

The Macro Hook
#11
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?

Code:
Copy      Help
if(!EnumServicesStatus(scm SERVICE_WIN32 SERVICE_INACTIVE &a[0] ne*sizeof(ENUM_SERVICE_STATUS) &_i &n 0))


thanks.
An old blog on QM coding and automation.

The Macro Hook
#12
I get normal list. If you need only 1 service, use QueryServiceStatus.

Code:
Copy      Help
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
#13
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
An old blog on QM coding and automation.

The Macro Hook
#14
"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.
#15
DOH!!!!
right ABOVE the display.... :roll:
geeez....thanks for everything.

works great!!!
An old blog on QM coding and automation.

The Macro Hook


Forum Jump:


Users browsing this thread: 1 Guest(s)