Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

GetComputerName in Kernel32.dll


2 replies to this topic

Thomas Erdmann

Thomas Erdmann
  • Members
  • 5 posts

Posted 31 May 2002 - 12:56

Hello,

it exist a function in the KERNEL32.dll calls "GetComputerName" and I started with that:

prototype POINTER kernel32.GetComputerName(BYREF STRING, NUMBER);

And for using:

string szString;
NUMBER nvReturn, nSize;

begin

UseDLL ("kernel32.dll");
nSize = 16;
nvReturn = GetComputerName(szString,nSize);

end;

But I always get a error and it is closing the setup, even I'm debugging but that doesnt matter...

It is saying: function ... terminated - closing Setup..

I was trying to use a other function in the same DLL and that was ok, it works, but that function I need doesnt work..

Can someone help me again or maybe the function is working by you?

thx forward..

Thomas

DJoyner

DJoyner
  • Members
  • 4 posts

Posted 12 June 2002 - 17:12

try:

prototype BOOL KERNEL32.GetComputerName ( BYREF STRING, BYREF NUMBER );

ensure a  larger buffer (I use 101)

Remove UseDLL ("kernel32.dll");

Thomas Erdmann

Thomas Erdmann
  • Members
  • 5 posts

Posted 13 June 2002 - 09:17

Ohhhh thanks...

yes now it works fine... I think my problem was the size of the buffer... 101 is perfect..

cu

Thomas