SetComputerName not taking effect. No Error in Debug either.
-
Hello everyone, I am posting this here because I am not receiving an error to my compiling. The program executes just fine, just not applying the new computer name. Please tell me what you see wrong. I am new and been reading on MSDN's website on how to used this Function correctly. If you have an answer to my question, please explain your answer. It will help me and any other beginner programmer. Here is the code: <code>#include <iostream> #include <windows.h> #include <stdio.h> using namespace std; // Set Local Computer Name BOOL WINAPI SetComputerName( LPCTSTR lpnewcomputername ); int main() { return 0; }
-
Hello everyone, I am posting this here because I am not receiving an error to my compiling. The program executes just fine, just not applying the new computer name. Please tell me what you see wrong. I am new and been reading on MSDN's website on how to used this Function correctly. If you have an answer to my question, please explain your answer. It will help me and any other beginner programmer. Here is the code: <code>#include <iostream> #include <windows.h> #include <stdio.h> using namespace std; // Set Local Computer Name BOOL WINAPI SetComputerName( LPCTSTR lpnewcomputername ); int main() { return 0; }
The computer will do everything you ask it to do; it starts at the first line of your main() function and continues until either a return, an exit() or a fatal error is encountered. You should be able to figure it out from there. :(
Luc Pattyn [Forum Guidelines] [My Articles]
Avoiding unwanted divs (as in "articles needing approval") with the help of this FireFox add-in
-
The computer will do everything you ask it to do; it starts at the first line of your main() function and continues until either a return, an exit() or a fatal error is encountered. You should be able to figure it out from there. :(
Luc Pattyn [Forum Guidelines] [My Articles]
Avoiding unwanted divs (as in "articles needing approval") with the help of this FireFox add-in
-
I thought that if I placed the SetComputerName function in int main() That it would be considerd a nested function? And I thought Nested functions are not allowed in int main()? I am confused on this. I feel very stupid for this as well.
Hi, I can conclude that you are a beginner and this is your first attempt at any programming language. Hence my advice: go to the book store, look at some books, buy the one book that looks most interesting, and study it; in one or two weeks it will teach you all the basics in a systematic way; and you will learn much more than you can discover by yourself, by experimenting and asking random questions. :)
Luc Pattyn [Forum Guidelines] [My Articles]
Avoiding unwanted divs (as in "articles needing approval") with the help of this FireFox add-in
-
Hi, I can conclude that you are a beginner and this is your first attempt at any programming language. Hence my advice: go to the book store, look at some books, buy the one book that looks most interesting, and study it; in one or two weeks it will teach you all the basics in a systematic way; and you will learn much more than you can discover by yourself, by experimenting and asking random questions. :)
Luc Pattyn [Forum Guidelines] [My Articles]
Avoiding unwanted divs (as in "articles needing approval") with the help of this FireFox add-in
Thank you for the advice. I will do so when I get back from Iraq. : \ Now I ran back to my room to try and re-compile this and I changed it to the following: I still do not recieve any errors. Yet after I reboot the computer name is still the same. I am doing my best to understand.
#include <iostream> #include <windows.h> #include <stdio.h> using namespace std; int main() { BOOL WINAPI SetComputerName( LPCTSTR lpnewcomputername); }
-
Thank you for the advice. I will do so when I get back from Iraq. : \ Now I ran back to my room to try and re-compile this and I changed it to the following: I still do not recieve any errors. Yet after I reboot the computer name is still the same. I am doing my best to understand.
#include <iostream> #include <windows.h> #include <stdio.h> using namespace std; int main() { BOOL WINAPI SetComputerName( LPCTSTR lpnewcomputername); }
Hi, I do not plan on writing a C tutorial, however there are three things to functions: 1. you can declare them, i.e. explain how they look, what their parameters and result are. That is what
int square(int val);
does. Declaring a function is not always necessary. 2. you can define them, i.e. provide an implementation, that is code that actually does the job. example: int square(int val) { return val*val; } Note the brackets. Defining a function is necessary, unless you have a library (i.e. a collection of function definitions somewhere). 3. you can call them, i.e. cause them to be executed. example:c = square(123);
If you need more, for starters look for a tutorial on the web. A simple google will find many, such as this one[^] :)Luc Pattyn [Forum Guidelines] [My Articles]
Avoiding unwanted divs (as in "articles needing approval") with the help of this FireFox add-in
-
Hi, I do not plan on writing a C tutorial, however there are three things to functions: 1. you can declare them, i.e. explain how they look, what their parameters and result are. That is what
int square(int val);
does. Declaring a function is not always necessary. 2. you can define them, i.e. provide an implementation, that is code that actually does the job. example: int square(int val) { return val*val; } Note the brackets. Defining a function is necessary, unless you have a library (i.e. a collection of function definitions somewhere). 3. you can call them, i.e. cause them to be executed. example:c = square(123);
If you need more, for starters look for a tutorial on the web. A simple google will find many, such as this one[^] :)Luc Pattyn [Forum Guidelines] [My Articles]
Avoiding unwanted divs (as in "articles needing approval") with the help of this FireFox add-in
-
You're welcome. And good luck with it. :)
Luc Pattyn [Forum Guidelines] [My Articles]
Avoiding unwanted divs (as in "articles needing approval") with the help of this FireFox add-in
-
Hello everyone, I am posting this here because I am not receiving an error to my compiling. The program executes just fine, just not applying the new computer name. Please tell me what you see wrong. I am new and been reading on MSDN's website on how to used this Function correctly. If you have an answer to my question, please explain your answer. It will help me and any other beginner programmer. Here is the code: <code>#include <iostream> #include <windows.h> #include <stdio.h> using namespace std; // Set Local Computer Name BOOL WINAPI SetComputerName( LPCTSTR lpnewcomputername ); int main() { return 0; }