Click here to Skip to main content
15,867,330 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
How do i display a custom message on all the pc`s connected via lan to a single network.
Posted
Comments
El_Codero 31-May-12 7:14am    
You mean something like net send "message" in 2000,xp or msg.exe in windows 7?
gaurish thakkar 31-May-12 9:36am    
yup ..in win xp

1 solution

Hi, first of all this feature can be reachable in .NET with help of P\Invoke and WinApi.
General worfkflow process can be divided on the 2 stages:
1) Retrieving all pc's connected via lan to a single network.
2) Sending to each pc appropriate message.

First part of workflow can be feasible by using WinApi methods from native Netapi32.dll by calling such methods as:
-
C++
NetServerEnum

-
C++
NetApiBufferFree

And structure from this library called _SERVER_INFO_100

Second stage will consists from following steps(calling methods from wtsapi32.dll):
1) Get the handle of remote server by calling
C++
WTSOpenServer

2) Get the handle of active console session id by calling
C++
WTSGetActiveConsoleSessionId

3) Send message to appropriate server and console session with help of
C++
WTSSendMessage
method.

Thats all.
Good luck.
 
Share this answer
 
v2
Comments
Sandeep Mewara 31-May-12 12:08pm    
5!
gaurish thakkar 1-Jun-12 0:43am    
WTSGetActiveConsoleSessionId
WTSSendMessage can you please give me example ...of these functions in c#
gaurish thakkar 1-Jun-12 2:06am    
i tried calling the WTSSendMessage functon but the message gets displayed on my pc....i was actually tryg to display it on one single pc so i used the WTSOpenServer function but the handle returned is 0 but if i pass the name of my pc to this function i get a valid handle .
gaurish thakkar 1-Jun-12 2:07am    
and thanks very much .....
Oleksandr Kulchytskyi 1-Jun-12 3:16am    
Well, it seems like your remote machine doesn't have ability to connect remotely via rdc. try to handle such issue by settings appropriate settings to rdc.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900