|
-
April 28th, 2004, 07:07 AM
#1
Net Send
Hello.
i use the system("net send ...") as a messager service...but they show from where the message came...how can i cut that out
?
-
April 28th, 2004, 07:47 AM
#2
Use NetMessageBufferSend net API call and pass an empty string as the fromname (3rd) param.
HTH,
Toot
Some cause happiness wherever they go; others, whenever they go.
-
April 28th, 2004, 03:28 PM
#3
here is code :
char adrip[]="192.168.0.2";
char message[]="salut";
NetMessageBufferSend((LPCWSTR)adrip, (LPCWSTR)message, NULL, (LPBYTE)message, strlen(message));
and when i use it it...does nothing...did i forget something?
Last edited by Quell; April 28th, 2004 at 07:18 PM.
-
April 28th, 2004, 07:47 PM
#4
eh..in addition, i need this to work in console..i got several example of this in mfc and w32api....
but i need this in console...
here is the code i have...but it does nothing...
#include <iostream>
#include <windows.h>
#include <lm.h>
using namespace std;
int main(int argc, char *argv[])
{
char adrip[]="64.229.144.132";
char message[]="test";
NetMessageBufferSend((LPCWSTR)adrip, (LPCWSTR)message, NULL, (LPBYTE)message, strlen(message));
system("pause");
return 0;
}
thx in advance
-
April 28th, 2004, 09:36 PM
#5
Originally posted by Quell
eh..in addition, i need this to work in console..i got several example of this in mfc and w32api....
but i need this in console...
here is the code i have...but it does nothing...
#include <iostream>
#include <windows.h>
#include <lm.h>
using namespace std;
int main(int argc, char *argv[])
{
char adrip[]="64.229.144.132";
char message[]="test";
NetMessageBufferSend((LPCWSTR)adrip, (LPCWSTR)message, NULL, (LPBYTE)message, strlen(message));
system("pause");
return 0;
}
thx in advance
Salut,
How about your error in the previous post ? Did you solve it or you post this code for us to check and give you the whole answer ?
How about netapi32 linking problem ?
You can search the net for "NetMessageBufferSend@20", i dont know if you did that, give it a try if not.
Fiona
-
April 29th, 2004, 03:37 AM
#6
Firstly, you've done an unsafe type cast on your IP address string and your message string. You can't just cast from a char* to a wchar_t* (LPCWSTR). If you're in COM-world, just use the ATL A2CW() macro (see string conversion macros in MSDN). If you're just a small console app, which it sounds like you might be, you'll need to look at MultiByteToWideChar API and its friends.
Secondly, it doesn't look like you can put any old string in the "From", however given correct permissions you can make it look like the message came from the receiving machine (for example), or you could have a "message" server that processes the netsend messages:
Code:
LPCWSTR wszTo = L"machine";
NET_API_STATUS stat = ::NetMessageBufferSend(wszTo, wszTo, NULL, (BYTE*)L"Hello", 6 * sizeof(wchar_t));
if (stat != NERR_Success)
{
wcerr << L"ERROR: " << stat;
}
(not meant to be pretty but you should get the idea)
HTH,
Toot
Some cause happiness wherever they go; others, whenever they go.
-
April 29th, 2004, 06:57 AM
#7
yes, i corrected the .lib problem and that took care of te error...and yes, it is supoused to be nothing in the from filed...i want it to be anonymous yet....
so yo think the problem is in the conversions?
ok..i will try that
Edit:
I tried the
LPCWSTR wstrAdress=A2CW(adrip);
but the A2CW is undefined...isn't it just for MFC and ATL?
cuz i am using DEc-cpp....
Last edited by Quell; April 29th, 2004 at 07:03 AM.
-
May 3rd, 2004, 10:14 AM
#8
Hey, i got the funciton done, and it workes, but it sends only over the inter net, i need it to be
able to send over lan...any ideas?
-
May 4th, 2004, 01:22 PM
#9
I've posted an example of this before using mailslots. You basically just need to write to the correct mail slot on the target machine.
-
May 15th, 2004, 10:42 AM
#10
Could you post the working version?
Could anyone post a working version of the above,including sending messages in a LAN,or at least in a LAN knowing only the IPs....
Thank you in advanced.
-
May 15th, 2004, 02:45 PM
#11
-
May 15th, 2004, 04:33 PM
#12
ok , what is mailslot and how do i use it?
-
June 11th, 2004, 05:07 PM
#13
getting info from windows messenger popup window
I'm writing a VB6 net send GUI that works like msn messengers chat window. The only problem is that I can't figure out a way to get the data from the popup window into my GUI's display. I know that messenger uses mailslots, but I'm not sure how to use VB to access the correct mailslot to retrieve the data for the current message. Anyone have suggestions??
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|