This is my first attempt at using the Terminal Services API, and I'm
stumped. I can't get WTSOpenServer to work for the life of me (this is
in VS2005, by the way). Specifically, the argument has me baffled.
It's my understanding that it wants a LPWSTR (at least on this machine,
where UNICODE is defined). My first attempt was:
HANDLE hnd = WTSOpenServer(" asdf");
Which yielded:
error C2664: 'WTSOpenServerW ' : cannot convert parameter 1 from 'const
char [5]' to 'LPWSTR'
Fine. So I tried:
HANDLE hnd = WTSOpenServer(A 2T("asdf"));
Which pukes up:
error LNK2028: unresolved token (0A000415) "extern "C" void * __stdcall
WTSOpenServerW( wchar_t *)" (?WTSOpenServer W@@$$J14YGPAXPA _W@Z)
referenced in function "private: void __clrcall
test::Form1::Fo rm1_Load(class System::Object ^,class System::EventAr gs
^)"
(?Form1_Load@Fo rm1@test@@$$FA$ AAMXP$AAVObject @System@@P$AAVE ventArgs@4@@Z)
test.obj
error LNK2019: unresolved external symbol "extern "C" void * __stdcall
WTSOpenServerW( wchar_t *)" (?WTSOpenServer W@@$$J14YGPAXPA _W@Z)
referenced in function "private: void __clrcall
test::Form1::Fo rm1_Load(class System::Object ^,class System::EventAr gs
^)"
(?Form1_Load@Fo rm1@test@@$$FA$ AAMXP$AAVObject @System@@P$AAVE ventArgs@4@@Z)
test.obj
HANDLE hnd = WTSOpenServer(A 2W("asdf")); gave the same results.
Can anyone tell me what on earth I'm doing wrong? I've been googling
for days, and I'm sure it can't be this difficult. Any help is
appreciated. And if I'm in the wrong group, please accept my
apologies.
Adam 3 3569
"Adam" <ad**********@g mail.comwrote in message
news:11******** *************@j 72g2000cwa.goog legroups.com...
This is my first attempt at using the Terminal Services API, and I'm
stumped. I can't get WTSOpenServer to work for the life of me (this is
in VS2005, by the way). Specifically, the argument has me baffled.
It's my understanding that it wants a LPWSTR (at least on this machine,
where UNICODE is defined). My first attempt was:
HANDLE hnd = WTSOpenServer(" asdf");
Which yielded:
error C2664: 'WTSOpenServerW ' : cannot convert parameter 1 from 'const
char [5]' to 'LPWSTR'
Fine. So I tried:
HANDLE hnd = WTSOpenServer(A 2T("asdf"));
Which pukes up:
error LNK2028: unresolved token (0A000415) "extern "C" void * __stdcall
WTSOpenServerW( wchar_t *)" (?WTSOpenServer W@@$$J14YGPAXPA _W@Z)
referenced in function "private: void __clrcall
test::Form1::Fo rm1_Load(class System::Object ^,class System::EventAr gs
^)"
(?Form1_Load@Fo rm1@test@@$$FA$ AAMXP$AAVObject @System@@P$AAVE ventArgs@4@@Z)
test.obj
error LNK2019: unresolved external symbol "extern "C" void * __stdcall
WTSOpenServerW( wchar_t *)" (?WTSOpenServer W@@$$J14YGPAXPA _W@Z)
referenced in function "private: void __clrcall
test::Form1::Fo rm1_Load(class System::Object ^,class System::EventAr gs
^)"
(?Form1_Load@Fo rm1@test@@$$FA$ AAMXP$AAVObject @System@@P$AAVE ventArgs@4@@Z)
test.obj
HANDLE hnd = WTSOpenServer(A 2W("asdf")); gave the same results.
Can anyone tell me what on earth I'm doing wrong? I've been googling
for days, and I'm sure it can't be this difficult. Any help is
appreciated. And if I'm in the wrong group, please accept my
apologies.
Adam
..... WTSOpenServer(L "asdf");
Willy.
Can anyone tell me what on earth I'm doing wrong? I've been googling
for days, and I'm sure it can't be this difficult. Any help is
appreciated. And if I'm in the wrong group, please accept my
apologies.
As Willy says, you can directly use L"string" to get a unicode string
literal, no point in converting from ANSI at runtime.
But your linker error will only be resolved when you add WtsApi32.lib to
your project properties under "Linker -Inputs".
See the doc page: http://msdn.microsoft.com/library/de...openserver.asp
The Requirements section clearly shows the header file and import library
needed.
>
Adam
Yes, that was the problem - I had neglected to include the .lib. Thank
you. I feel like an idiot.
Adam
Ben Voigt wrote:
Can anyone tell me what on earth I'm doing wrong? I've been googling
for days, and I'm sure it can't be this difficult. Any help is
appreciated. And if I'm in the wrong group, please accept my
apologies.
As Willy says, you can directly use L"string" to get a unicode string
literal, no point in converting from ANSI at runtime.
But your linker error will only be resolved when you add WtsApi32.lib to
your project properties under "Linker -Inputs".
See the doc page: http://msdn.microsoft.com/library/de...openserver.asp
The Requirements section clearly shows the header file and import library
needed.
Adam
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Eugene Safrankow |
last post by:
Hello All!
I've encountered with the error when I call a method of dependency
library (written in managed VC++) from Smart Client placed on a web
page. In general, I make a call to the Windows function and I get from
GetLastError – "<127> The specified procedure could not be found"
error.
Below is more detailed information about the problem.
|
by: Paul |
last post by:
Hi all
may I know how to use C# DLL inside my VC++ Project ?
Thanks in advance.
|
by: Christopher Attard |
last post by:
Hi,
I'm using WTSOpenServer (P/Invoke in a C# application) to open a
handle to a specified terminal server which is Win2003 Server Domain
Controller.
The function is returning NULL (or 0). I'm able to connect
successfully to the terminal server when using the remote desktop program
from a WinXP client machine.
Any ideas or suggestions pls?
|
by: Al |
last post by:
Could anybody point me to some resource about how to call a VB.net DLL in
VC.net?
Thanks in advance.
Al
|
by: Robert Ludewig |
last post by:
I have sucessfully imported and compiled a complex MFC 6.0 project from
vc++6.0 (MFC6.0) into vc++ 8.0 (MFC 8.0). It contains several
subprojects (libs and dlls). In vc++ 6.0 those project linked MFC6.0
statically and after I imported it to vc++ 8.0 I set the linkage of
MFC8.0 to "shared". However when I try to compile and link the project
in vc++ 8.0 in release mode (debugmode works fine) I get an acess
violation in afxcomctl32.inl. This...
| |
by: Mads Westen |
last post by:
Hi,
I want to create a "dynamic" unmanaged VC++ wrapper that can call any C#
DLL.
I'm thinking that I call the the wrapper from another program like this:
dllcall(name_of_wrapper_function , name_of_C#function_parms_to_be_handled)
First off I want to know if my idea is possible, but a simple example would
be nice. :)
|
by: Manu |
last post by:
Hi,
To get the USERNAME of all process running in local/remote system I am
using the WTSOpenServer and WTSEnumerateProcesses API's but when I invoke
the WTSOpenServer in Windows 200 Professional it s returning 1722(The RPC
server is unavailable.) error, but the same program is working fine in
Windows 2000 Advance Sever and Windows 2003.
|
by: fiefie.niles |
last post by:
We have a C++ DLL that we call from VB6 program.
This is how we declare the DLL in VB6:
Declare Function RefSearch Lib "csearch32.dll" (ByVal path As String,
ByVal findword As String, ByVal CaseSensitive As Integer) As Integer
This is how we call the DLL in VB6:
hit = RefSearch(path, SearchStr1, ChkValue)
Can I call this DLL in ASP and how ?
Thank you.
|
by: Josemi |
last post by:
Hi!,
I've got a great problem, and I don't have any idea how can I to
solve it. I hope that there is a solution to solve it :-). Well. I've
got an App UNICODE that call a routine in a dll MBCS:
App UNICODE
CString dir;
bDameValorINI (dir, "Directorios", "Ejecutables", "C:\", true);
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |