|
i configured fisrt service failure action of "alerter" servie as "Action Run Command" with commandline "C:\\myfile.exe" ,using services.msc under winxp .
i tried to retrieve the filename using the following code ...
int main()
{
BYTE* Buf = NULL ;
DWORD dwNeeded = 0 , dw = 0 ;
SC_HANDLE hSCManager , hService ;
hSCManager = OpenSCManager( NULL , SERVICES_ACTIVE_DATABASE , SC_MANAGER_ALL_ACCESS ) ;
hService = OpenService( hSCManager , "Alerter" , SERVICE_ALL_ACCESS ) ;
QueryServiceConfig2( hService , SERVICE_CONFIG_FAILURE_ACTIONS , (LPBYTE)Buf , 0 , &dwNeeded ) ;
printf( "BufSize = %d\n" , dwNeeded ) ;
Buf = new BYTE[ dwNeeded ] ;
if( QueryServiceConfig2( hService , SERVICE_CONFIG_FAILURE_ACTIONS , (LPBYTE)Buf , dwNeeded , &dw ) )
{
for( int i = 0 ; i < ((SERVICE_FAILURE_ACTIONS*)Buf)->cActions ; i ++ )
{
if( ((SERVICE_FAILURE_ACTIONS*)Buf)->lpsaActions[ i ].Type == SC_ACTION_RUN_COMMAND )
{
if( ((SERVICE_FAILURE_ACTIONS*)Buf)->lpCommand )
{
printf( "Actions : %d\nFile : %s\n" , ((SERVICE_FAILURE_ACTIONS*)Buf)->cActions , ((SERVICE_FAILURE_ACTIONS*)Buf)->lpCommand ) ;
}
}
}
}
printf( "%d" , (sizeof(SC_ACTION) )) ;
if( Buf )
delete[] Buf ;
CloseServiceHandle( hService ) ;
CloseServiceHandle( hSCManager ) ;
}
i got the output
BufSize = 78
Actions : 3
File :
//can any one tell me where is the problem in my code ? why i was unable to retrieve filename ?
Thanks & Regards
|
|
|
|
|
How can I intercept the media stream when an application like media player starts playing a movie, so that the encoded stream can be send to a remote client?
|
|
|
|
|
I don't know about intercepting a media stream - that's a hack.
You can, however, use the Windows Media SDKs[^] to manipulate media streams
however you need to.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
How can I register a perticular extension files with my application ? It is a dialog based application, so i can't use RegisterShellFileTypes. Please tell me the other way.
|
|
|
|
|
Hi Friends
In my program contains one main window and too many child windows arranged horizontally to fill the whole main window. I like to draw a rectangle in main window. But it not seen properly, i think rectangle is painted behind the child windows. How to paint rectangle in front of child windows.
please help me !!!
thanks in advance
-RisKhan-
|
|
|
|
|
Draw Rectangle on your rootDC handle
Is this your answer?
Manish Patel.
B.E. - Information Technology.
|
|
|
|
|
Draw rectangle on your rootDC(main) handle.
Is this your answer??
Manish Patel.
B.E. - Information Technology.
|
|
|
|
|
You draw on the main window now whats your problem you cant see it?
|
|
|
|
|
Hi hamid
Actually the rectangle is shown behind the child windows. If i put a MsgBox in OnPaint i can see well.
-RisKhan-
|
|
|
|
|
Thats why i told you put it on your rootdc(main screen) handle
Manish Patel.
B.E. - Information Technology.
|
|
|
|
|
Thats why i told you put it on your rootdc(main screen) handle
Do you have check it?
Manish Patel.
B.E. - Information Technology.
|
|
|
|
|
Why you send dobule posts?
|
|
|
|
|
I dont know.
Nut when i am posting it shows some error message that message not send and when i send it again then it will be sent.
and in Message list it display two times.
Is this a website problem?
Manish Patel.
B.E. - Information Technology.
|
|
|
|
|
You can write to Suggestions and Bug Reports forum if you think its a problem for you.
|
|
|
|
|
|
|
|
Well if you dont need to child windows you can hide them?
|
|
|
|
|
I have a dll I'm trying to plug in to someone else'e code. That DLL needs to have a few functions and I want to maintain a database connection inside the DLL over multiple functions calls in to the DLL. (Connecting and disconnecting inside each function call would be wasteful and possibly too slow). So I created a global pointer and assigned the pointer in the init function call. Like this:
Init function
CConnection* Connection = new Connection;
Data Access Function
Connection is now equal to null.
Initially I though the DLL was being reloaded so I have added logging functions and it is not. Why would a DLL lose the state of it's globals? Is there something different I can try to maintain state in a DLL?
|
|
|
|
|
This [http://support.microsoft.com/kb/125677] may help you.
- Malli...!
|
|
|
|
|
My project is SDI that use multiview.
When swap view to another I also want disable the old toolbar and change to the new one.
Please advise,How can I do this.
|
|
|
|
|
CToolBar::GetToolBarCtrl()<br />
CToolBarCtrl::EnableButton(int nID, BOOL bEnable = TRUE);
Regards,
Paresh.
|
|
|
|
|
Hello, I'm using RasSetEntryProperties() to create a modem connection. But I can't using the fifth and sixth parameters to configure the device,since the parameters aren't supported by WINXP. I need to change the property of the connection to disable the hardware functions like hardware flow control. I'm developing a tool for mobile to install the drivers to PC and construct a dialer for user to surf internet throw GPRS. The mobile will be as the modem. It doesn't need hardware flow control. I haven't found the useful information in register. How can I do? Please help me, thanks a lot!
My platform: Windows XP SP2, VC++6.0
Rock
|
|
|
|
|
|
hello,
Does anyone know how to print CEdit's text?
any ideas?
thanks
|
|
|
|