Posted By: Toon
How can i get the system's name? (computer-name) - 05/05/12 22:01
What is the easiest way to get the system's name / computer-name?
STRING* comp = "#128"; GetComputerName(comp);
STRING *comp; void getComputerName() { char buffer[MAX_COMPUTERNAME_LENGTH + 1]; long size = MAX_COMPUTERNAME_LENGTH + 1; memset(buffer, 0, size); if(GetComputerName(buffer, &size)) { str_cpy(comp, buffer); } else { str_cpy(comp, "Couldn't get the computer name"); } }
#include <acknex.h> #include <windows.h> #include <default.c> STRING *comp; void getComputerName() { char buffer [MAX_COMPUTERNAME_LENGTH + 1]; long size = MAX_COMPUTERNAME_LENGTH + 1; memset(buffer, 0, size); if(GetComputerName(buffer, &size)) { str_cpy(comp, buffer); } else { str_cpy(comp, "Couldn't get the computer name"); } error(comp); } void main() { while(!key_enter){wait(1);} getComputerName(); }
#define MAX_COMPUTERNAME_LENGTH 32
char buffer [32]; long size = 32;
#include <acknex.h> #include <windows.h> STRING* comp = "#128"; void getComputerName() { char buffer [128]; long size = 128; memset(buffer, 0, size); if(GetComputerName(buffer, &size)) { str_cpy(comp, buffer); } else { str_cpy(comp, "Couldn't get the computer name"); } error(comp); } void main() { getComputerName(); }