🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #453

Re: using WTSGetActiveConsoleSessionId()

#453
From: Ed Mulroy [TeamB]
Date: Thu, 17 Apr 2008 13:43
41 lines
2721 bytes
Go to the compiler's LIB directory and give this command

    tlib /C import32.LIB , import32.LST

The list of exported items provided by import32.lib will be found in the 
list file.  Pull the list file up in the editor.  Verify that among those 
items is WTSGetActiveConsoleSessionId and that it is listed as being 
provided by kernel32.dll, a Windows DLL.

It is possible that an option setting in the IDE could alter the expected 
public name for WTSGetActiveConsoleSessionId.  Try using tdump on the object 
file and looking at the exact text for WTSGetActiveConsoleSessionId.  If it 
has added leading or trailing characters or the case is different then it 
will not match.  The solution is to restore the IDE options because 
different naming implies different calling conventions, something which can 
cause the program to fail.

If the symbol is correct you could try to provide your own import library.

Go to the command line and change to the project directory.
Give this command:
    implib -c  kernel32.LIB  c:\windows\system32\kernel32.DLL
Go back into the IDE and add kernel32.lib to the project file.

.  Ed

> Mike Collins wrote in message
> news:48074a72@newsgroups.borland.com...
>
> Hay guys, hope everyone is well.
>
> Can anyone point me in the right direction here.  I'm trying to launch an 
> application on the active users desktop from a service.
>
> I'm looking at a code snippet from MSDN that uses WTSQueryUserToken / 
> WTSGetActiveConsoleSessionId to determine the active UI session. Problem 
> is that the compiler keeps telling me that WTSGetActiveConsoleSessionId() 
> is an  undefined function.  It's declared in winbase.h and i've included 
> both  windows.h and winbase.h but to no avail.
>
> I'm using BCB 6 Enterprise...
Technical Details
Message-ID: <48075419$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.germany.com!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <48074a72@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,61b1edc79d66af39
X-Google-Attributes: gid10cc67,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Ed Mulroy [TeamB]" <dont_email_me@bitbuc.ket>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <48074a72@newsgroups.borland.com>
Subject: Re: using WTSGetActiveConsoleSessionId()
Date: Thu, 17 Apr 2008 09:43:51 -0400
Lines: 43
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: 71.77.48.179
Message-ID: <48075419$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1208439833 71.77.48.179 (17 Apr 2008 06:43:53 -0700)
X-Authenticated-User: edmulroy
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.germany.com!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail