Jump to content

Recommended Posts

Posted (edited)

After a lot of trial and error, I came up with this function, to send network messages

without the need of an outside program like net.exe.

The messenger service must be enabled for this to work on windows. This functions is

based on API Dllcalls, like CreateFile and WriteFile.

The GUI is the simplest as possible, the real gold here is the function. Took a lot of time

to make it work.

Hope it's useful to someone. :whistle:

Here's the code:

#NoTrayIcon
#include <GUIConstants.au3>

GUICreate("NetSend", 200, 160, -1, -1)
GUICtrlCreateLabel("Receiver:", 10, 13, 50, 15)
$ReceiverComputer = GUICtrlCreateInput("", 60, 10, 130, 20)
GUICtrlCreateLabel("Message:", 10, 38, 50, 15)
$Message = GUICtrlCreateInput("", 60, 35, 130, 20)
GUICtrlCreateLabel("From:", 10, 68, 50, 15)
$Sender = GUICtrlCreateInput(@ComputerName, 60, 65, 130, 20)
GUICtrlCreateLabel("To:", 10, 93, 50, 15)
$ReceiverName = GUICtrlCreateInput("", 60, 90, 130, 20)
$OK = GUICtrlCreateButton("Send", 10, 120, 180, 30)
GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $OK
            $Send = NetSend(GUICtrlRead($ReceiverComputer), GUICtrlRead($Message), GUICtrlRead($Sender), GUICtrlRead($ReceiverName))
            If $Send = 0 Then
                MsgBox(16, "NetSend", "Error! The message could not be sent!")
            EndIf
    EndSwitch
WEnd


;===============================================================================
;
; Description:      NetSend
; Parameter(s):     $szReceiverComputer - Name of the target computer. * for all.
;                   $szMessage - The text to be sent. Can contain line breaks
;                                and tabs.
;                   $szSender - Optional. Name of the sender.
;                   $szReceiverName - Optional. Name of the target that appears
;                                     in the message.
; Requirement:      AutoIt Beta
; Return Value(s):  Returns 1 if message was successfully sent.
;                       Return 0 if message was not sent.
; Author(s):        CoePSX (coepsx at yahoo dot com dot br)
; Note(s):          None.
;
;===============================================================================
Func NetSend($szReceiverComputer, $szMessage, $szSender = "", $szReceiverName = "")
    Local Const $GENERIC_WRITE = 0x40000000
    Local Const $FILE_SHARE_READ = 0x00000001
    Local Const $OPEN_EXISTING = 0x00000003
    Local Const $FILE_ATTRIBUTE_NORMAL = 0x00000080
    Dim $szAscConvert[256]
    $szAscConvert[131] = 159
    $szAscConvert[160] = 255
    $szAscConvert[161] = 173
    $szAscConvert[162] = 189
    $szAscConvert[163] = 156
    $szAscConvert[164] = 207
    $szAscConvert[165] = 190
    $szAscConvert[166] = 254
    $szAscConvert[167] = 245
    $szAscConvert[168] = 249
    $szAscConvert[169] = 184
    $szAscConvert[170] = 166
    $szAscConvert[171] = 174
    $szAscConvert[172] = 170
    $szAscConvert[173] = 240
    $szAscConvert[174] = 169
    $szAscConvert[175] = 238
    $szAscConvert[176] = 248
    $szAscConvert[177] = 241
    $szAscConvert[178] = 253
    $szAscConvert[179] = 252
    $szAscConvert[180] = 239
    $szAscConvert[181] = 230
    $szAscConvert[182] = 244
    $szAscConvert[183] = 250
    $szAscConvert[184] = 247
    $szAscConvert[185] = 251
    $szAscConvert[186] = 167
    $szAscConvert[187] = 175
    $szAscConvert[188] = 172
    $szAscConvert[189] = 171
    $szAscConvert[190] = 243
    $szAscConvert[191] = 168
    $szAscConvert[192] = 183
    $szAscConvert[193] = 181
    $szAscConvert[194] = 182
    $szAscConvert[195] = 199
    $szAscConvert[196] = 142
    $szAscConvert[197] = 143
    $szAscConvert[198] = 146
    $szAscConvert[199] = 128
    $szAscConvert[200] = 212
    $szAscConvert[201] = 144
    $szAscConvert[202] = 210
    $szAscConvert[203] = 211
    $szAscConvert[204] = 222
    $szAscConvert[205] = 214
    $szAscConvert[206] = 215
    $szAscConvert[207] = 216
    $szAscConvert[208] = 209
    $szAscConvert[209] = 165
    $szAscConvert[210] = 227
    $szAscConvert[211] = 224
    $szAscConvert[212] = 226
    $szAscConvert[213] = 229
    $szAscConvert[214] = 153
    $szAscConvert[215] = 158
    $szAscConvert[216] = 157
    $szAscConvert[217] = 235
    $szAscConvert[218] = 233
    $szAscConvert[219] = 234
    $szAscConvert[220] = 154
    $szAscConvert[221] = 237
    $szAscConvert[222] = 232
    $szAscConvert[223] = 225
    $szAscConvert[224] = 133
    $szAscConvert[225] = 160
    $szAscConvert[226] = 131
    $szAscConvert[227] = 198
    $szAscConvert[228] = 132
    $szAscConvert[229] = 134
    $szAscConvert[230] = 145
    $szAscConvert[231] = 135
    $szAscConvert[232] = 138
    $szAscConvert[233] = 130
    $szAscConvert[234] = 136
    $szAscConvert[235] = 137
    $szAscConvert[236] = 141
    $szAscConvert[237] = 161
    $szAscConvert[238] = 140
    $szAscConvert[239] = 139
    $szAscConvert[240] = 208
    $szAscConvert[241] = 164
    $szAscConvert[242] = 149
    $szAscConvert[243] = 162
    $szAscConvert[244] = 147
    $szAscConvert[245] = 228
    $szAscConvert[246] = 148
    $szAscConvert[247] = 246
    $szAscConvert[248] = 155
    $szAscConvert[249] = 151
    $szAscConvert[250] = 163
    $szAscConvert[251] = 150
    $szAscConvert[252] = 129
    $szAscConvert[253] = 236
    $szAscConvert[254] = 231
    $szAscConvert[255] = 152

    Local $bRet = 0
    
    Local $pszMailSlot = DllStructCreate("char[" & StringLen("\\" & $szReceiverComputer & "\MAILSLOT\messngr") + 1 & "]")
    DllStructSetData($pszMailSlot, 1, "\\" & $szReceiverComputer & "\MAILSLOT\messngr")
    
    Local $szFinalMessage = $szSender & Chr(0) & $szReceiverName & Chr(0) & $szMessage & Chr(0)
    Local $pucMessage = DllStructCreate("byte[" & StringLen($szFinalMessage) & "]")
    For $i = 1 To StringLen($szFinalMessage)
        Local $szTemp = Asc(StringMid($szFinalMessage, $i, 1))
        If $szAscConvert[$szTemp] <> "" Then
            DllStructSetData($pucMessage, 1, $szAscConvert[$szTemp], $i)
        Else
            DllStructSetData($pucMessage, 1, $szTemp, $i)
        EndIf
    Next
    
    Local $hHandle = DllCall("kernel32.dll", "hwnd", "CreateFile", "ptr", DllStructGetPtr($pszMailSlot), _
                                "int", $GENERIC_WRITE, _
                                "int", $FILE_SHARE_READ, _
                                "ptr", 0, _
                                "int", $OPEN_EXISTING, _
                                "int", $FILE_ATTRIBUTE_NORMAL, _
                                "int", 0)
    $hHandle = $hHandle[0]
    
    If $hHandle Then
        Local $bRet = DllCall("kernel32.dll", "int", "WriteFile", "hwnd", $hHandle, _
                                "ptr", DllStructGetPtr($pucMessage), _
                                "int", DllStructGetSize($pucMessage), _
                                "long_ptr", 0, _
                                "ptr", 0)
        $bRet = $bRet[4]
        
        DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hHandle)
    EndIf
    
    Return $bRet
EndFunc  ;==> NetSend

And the attached script:

NetSend.au3

Edited by CoePSX

[quote name='Valik' post='301213' date='Jan 31 2007, 10:36 PM']You seem to have a habit of putting things in the wrong place. I feel sorry for any female you attempt to have sex with.[/quote][font="Lucida Sans Unicode"][/font]

Posted

What does it use as I have tried DNS and IP.

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Posted

It uses computer name, like John, Server1 or PC1 etc

NetSend(@ComputerName, "Server1", "Hi!")

Is the same as typing "net send Server1 Hi!"

(Doesn't have to be @ComputerName, you can put Frodo

if you want, it'll still work.

[quote name='Valik' post='301213' date='Jan 31 2007, 10:36 PM']You seem to have a habit of putting things in the wrong place. I feel sorry for any female you attempt to have sex with.[/quote][font="Lucida Sans Unicode"][/font]

Posted

It uses computer name, like John, Server1 or PC1 etc

NetSend(@ComputerName, "Server1", "Hi!")

Is the same as typing "net send Server1 Hi!"

(Doesn't have to be @ComputerName, you can put Frodo

if you want, it'll still work.

I will have to test it later - when I am at work, I tried at home and I can get the message on my pc but not another pc - not on the same workgroup - but I would not think that matters. But it looks cool - is there any other service it can run on or port as services are more than not turned off on most pc's to keep out unwanted

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Posted

well done :whistle:

--------------------------------------------------------------------------------------------------------------------------------Scripts : _Encrypt UDF_UniquePCCode UDF MS like calculatorInstall programm *UPDATED* --------------------------------------------------------------------------------------------------------------------------------[quote name='Helge' post='213117' date='Jul 26 2006, 10:22 AM']Have you ever tried surfing the internet with a milk-carton ?This is similar to what you're trying to do.[/quote]

Posted

I solved the ascii problem.

I made a script to send all the characters from 128 to 255, read

from the messenger window and write the code for me.

I got a conversion table to make the message be received properly.

It's in the first post

[quote name='Valik' post='301213' date='Jan 31 2007, 10:36 PM']You seem to have a habit of putting things in the wrong place. I feel sorry for any female you attempt to have sex with.[/quote][font="Lucida Sans Unicode"][/font]

Posted

You're amazing guy !!!!!

i have tried so much to do a thing like this

my net send script is about to be posted (because my firm, and our client support uses it now)

but, i will try to integrate your tool, because of the security issues, it could be really interesting to not allow users to use net send.exe

-- Arck System _ Soon -- Ideas make everything

"La critique est facile, l'art est difficile"

Projects :

[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here [/list]
Posted (edited)

Very nice, :whistle:

When I first read the title I thought you where using TCP functions to send the message.

RK

Edited by rbhkamal

"When the power of love overcomes the love of power, the world will know peace"-Jimi Hendrix

Posted

what a great script, its funny, just this week a friend who was working as a call centre asked me for a program to do just this , it saved me a job Thanks.

Who needs puzzles when we have AutoIt!!

Posted

:whistle: Another little change on the script.

I realized that you could send a message to a computer name, for example: PC2,

and use another name to appear as the recipient. Like:

NetSend ("PC2", "Hi balt guy!", "Neo", "Morpheus")

Message from Neo to Morpheus:

Hi balt guy!

The code is updated in the first post. The GUI example is updated too.

[quote name='Valik' post='301213' date='Jan 31 2007, 10:36 PM']You seem to have a habit of putting things in the wrong place. I feel sorry for any female you attempt to have sex with.[/quote][font="Lucida Sans Unicode"][/font]

Posted

Nice Job!

here's one i wrote a little while back

Dim $un = @UserName
Dim $QT_web = "www.ClickTask.com"
$ver = "1.0"

;delete last listing
Filedelete(@TempDir & "\a.tmp")
Filedelete(@TempDir & "\b.tmp")

; make sure net send is running
RunWait("net start messenger","",@SW_HIDE)

;gets the computer list and a few other things
RunWait(@ComSpec & ' /c net view > ' & @TempDir & '\a.tmp',"", @SW_HIDE)
Sleep(300)
;open the file for working
$file = FileOpen(@TempDir & "\a.tmp", 0)

; Check if file opened for reading OK
If $file = -1 Then
    MsgBox(0, "QT - Error", "Unable to open file.")
    Exit
EndIf

;Creates new file in which the result will be written
FileOpen(@TempDir & "\b.tmp", 1)

; Read in lines of text until the EOF is reached in file a.tmp
While 1
    $line = FileReadLine($file)
    If @error = -1 Then ExitLoop
  ;find the string "\\"
    $result = StringInStr($line,"\\")
      if $result = 1 Then
    ;find next blank
      $blankpos = StringInStr($line," ")
    ;Find length of line
      $len = StringLen($line)
    ;calculate from what position to Trim string to the right
      $len = $len - $blankpos
    ;Trim all characters after the computer name
      $line = StringTrimRight($line, $len)
    ;Trim the //
      $line = StringTrimLeft($line,2)
    ;Write line to file, adding "|"
      FileWrite(@TempDir & "\b.tmp", $line & "|")
      EndIf

Wend

FileClose($file)
FileDelete(@TempDir & "\a.tmp")
$file2 = FileReadline(@TempDir & "\b.tmp", 1)

;install pics
    $Time_Logo = @TempDir & "\Time-logo.jpg"
    FileInstall("C:\XPClean-web\Settings\XPClean-pics\Time.jpg", $Time_Logo)
    $Time_icon = @TempDir & "\Time-Icon.ico"
    FileInstall("C:\XPClean-web\Settings\XPClean-pics\Time-Icon.ico", $Time_icon)
    $Sound_clk = @TempDir & "\Sound_clk.wav"
    FileInstall("C:\XPClean-web\Settings\XPClean-pics\Sounds\Clickerx.wav", $Sound_clk)
    $Sound_grp = @TempDir & "\Sound_grp.wav"
    FileInstall("C:\XPClean-web\Settings\XPClean-pics\Sounds\Group_open.wav", $Sound_grp)
    $Sound_bar = @TempDir & "\Sound_bar.wav"
    FileInstall("C:\XPClean-web\Settings\XPClean-pics\Sounds\xpinfbar.wav", $Sound_bar)
    $Sound_lnk = @TempDir & "\Sound_lnk.wav"
    FileInstall("C:\XPClean-web\Settings\XPClean-pics\Sounds\Notify.wav", $Sound_lnk)


;GUI Start
#include "GUIConstants.au3"
;#include <Process.au3>

;Set GUI
Opt("GUICoordMode", 1)
;Opt("GUINotifyMode", 1)
$Dummy_win = GUICreate('')
$Tmesg_win = GuiCreate("*QTime Station*  -  PC Messenger                                ver " & $ver, 482, 335, -1, -1,-1,$WS_EX_ACCEPTFILES,$Dummy_win);, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)
GUISetFont(9, 400, -1, "MS Sans Serif")
GUISetIcon($Time_icon)
$Icon_1 = GUICtrlCreatePic($Time_Logo, 393, 10, 75, 70)
GUICtrlSetCursor(-1, 0)
GUICtrlSetTip(-1, "ClickTask.com")

$Group_1A = GuiCtrlCreateGroup( "Message from: ", 20, 10, 350, 50)
GUICtrlCreateLabel( $un, 40, 30, 150, 20)



;Create 1 combo box, give focus and populate with contents of b.tmp
$Group_1A = GuiCtrlCreateGroup("Message to: ",20, 70, 350, 50)
$combo_1 = GUICtrlCreateCombo("", 130, 87, 120, 20)
GUICtrlSetState(-1,$GUI_FOCUS)
GUICtrlSetData(-1,$file2)
$label_1 = GUICtrlCreateLabel( "C&hoose the PC", 40, 90, 80, 20)


$Group_4 = GuiCtrlCreateGroup("Last Message Sent", 20, 270, 350, 50)
$MSent = GUICtrlCreateLabel("No Recent Messages", 40, 288, 320, 28)

;Create buttons
$button_1 = GUICtrlCreateButton("S&end", 390, 190, 80, 30)
               GUICtrlSetState(-1,$GUI_DEFBUTTON)
$button_2 = GUICtrlCreateButton("Set-Up", 390, 275, 80, 20)
$button_3 = GUICtrlCreateButton("C&ancel",  390, 300, 80, 20)




;create text input
$Group_3 = GuiCtrlCreateGroup("Message Text", 20, 140, 350, 120)
GUICtrlCreateLabel("Please Type in Your Test Message in the Box Below", 40, 165, 310, 20)
GUICtrlCreateLabel("The Message includes the Time, Date, PC and Sender Name", 40, 185, 320, 20)
$text = GUICtrlCreateInput("Message", 40, 215, 310, 20)

;Show the GUI
GuiSetState (@SW_SHOW)
SoundPlay ($Sound_lnk,1)

;sets tray icon
    opt("TrayMenuMode", 1)  ; Default tray menu items (Script Paused/Exit) will not be shown.
    opt("TrayOnEventMode", 1)
;TraySetClick (16); right click
    
    $show_tray = TrayCreateItem ("Show  *QTime Station*")
    TrayItemSetOnEvent (-1, "Set_Show")
    TrayCreateItem ("")
    $upgrade_tray = TrayCreateItem ("Check New Releases")
    TrayItemSetOnEvent (-1, "Set_Update")
    TrayCreateItem ("")
    $setup_tray = TrayCreateItem ("Net-Send Setup")
    TrayItemSetOnEvent (-1, "Set_Setup")
    TrayCreateItem ("")
    $about_tray = TrayCreateItem ("About ClickTask.com")
    TrayItemSetOnEvent (-1, "Set_QT")
    TrayCreateItem ("")
    $exit_tray = TrayCreateItem ("Exit  *QTime Station*")
    TrayItemSetOnEvent (-1, "Set_Exit")
    
    TraySetState ()

$msg = 0
While 1; $msg <> -3
$msg = GuiGetMsg()
Select
case $msg = $button_3 Or $msg = $GUI_EVENT_CLOSE
    GUISetState(@SW_HIDE, $Tmesg_win)
    SoundPlay ($Sound_grp,1)
case $msg = $button_2
;SoundPlay ($Sound_clk,1)
    Call("Set_Setup")
case $msg = $button_1
    SoundPlay ($Sound_clk,1)
    $CPUID = GuictrlRead($combo_1)
    If $CPUID = "" Then
        MsgBox(64,"Send Error 1"," Please choose a PC to  *Send*  to...      ")
        ContinueLoop
    EndIf
    $msg1 = GuictrlRead($text)
    If $msg1 = "" Or $msg1 = "Message" Then
        MsgBox(64,"Send Error 2"," Please Type a  *Text Message*  First...      " )
        ContinueLoop
    EndIf
    $runvar =RunWait(@comspec & " /c net send " & $CPUID & $un & " says:   " & $msg1,"",@sw_hide)
;MsgBox(0,"",$runvar)
    If $runvar > 0 Then
        MsgBox(64,"Send Error 3"," Your Message   *Could Not Be Sent*       " & @CRLF & @CRLF & " Please press the  *Set-Up*  Button    "  & @CRLF & @CRLF & "and press  *Set-Up*  on " & $CPUID & "  " )
        ContinueLoop
    EndIf
    GUICtrlSetData ( $MSent, $msg1)
    EndSelect
WEnd

Exit

;---------------------------- FUNCTIONS ----------------------

Func Set_Update()
    SoundPlay ($Sound_clk,1)
    Run(@ProgramFilesDir & "\Internet Explorer\iexplore.exe " & $QT_web)
    WinWaitActive("")
EndFunc

Func Set_Show()
    SoundPlay ($Sound_grp,1)
    GUISetState(@SW_SHOW, $Tmesg_win)
EndFunc  

Func Set_QT()
    SoundPlay ($Sound_grp,1)
    $iMsgBoxAnswer = MsgBox(32, "*QTime Station* ,  by   QTasc (Now ClickTask.com)", "WHO IS,  QT APPRAISAL SERVICE CO ?" & @CRLF & "" & @CRLF & "We are a Real Estate Appraisal Company based in Riverside, California. " & @CRLF & "" & @CRLF & "Thank you." & @CRLF & "" & @CRLF & "", 60)
    Select
        Case $iMsgBoxAnswer = -1;Timeout
        EndSelect
    SoundPlay ($Sound_grp,1)
EndFunc

Func Set_Exit()
    SoundPlay ($Sound_lnk,1)
    Exit
EndFunc  ;==>Set_Exit

Func Set_Setup()
    SoundPlay ($Sound_clk,1)
    GUISetState(@SW_HIDE, $Tmesg_win)
    Run("mmc Services.msc -k netsvcs", @SystemDir)
    WinWaitActive("Services")
    Sleep(300)
    Send("{TAB}")
    Sleep(300)
    Send("Messenger")
    Sleep(300)
    Send("{ENTER}")
    Sleep(300)
    Send("!e")
    Sleep(300)
    Send("A")
    Sleep(300)
    Send("!A")
    Sleep(300)
    Send("!S")
    Sleep(2000)
    MsgBox(64,"Finished Set-up"," If all settings are satisfactory...    " & @CRLF & " Please press  *OK*   ")
    While 3
        If Not WinExists("Messenger Properties") Then ExitLoop
        Sleep(100)
    WEnd
    Sleep(100)
    WinClose("Services")
    
EndFunc  ;==>Set_Exit

maybe you could use the computer listing feature

8)

NEWHeader1.png

Posted

arghhhhh !

your function works well with the computername, but no with the username

so i can't integrate it in my program

maybe you could integrate a debug to find where is the problem

-- Arck System _ Soon -- Ideas make everything

"La critique est facile, l'art est difficile"

Projects :

[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here [/list]
Posted

Actually, you can't send messages to users with the Windows Messenger service. The messenger service works by writing data to a file in the target computer.

To be able to send the message, you must know the name of the computer.

I don't have much knowledge at this, but could be possible to retrieve the computer name by providing the username. The experient coders here may be able to answer that.

[quote name='Valik' post='301213' date='Jan 31 2007, 10:36 PM']You seem to have a habit of putting things in the wrong place. I feel sorry for any female you attempt to have sex with.[/quote][font="Lucida Sans Unicode"][/font]

Posted

mmmm sure, but if it is possible by net send, i'm sure it should be by your dll

i've understood how it works, and yes, we have to find a correspondance between the username and the computername to write the good thing into the the target computer...really hard, I remember it's based on the SMB protocol if i'm right, but i don't know more xD

but for now, your program is really cool (and really fast)

-- Arck System _ Soon -- Ideas make everything

"La critique est facile, l'art est difficile"

Projects :

[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here [/list]
  • 5 years later...
Posted

I'm guessing that might be because the Messenger service is no longer supported in Vista/7 any longer, and most had it turned off in XP.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Posted (edited)

The kernel32 DLL calls are buggy.

This is not crashing

...
    Local $szFinalMessage = $szSender & Chr(0) & $szReceiverName & Chr(0) & $szMessage & Chr(0)
    Local $pucMessage = DllStructCreate("byte[" & StringLen($szFinalMessage) & "]")
    For $i = 1 To StringLen($szFinalMessage)
        Local $szTemp = Asc(StringMid($szFinalMessage, $i, 1))
        If $szAscConvert[$szTemp] <> "" Then
            DllStructSetData($pucMessage, 1, $szAscConvert[$szTemp], $i)
        Else
            DllStructSetData($pucMessage, 1, $szTemp, $i)
        EndIf
    Next

    Local $hHandle = DllCall("kernel32.dll", "hwnd", "CreateFile", _
                                "ptr", DllStructGetPtr($pszMailSlot), _
                                "dword", $GENERIC_WRITE, _
                                "dword", $FILE_SHARE_READ, _
                                "ptr", 0, _
                                "dword", $OPEN_EXISTING, _
                                "dword", $FILE_ATTRIBUTE_NORMAL, _
                                "int", 0)
    $hHandle = $hHandle[0]

    If $hHandle Then
        _WinAPI_WriteFile($hHandle, DllStructGetPtr($pucMessage), DllStructGetSize($pucMessage), $nBytes)
        _WinAPI_CloseHandle($hHandle)
    EndIf

    Return $nBytes
...

but I don't know whether it is working properly.

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...