procedure TForm1.Button7Click(Sender: TObject);
var
s:array[0..255]of char;
size:Cardinal;begin
for size:=0 to 255 do
s[size]:=#0;
size := 257;
GetComputerName(s,size);
caption:=s;end;project->import type lib...
或CreateOleObject 请大家去 http://www.new7wonders.com/c/voting.php 投长城一票
var
s:array[0..255]of char;
size:Cardinal;begin
for size:=0 to 255 do
s[size]:=#0;
size := 257;
GetComputerName(s,size);
caption:=s;end;project->import type lib...
或CreateOleObject 请大家去 http://www.new7wonders.com/c/voting.php 投长城一票
解决方案 »
- 我有个问题想请问一下各位..
- 一个移动控件位置的问题
- 很麻烦得关于自定义打印得问题,请接触过的高手进来看看?
- 请教大家类定义的问题?
- dbgrideh中,字段的displayformat属性能直接将小数转成百分比吗?
- 如何在窗体加载全部完成后运行某个函数?onCreate OnShow Onactive OnPaint d都不行
- 哪儿有支持热区选择的控件下载?
- Delphi中怎样取得EAX,EBX等寄存器的值?
- 通知栏中如何添加图标?
- 请教大家一个操作第三方程序的问题,谢谢。
- 在win2000下如何調用winapi實現關機﹖﹖﹖
- Delphi 7.0!!非常着急想要Delphi 7.0!!如何设置蚂蚁才能支持FTP代理?
dll文件的引用老鬼讲的方法可以的。产生tlb好像是必然的吧。
unit djcvt;interface
uses Windows;
function PcmtoWave(PcmFileName:Pchar;WaveFileName:Pchar):Integer; stdcall; far external 'djcvt.dll';
implementationend.
ApI:delphi自身已经集成了API函数,只要use相应的单元,就可以直接使用了。
var
ComputerName: array[0..MAX_COMPUTERNAME_LENGTH+1] of char; // holds the name
Size: Integer; // holds the size
begin
{initialize the computer name size variable}
Size := MAX_COMPUTERNAME_LENGTH+1; {retrieve the computer name}
if GetComputerName(ComputerName, Size) then Edit1.Text := StrPas(Computername)
else Showmessage('Computer Name Not Found');
end;procedure TForm1.Button2Click(Sender: TObject);
var
ComputerName: array[0..MAX_COMPUTERNAME_LENGTH+1] of char; // holds the name
begin
{copy the specified name to the ComputerName buffer}
StrPCopy(ComputerName, Edit1.Text); {set the computer name}
if SetComputerName(ComputerName) then ShowMessage('Computer Name Reset Setting will be used at next startup')
else ShowMessage('Computer Name Not Reset');
end;
Function sndPlaySoundA(lpszSound:LPCSTR ;fuSound:UINT):Boolean stdcall; external 'winmm.dll';