I try to test the Win API function: NetMessageBufferSend
I wrote a Visual C++ console program. This program calls
the NetMessageBufferSend to send a message to my own
machine ( similar to "net send * Test" ). But I can not
run this program. I can compile this program.
But I can not link this program. The error I get is:
Q1 error LNK2019: unresolved external symbol
_NetMessageBufferSend@20 referenced in
function _main
Q1 fatal error LNK1120: 1 unresolved externals
The program is as follows:
========================================
#include "stdafx.h"
#include <Windows.h>
#include <Lm.h>
int _tmain( int argc, _TCHAR* argv[] ) {
BYTE A[100] = "Test";
NetMessageBufferSend( NULL,
NULL,
NULL,
A,
100 );
return 0; }
========================================
The MSDN online help for NetMessageBufferSend
is as follows:
========================================
Requirements:
Windows NT/2000 or later: Requires Windows NT
3.1 or later.
Windows 95/98/Me: Unsupported.
Header: Declared in Lmmsg.h; include Lm.h.
Library: Use Netapi32.lib.
========================================
Looks like I have to link the library Netapi32.lib.
But I really don't know how to link a library.
Any help is appreciated.