|
Платные хостинги
Раскрутка сайта
Книги по программированию
Изменить имя компа, Изменить имя компа
- Попробуй следующее:var NName,Name:array [0..MAX_COMPUTERNAME_LENGTH] of char; i:DWORD; b:boolean;begin NName:='none'; b:=false; i:=SizeOf(Name); b:=GetComputerName(Name, i); if b then begin ShowMEssage(Name + ' будет заменено на ' + NName); b:=false; b:=SetComputerName(NName); if b then ShowMessage('Всё прошло довольно гладко!!!'); end;end;
- А как сделать, чтобы в tedit написать имя и при нажатие на кнопку оно сменилось? Я пробовал не чё неполучаеться, несовместимость типов...
- SetComputerName(PChar(Edit1.text));
- Спасиб а как написать имя? Например в tedit или label? Блин всё время несовместимость типов или того... У тебя есть руководство насчёт типов, например что значит pchar? Это сообщение отредактировал Vco - 17.2.2003, 00:36
- PChar - массив символов, как и строка, следовательно можно попробовать как с обычными массивами, т. е. копировать элементы одного в другой
- Нашёл в Helpе по Delphi, но епреводить нет времени:Sets the contents and length of the given string.UnitSystemCategorystring handling routinesprocedure SetString(var s: string; buffer: PChar; len: Integer);DescriptionThe SetString standard procedure sets the contents and length of the given string variable to the block of characters given by the Buffer and Len parameters.For a short string variable, SetString sets the length indicator character (the character at S[0]) to the value given by Len and then, if the Buffer parameter is not nil, copies Len characters from Buffer into the string starting at S[1]. For a short string variable, the Len parameter must be a value between 0 and 255.For a long string variable, SetString sets S to reference a newly allocated string of the given length. If the Buffer parameter is not nil, SetString then copies Len characters from Buffer into the string; otherwise, the contents of the new string is left uninitialized. If there is not enough memory available to create the string, an EOutOfMemory exception is raised. Following a call to SetString, S is guaranteed to reference a unique string, that is a string with a reference count of one.
- i:DWORD;p:PChar;...i:=255;GetMem(p, i);GetComputerName(p, i);Edit1.text:=String(p);FreeMem(p);
- По поводу изменения типа PChar в String:function PCharToStr(const Text:PChar):string;begin Result:=StrPas(Text);end;
Интернет казино
Онлайн игры
Увеличение члена
Купить DVD
|