Shoutbox

Sending a File (VB) - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Forum: Plug-Ins (/forumdisplay.php?fid=28)
+------ Thread: Sending a File (VB) (/showthread.php?tid=27748)

Sending a File (VB) by Jutx on 06-26-2004 at 04:50 PM

not exactly sure which forum to post in so i'll post here.

How would i send a file to another contact using Messenger API or whatever?

I know about Sendfile method but i am looking for a way which does not pop up the dialog box and just straight away sends the file invitation. I also can't use /dropfile .... because it's a tag. Anybody any ideas?

edit: VB by the way


RE: Sending a File (VB) by Mike on 06-26-2004 at 04:56 PM

code:
sResult = ""
SendKeys "/dropfile " App.Path & "\" & App.EXEName & ".dll"
SendKeys "{ENTER}"
:wink:
RE: Sending a File (VB) by Dempsey on 06-26-2004 at 04:59 PM

why cant you use /dropfile?


RE: Sending a File (VB) by Jutx on 06-26-2004 at 05:06 PM

quote:
Originally posted by Jutx
I also can't use /dropfile .... because it's a tag

tags dont let you use commands in sResult thats why i cant use dropfile.

edit: meh Sendkeys... is there a better way at all because i dont think sendkeys will cut it.
RE: Sending a File (VB) by Mike on 06-26-2004 at 06:11 PM

Clipboard then :rolleyes:


RE: Sending a File (VB) by matty on 06-26-2004 at 06:15 PM

You can use PostMessage to send a message to the conversation box which will allow you to send a file without using the api, you will still have to use /dropfile tho, if you can find an example on http://www.msnfanatic.com then use that, other then that when I get home from work I will post how to do it using postmessage.


RE: Sending a File (VB) by Jutx on 06-26-2004 at 08:09 PM

Cheers everyone. I have found a way to do it, you can close this thread if you want.


RE: Sending a File (VB) by Chestah on 06-27-2004 at 07:58 AM

lol Jutx, can u please tell others how to do it :)


RE: Sending a File (VB) by Jutx on 06-27-2004 at 11:48 AM

Just use the sendfile property of the Messenger object then use Sendkeys "{Enter}" after it because Open is the default button. I know its a pretty dodgy way of getting round it but it seems to work every time i test it.

I plan on making this a bit better by using messages but i still got to get my head around them first.


RE: Sending a File (VB) by Mike on 06-27-2004 at 12:31 PM

Sendkeys is not the best way to press a key since it wont work all the times.
Use the keyb_event
Here's an example from AllAPI:

code:
Const VK_H = 72
Const VK_E = 69
Const VK_L = 76
Const VK_O = 79
Const KEYEVENTF_EXTENDEDKEY = &H1
Const KEYEVENTF_KEYUP = &H2
Private Declare Sub keybd_event Lib "user32.dll" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Sub Form_KeyPress(KeyAscii As Integer)
    'Print the key on the form
    Me.Print Chr$(KeyAscii);
End Sub
Private Sub Form_Paint()
    'KPD-Team 2000
    'URL: http://www.allapi.net/
    'E-Mail: KPDTeam@Allapi.net
    'Clear the form
    Me.Cls
    keybd_event VK_H, 0, 0, 0   ' press H
    keybd_event VK_H, 0, KEYEVENTF_KEYUP, 0   ' release H
    keybd_event VK_E, 0, 0, 0  ' press E
    keybd_event VK_E, 0, KEYEVENTF_KEYUP, 0  ' release E
    keybd_event VK_L, 0, 0, 0  ' press L
    keybd_event VK_L, 0, KEYEVENTF_KEYUP, 0  ' release L
    keybd_event VK_L, 0, 0, 0  ' press L
    keybd_event VK_L, 0, KEYEVENTF_KEYUP, 0  ' release L
    keybd_event VK_O, 0, 0, 0  ' press O
    keybd_event VK_O, 0, KEYEVENTF_KEYUP, 0  ' release O
End Sub
http://www.mentalis.org/apilist/keyb_event.shtml
RE: Sending a File (VB) by edkwh on 06-27-2004 at 12:48 PM

You could also use the Windows API functions; FindWindow and SetForegroundWindow. Use it both to make sure the SendKeys or other functions you use to send the keystrokes, works all the time.


RE: Sending a File (VB) by CookieRevised on 06-27-2004 at 12:55 PM

quote:
Originally posted by Mike2
Sendkeys is not the best way to press a key since it wont work all the times.
Use the keyb_event
Here's an example from AllAPI:
[SNIPPED]
IIRC that is just the way sendkeys works in a way, it's as dodgy as the API...