Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
How do i display a custom message on all the pc`s connected via lan to a single network.
Posted 31-May-12 1:53am
Comments
Björn Ranft at 31-May-12 7:14am
   
You mean something like net send "message" in 2000,xp or msg.exe in windows 7?
gaurish thakkar at 31-May-12 9:36am
   
yup ..in win xp

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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:
-
NetServerEnum
-
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
WTSOpenServer
2) Get the handle of active console session id by calling
WTSGetActiveConsoleSessionId
3) Send message to appropriate server and console session with help of
WTSSendMessage
method.
 
Thats all.
Good luck.
  Permalink  
v2
Comments
Sandeep Mewara at 31-May-12 12:08pm
   
5!
gaurish thakkar at 1-Jun-12 0:43am
   
WTSGetActiveConsoleSessionId
WTSSendMessage can you please give me example ...of these functions in c#
gaurish thakkar at 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 at 1-Jun-12 2:07am
   
and thanks very much .....
Oleksandr Kulchytskyi at 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.
gaurish thakkar at 1-Jun-12 4:19am
   
ok thanks for all the details....:)

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

  Print Answers RSS
0 OriginalGriff 341
1 Marcin Kozub 225
2 Praneet Nadkar 197
3 Sergey Alexandrovich Kryukov 190
4 Shweta N Mishra 161
0 OriginalGriff 8,149
1 Sergey Alexandrovich Kryukov 7,287
2 DamithSL 5,614
3 Manas Bhardwaj 4,986
4 Maciej Los 4,910


Advertise | Privacy | Mobile
Web04 | 2.8.1411023.1 | Last Updated 31 May 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100