Click here to Skip to main content
       

Web Development

 
AnswerRe: Pasting screen shot in text field in web application [modified] PingroupStyleTech Solutions Ltd4-Feb-13 6:16 
QuestionCreating Mobile Apps with HTML5 PinmemberSunitha2716-Jan-13 5:11 
AnswerRe: Creating Mobile Apps with HTML5 PinmvpSandeep Mewara16-Jan-13 6:12 
AnswerRe: Creating Mobile Apps with HTML5 PinmvpRichard MacCutchan16-Jan-13 6:13 
AnswerRe: Creating Mobile Apps with HTML5 Pinmemberrg1024-Jan-13 1:37 
QuestionHTML5 Audio Stream PinmemberAdam Jasper16-Jan-13 2:14 
QuestionAbout mobile web debugger Pinmembertidelgl13-Jan-13 19:23 
QuestionUnable to start service using WMI Pinmemberonly1rb11-Jan-13 6:22 
This is a 2 part question. I have a service that has a name "Ads 1", "Ads 2". They take a parameter of "1" and "2".
 
1. When I invoke the method to start the service "Ads 1" the " 1" is truncated, so I get "Ads" being passed. How can I stop this and force it to be "Ads 1"? All my other services start, stop, pause, everything else just fine, but they don't have a space then number either. What am I missing?
 
2. I am trying to pass the parameter with the startservice. I am using a hardcoded parameter value(1) for now to get it to work in testing. Due to the fact that I am unable to get the service to start I am not sure the parameter is being passed. How can I check to see if the paramter is being passed and/or Am I doing this right way?
 
Any help is appreciated. Thank you.
 
<pre lang="c#">  
        int iPos; 
        int iCount = 0; 
        string sService; 
 
        try 
        { 
            ConnectionOptions conOpts = new ConnectionOptions(); 
            conOpts.Username = ddlServers.SelectedItem.Text.ToString() + "\\" + System.Configuration.ConfigurationManager.AppSettings["AdminUser"].ToString(); 
            conOpts.Password = System.Configuration.ConfigurationManager.AppSettings["AdminPassword"].ToString(); 
            System.Management.ManagementScope oMs = new System.Management.ManagementScope("\\\\" + 
                                                                                          ddlServers.SelectedItem.Text + 
                                                                                          "\\root\\cimv2", conOpts); 
 
            while (iCount < lboxServices.Items.Count) 
            { 
                if (lboxServices.Items[iCount].Selected) 
                { 
                    iPos = lboxServices.Items[iCount].Text.IndexOf("-"); 
                    sService = lboxServices.Items[iCount].Text.Substring(0, iPos).Trim(); 
 
                    System.Management.ObjectQuery oQuery = new System.Management.ObjectQuery("select * from Win32_Service Where Name='" + 
                                                                                             sService + 
                                                                                             "'"); 
                    ManagementObjectSearcher oSearcher = new ManagementObjectSearcher(oMs, oQuery); 
                    ManagementObjectCollection oReturnCollection = oSearcher.Get(); 
 
                    if (oReturnCollection.Count > 0) 
                    { 
                        foreach (ManagementObject oReturn in oReturnCollection) 
                        { 
                            if (oReturn.GetPropertyValue("State").ToString().ToLower().Equals("stopped") || 
                                oReturn.GetPropertyValue("State").ToString().ToLower().Equals("paused")) 
                            { 
                                String[] sArgs = new string[] { "1" }; 
                                oReturn.InvokeMethod("StartService", sArgs); 
                            } 
                        } 
                    } 
 
                    lboxServices.Items[iCount].Text = sService + " - " + CheckService(ddlServers.SelectedItem.Text, sService); 
                } 
                iCount++; 
            } 
        } 
        catch (Exception err) 
        { 
            lboxServices.Items.Add("Error: " + err.Message.ToString()); 
        }

QuestionHelp! Pinmembercrood5-Jan-13 20:05 
AnswerRe: Help! PinmvpSandeep Mewara5-Jan-13 20:27 
Questiondrop down menu pushes the content down similar to ibm.com PinmemberMohamed Samir29-Dec-12 23:59 
AnswerRe: drop down menu pushes the content down similar to ibm.com PinmvpSandeep Mewara30-Dec-12 0:13 
Questiongoogle map include in contact.aspx page PinmemberMember 819678127-Dec-12 20:50 
AnswerRe: google map include in contact.aspx page Pinmembervbmike28-Dec-12 8:59 
AnswerRe: google map include in contact.aspx page PinmvpSandeep Mewara5-Jan-13 20:28 
AnswerRe: google map include in contact.aspx page PinmemberS.M. Zamshed Farhan15-Jan-13 4:12 
QuestionUsing Developer Tools PinmemberPhanindra26127-Dec-12 1:59 
AnswerRe: Using Developer Tools PinmemberS.M. Zamshed Farhan12-Jan-13 5:46 
AnswerRe: Using Developer Tools PinmemberS.M. Zamshed Farhan12-Jan-13 5:48 
AnswerRe: Using Developer Tools Pinmemberrg1024-Jan-13 1:40 
QuestionSSRS Report Conversion to PDF [modified] PinmemberVinay Meka22-Dec-12 0:58 
AnswerRe: SSRS Report Conversion to PDF PinmvpSandeep Mewara5-Jan-13 20:34 
QuestionCould not load file or assembly PinmemberChona117120-Dec-12 1:57 
AnswerRe: Could not load file or assembly PinmemberArpitDubey28-Dec-12 8:50 
QuestionHow should I measure scroll position in different browsers [modified] Pinmemberwoomla17-Dec-12 21:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web03 | 2.8.140721.1 | Last Updated 28 Jul 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid