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

WindowsAPI call from InstallShield


3 replies to this topic

Vico

Vico
  • Members
  • 4 posts

Posted 06 November 2001 - 11:25

I want to call an WindowsAPI function from InstallShield.
How can I call the GetUserName
WinAPI function?

Vico

Vico
  • Members
  • 4 posts

Posted 06 November 2001 - 14:19

Hi There.

I have solved the problem :)))

To call the Windows API From IS:
**********************************************
// your DLL function prototypes (AT the top of the setup.rul)
prototype LONG advapi32.GetUserNameA(BYREF STRING, BYREF LONG);


//To use the function above (GetUserNameA)
STRING svUserName;
LONG nvLength, nvResult;
nvLength = 256;

nvResult = GetUserNameA(svUserName, nvLength);
MessageBox(svUserName, SEVERE);
****************************************************

The above works for all OS.

/Vico



Vico

Vico
  • Members
  • 4 posts

Posted 09 November 2001 - 11:49

Hello Again.

Here is a better API function to get information about
CurrentUser, Domain, PrfileString,  SystemDrive,
SystemRoot, CurrentOs and more...

***********************************************************
//At the top of the
prototype LONG   kernel32.GetEnvironmentVariable(BYVAL STRING, BYREF STRING, BYREF LONG);


//Calling the API Function.
STRING szUserProfile;
LONG nvLength;
nvLength = 256;
nvResult = GetEnvironmentVariable("Userprofile",
szUserProfile, nvLength);
MessageBox(szUserProfile, SEVERE);

***********************************************************




Lucky

Lucky
  • Members
  • 119 posts

Posted 09 November 2001 - 13:16

Thanks for the hint!