Search results for query: *

  1. C

    Question Help with duplicate code

    I have no control over the image. I turn up at a customers and use my utility - they set their machines up however they want. I have to work with what is in front of me. I haven't come across the P/Invoke thing, so I will research that and see if I understand how it works. Thanks
  2. C

    Question Help with duplicate code

    Thanks for everyones replies - I have refactored using the above code and this does what I need for now. I appreciate it may not be elegant or use the correct calls. Thanks Folks
  3. C

    Question Help with duplicate code

    My app also calls other executables, it maybe that a user closes the app then comes back to it later. I need to cover all my bases.
  4. C

    Question Help with duplicate code

    OK - So if I invoke the API, then quite my app - will it still keep the machine awake?
  5. C

    Question Help with duplicate code

    OK - I have read through some online tutorials and messed around. Here is my updated code. It does what I want and only has one instance of the actual code to execute, it calls it 6 times and passes different parameters each time. Probably still a very ugle way of doing it, but it reduces the...
  6. C

    Question Help with duplicate code

    Invoking dll's is a bit out of my depth. I've tested the current code and it alters the correct power settings on the active GUID. I was just hoping to clean the code up a little and not call the same code (bar the arguments) 6 times.
  7. C

    Question Help with duplicate code

    I have written a small utility that extracts various information from a computer. Some of the data collected requires third party applications to run, this can take time and in some instances the machine will go to sleep or the disks will spin down etc... I used to use various batch files to...
  8. C

    Question Help with duplicate code

    I have written some code with alters the power settings on Windows computers. I am no software dev, but I suspect there is a better way of coding than what I have written. Basically the code is duplicated 6 times to run each alteration to the system. I am sure there must be a way to write one...
  9. C

    Exporting Registry Hives

    Thanks everyone for your help on this one. I did some debugging and found that I had messed up on the parameters. I needed to move the 'export' switch to the .Arguments line. It works a treat now. I do take care of the error handling too - that is dealt with when I refine the code. I just...
  10. C

    Exporting Registry Hives

    I am trying to write a piece of code to export registry keys using C# and the built in reg export command line. This is what I have so far, but it just doesn't work: using System; using System.Diagnostics; using System.IO; namespace VolatileDataCapture.Services { class...
  11. C

    Looped Output Results

    Solved Thanks so much for that - worked a treat.
  12. C

    Looped Output Results

    Hi All, I am relatively new to C# and am struggling with outputting some results. I have a piece of code that uses the inbuilt WMI commands to retrieve some system information. It currently writes the output to the console and works fine (both shown below). What I would like to do is output...
Back
Top Bottom