Login Register






Thread Rating:
  • 0 Vote(s) - 0 Average


[Help] Auto Sleep And Wakeup Pc Using C# Language filter_list
Author
Message
[Help] Auto Sleep And Wakeup Pc Using C# Language #1
hello, am new to C# and would like to develop a scheduler in C# which would handle the sleep and wake-up functions in Win7 automatically from the app, like for example wake up daily at 8AM and sleep at 8PM on the same day, and the next day do the wake up again and so on... anyone can help me with finding the codes or a sample app which does this:Footinmouth:

Reply

[Help] Auto Sleep And Wakeup Pc Using C# Language #2
hello, am new to C# and would like to develop a scheduler in C# which would handle the sleep and wake-up functions in Win7 automatically from the app, like for example wake up daily at 8AM and sleep at 8PM on the same day, and the next day do the wake up again and so on... anyone can help me with finding the codes or a sample app which does this:Footinmouth:

Reply

RE: [Help] Auto Sleep And Wakeup Pc Using C# Language #3
I assume you at least have some prior expierience with C#. The Windows API contains some native functions related to power management, mostly documented here:

http://msdn.microsoft.com/en-us/library/...S.85).aspx

Using P/Invoke aka DllImport you could call those functions and marshal related structs. I guess these two functions would be of most help to you:

http://msdn.microsoft.com/en-us/library/...s.85).aspx
http://msdn.microsoft.com/en-us/library/...s.85).aspx

The first creates a new waitable timer and with the second function you can set the time the computer needs to wake up again. I took the liberty of already looking op the signatures in C# for those two methods:

http://pinvoke.net/default.aspx/kernel32...Timer.html
http://pinvoke.net/default.aspx/kernel32...Timer.html

The last two links also contain some examples in C# on how to use the imports.

Reply

RE: [Help] Auto Sleep And Wakeup Pc Using C# Language #4
Wrong forum... C# does not qualify as any of the defined languages in this forum or a 'C based' language. C# is Microsoft's Java, and it relies on .NET.
ArkPhaze
"Object oriented way to get rich? Inheritance"
Getting Started: C/C++ | Common Mistakes
[ Assembly / C++ / .NET / Haskell / J Programmer ]

Reply

RE: [Help] Auto Sleep And Wakeup Pc Using C# Language #5
(10-13-2013, 06:05 AM)ArkPhaze Wrote: Wrong forum... C# does not qualify as any of the defined languages in this forum or a 'C based' language. C# is Microsoft's Java, and it relies on .NET.

Depends on your definition of 'C based'. C#'s syntax is C-like, the compiler is not.

I would change the last part of your sentence though. C# itself as a language does not depend on the .NET framework. It depends on the Common Language Runtime (CLR). The C# compiler (which works on top of the CLR) is acutually written in C#, even worse, the C# compiler doesn't exists. What most people define as the C# compiler is merely a translator to the intermediate language (IL). The term '.Net Framework' is more a collection name for all languages and tools that work on top of the CLR.

Reply

RE: [Help] Auto Sleep And Wakeup Pc Using C# Language #6
(10-14-2013, 06:41 PM)Isotope Wrote:
(10-13-2013, 06:05 AM)ArkPhaze Wrote: Wrong forum... C# does not qualify as any of the defined languages in this forum or a 'C based' language. C# is Microsoft's Java, and it relies on .NET.

Depends on your definition of 'C based'. C#'s syntax is C-like, the compiler is not.

I would change the last part of your sentence though. C# itself as a language does not depend on the .NET framework. It depends on the Common Language Runtime (CLR). The C# compiler (which works on top of the CLR) is acutually written in C#, even worse, the C# compiler doesn't exists. What most people define as the C# compiler is merely a translator to the intermediate language (IL). The term '.Net Framework' is more a collection name for all languages and tools that work on top of the CLR.

Not at all. C# is not C based, and if by syntax, it is, then that would make Java and many other languages C-based as well by that logic. C# is actually Microsoft's Java, it was never to be based off of C or C++. Inherently there were other languages that took the syntax of most of the common programming languages we know of today, but those seem to don't exist anymore when we talk about programming languages.

Just some basic English concepts, "based" means that something was created by taking the ideas from someplace else. "Like" means somewhat, but not necessarily that the result was taken from ideas or concepts elsewhere. C# is "C-like" in terms of syntax. It was never supposed to be "C-based."

Quote:I would change the last part of your sentence though. C# itself as a language does not depend on the .NET framework. It depends on the Common Language Runtime (CLR).

How do you assume that? It's both, so I don't see an issue with saying it depends on the .NET framework (it does), and was created by Microsoft to depend on the .NET framework. You also inadequately switched out my word "relies" to "depend", implying that I was meaning perhaps something else, which is incorrect. All you did was twist my wording to suit your opinion of what I should have said.

For me to change it from .NET to the CLR would make just as much sense as changing it to saying that C# requires a computer... Don't forget, C# has changed quite a bit up to it's current version. Now there is also the DLR (as of C# 4.0), which enables us to make use of the dynamic keyword and adds a set of services for dynamic languages to the CLR.

For it not to require the .NET framework, you would essentially have to build your own for C# to use, and by that point in time it really wouldn't be much of a C# language in my opinion.

Quote:the C# compiler doesn't exists. What most people define as the C# compiler is merely a translator to the intermediate language (IL).

The C# compiler does exist, what do you think compiles the code into a binary? Every time the executable is run it goes through a process called "JIT [i]compilation," which takes the instructions from the .NET assembly and compiles it into native IL code that can be run on the system, the only catch is that it really happens in memory, unless you save a native image cache in the GAC. Just because it doesn't produce a visible file output doesn't mean that this isn't compilation either however.

Quote:The term '.Net Framework' is more a collection name for all languages and tools that work on top of the CLR.

You are confused, the .NET framework is not a name for the collection of languages and tools that work on top of the CLR, it's a name for the framework itself that Microsoft developed. Without .NET being used in context with the word "framework" perhaps it would refer to the collection of languages that work with the common language runtime, but by your post, that's not the case.
ArkPhaze
"Object oriented way to get rich? Inheritance"
Getting Started: C/C++ | Common Mistakes
[ Assembly / C++ / .NET / Haskell / J Programmer ]

Reply







Users browsing this thread: 1 Guest(s)