Jump to content

Recommended Posts

Posted

i made a remote tool to control windows media player, give some comment

Server

Dim $szIPADDRESS = @IPAddress1
Dim $nPORT = 33891
TCPStartUp()
$MainSocket = TCPListen($szIPADDRESS, $nPORT)
If $MainSocket = -1 Then Exit
Dim $ConnectedSocket = -1
Do
    $ConnectedSocket = TCPAccept($MainSocket)
Until $ConnectedSocket <> -1
Dim $szIP_Accepted = SocketToIP($ConnectedSocket)
Dim $msg, $recv
While 1
    $recv = TCPRecv( $ConnectedSocket, 2048 )
    If @error Then ExitLoop

    If $recv <> "" Then
        Switch $recv
            Case "play"
                Send("{MEDIA_PLAY_PAUSE}")
            Case "stop"
                Send("{MEDIA_STOP}")
            Case "next"
                Send("{MEDIA_NEXT}")
            Case "back"
                Send("{MEDIA_PREV}")
            Case "volumeverminderen"                
                Send("{VOLUME_DOWN}")
            Case "volumeuit"    
                Send("{VOLUME_MUTE}")               
            Case "volumeverhogen"   
                Send("{VOLUME_UP}")

            Case "volume100"
SoundSetWaveVolume(100)

            Case "volume90"
SoundSetWaveVolume(90)

            Case "volume80"
SoundSetWaveVolume(80)

            Case "volume70"
SoundSetWaveVolume(70)

            Case "volume60"
SoundSetWaveVolume(60)

            Case "volume50"
SoundSetWaveVolume(50)

            Case "volume40"
SoundSetWaveVolume(40)

            Case "volume30"
SoundSetWaveVolume(30)

            Case "volume20"
SoundSetWaveVolume(20)

            Case "volume10"
SoundSetWaveVolume(10)

            Case "volume0"

SoundSetWaveVolume(0)





        EndSwitch
    EndIf
WEnd
If $ConnectedSocket <> -1 Then TCPCloseSocket( $ConnectedSocket )
TCPShutDown()
Func SocketToIP($SHOCKET)
    Local $sockaddr = DLLStructCreate("short;ushort;uint;char[8]")

    Local $aRet = DLLCall("Ws2_32.dll","int","getpeername","int",$SHOCKET, _
            "ptr",DLLStructGetPtr($sockaddr),"int_ptr",DLLStructGetSize($sockaddr))
    If Not @error And $aRet[0] = 0 Then
        $aRet = DLLCall("Ws2_32.dll","str","inet_ntoa","int",DLLStructGetData($sockaddr,3))
        If Not @error Then $aRet = $aRet[0]
    Else
        $aRet = 0
    EndIf

    $sockaddr = 0

    Return $aRet
EndFuncoÝ÷ ÙÉbz{ZºÚ"µÍÔÝ

B[H ÌÍÜÞÙÈH   ][ÝÌNLMKÉ][ÝÂYÜ[^][H  ÌÍÜÞTQTÔÈHÔ[YUÒT
    ÌÍÜÞÙÊB[H ÌÍÛÔHÌÎLB[H   ÌÍÐÛÛXÝYÛØÚÙ]HLBÌÍÐÛÛXÝYÛØÚÙ]HÔÛÛXÝ
    ÌÍÜÞTQTÔË ÌÍÛÔ
B[H ÌÍÜÞ]BYÜ[ÙÐÞ
LL  ][ÝÑÜ][ÝË  ][ÝÕÔÛÛXÝZ[YÚ]ÔÐHÜ    ][ÝÈ  [ÈÜB[ÙBÒ[ÛYH   ÐÛÛÝ[Ë]LÉÝÂÓÕ^RXÛÛÜ
    ][ÝÕ^SY[S[ÙI][ÝËJBÌÍÛ]]HH^PÜX]R][J ][ÝÓ]]I][ÝÊBÌÍÕÛ[Y]ÙÙ[H^PÜX]R][J ][ÝÕÛ[YHÙÙ[IÝÉ][ÝÊBÌÍÕÛ[Y]YÙ[H^PÜX]R][J  ][ÝÕÛ[YHYÙ[ ËI][ÝÊB^PÜX]R][J    ][ÝËKKKKKKKKKKKKKKKKKKI][ÝÊBÌÍÝÛ[YHH^PÜX]SY[J  ][ÝÕÛ[YI][ÝÊBÌÍÝÛ[YLLH^PÜX]R][J   ][ÝÕÛ[YHL    I][ÝË ÌÍÝÛ[YJBÌÍÝÛ[YNLH^PÜX]R][J ][ÝÕÛ[YHL    I][ÝË ÌÍÝÛ[YJBÌÍÝÛ[YNH^PÜX]R][J  ][ÝÕÛ[YH I][ÝË ÌÍÝÛ[YJBÌÍÝÛ[YMÌH^PÜX]R][J    ][ÝÕÛ[YH
Ì  I][ÝË ÌÍÝÛ[YJBÌÍÝÛ[YMH^PÜX]R][J  ][ÝÕÛ[YH
    I][ÝË ÌÍÝÛ[YJBÌÍÝÛ[YMLH^PÜX]R][J ][ÝÕÛ[YH
L   I][ÝË ÌÍÝÛ[YJBÌÍÝÛ[YMH^PÜX]R][J  ][ÝÕÛ[YH
    I][ÝË ÌÍÝÛ[YJBÌÍÝÛ[YLÌH^PÜX]R][J    ][ÝÕÛ[YHÌ   I][ÝË ÌÍÝÛ[YJBÌÍÝÛ[YLH^PÜX]R][J  ][ÝÕÛ[YH I][ÝË ÌÍÝÛ[YJBÌÍÝÛ[YLLH^PÜX]R][J ][ÝÕÛ[YHL    I][ÝË ÌÍÝÛ[YJBÌÍÝÛ[YLH^PÜX]R][J  ][ÝÕÛ[YH I][ÝË ÌÍÝÛ[YJB^PÜX]R][J  ][ÝËKKKKKKKKKKKKKKKKKKI][ÝÊBÌÍÜ^HH^PÜX]R][J ][ÝÔ^H    Ýß    ][ÝÊBÌÍÜÝÜH^PÜX]R][J    ][ÝÔÝÜ  ][ÝÊBÌÍÕÛÙ[HH^PÜX]R][J  ][ÝÕÛÙ[HIÝÉ][ÝÊBÌÍÝÜYÙHH^PÜX]R][J ][ÝÉËHÜYÙI][ÝÊBÌÍÙ^]][HH^PÜX]R][J    ][ÝÑ^]    ][ÝÊB^TÙ]Ý]J
BÚ[HB  ÌÍÛÙÈH^QÙ]ÙÊ
BÙ[XÝØÙH    ÌÍÛÙÈHÛÛ[YSÛÜØÙH ÌÍÛÙÈH ÌÍÜ^B^H

BØÙH  ÌÍÛÙÈH ÌÍÜÝÜÝÜ

BØÙH  ÌÍÛÙÈH ÌÍÕÛÙ[B^ÛÛÈ

BØÙH  ÌÍÛÙÈH ÌÍÝÜYÙHXÚÜÛÛÈ

BØÙH  ÌÍÛÙÈH ÌÍÕÛ[Y]YÙ[Û[Y]Z[[

BØÙH  ÌÍÛÙÈH ÌÍÕÛ[Y]ÙÙ[Û[Y]ÙÙ[

BØÙH  ÌÍÛÙÈH ÌÍÛ]]HÛ[Y]Z]

BØÙH  ÌÍÛÙÈH ÌÍÝÛ[YLLÛ[YLL

BØÙH  ÌÍÛÙÈH ÌÍÝÛ[YNLÛ[YNL

BØÙH  ÌÍÛÙÈH ÌÍÝÛ[YNÛ[YN

BØÙH  ÌÍÛÙÈH ÌÍÝÛ[YMÌÛ[YMÌ

BØÙH  ÌÍÛÙÈH ÌÍÝÛ[YMÛ[YM

BØÙH  ÌÍÛÙÈH ÌÍÝÛ[YMLÛ[YML

BØÙH  ÌÍÛÙÈH ÌÍÝÛ[YMÛ[YM

BØÙH  ÌÍÛÙÈH ÌÍÝÛ[YLÌÛ[YLÌ

BØÙH  ÌÍÛÙÈH ÌÍÝÛ[YLÛ[YL

BØÙH  ÌÍÛÙÈH ÌÍÝÛ[YLLÛ[YLL

BØÙH  ÌÍÛÙÈH ÌÍÝÛ[YLÛ[YL

BØÙH  ÌÍÛÙÈH ÌÍÙ^]][B^]ÛÜ[Ù[XÝÑ[^]BBBBBBBB[Y[ÈÛ[YLL

BÙ[ÛY
    ][ÝÝÛ[YLL    ][ÝÊB[[Â[ÈÛ[YNL

BÙ[ÛY
    ][ÝÝÛ[YNL    ][ÝÊB[[Â[ÈÛ[YN

BÙ[ÛY
    ][ÝÝÛ[YN ][ÝÊB[[Â[ÈÛ[YMÌ

BÙ[ÛY
    ][ÝÝÛ[YMÌ   ][ÝÊB[[Â[ÈÛ[YM

BÙ[ÛY
    ][ÝÝÛ[YM ][ÝÊB[[Â[ÈÛ[YML

BÙ[ÛY
    ][ÝÝÛ[YML    ][ÝÊB[[Â[ÈÛ[YM

BÙ[ÛY
    ][ÝÝÛ[YM ][ÝÊB[[Â[ÈÛ[YLÌ

BÙ[ÛY
    ][ÝÝÛ[YLÌ   ][ÝÊB[[Â[ÈÛ[YL

BÙ[ÛY
    ][ÝÝÛ[YL ][ÝÊBQ[[Â[ÈÛ[YLL

BÙ[ÛY
    ][ÝÝÛ[YLL    ][ÝÊB[[Â[ÈÛ[YL

BÙ[ÛY
    ][ÝÝÛ[YL ][ÝÊBQ[[Â[È^J
BÙ[ÛY
    ][ÝÜ^I][ÝÊB[[Â[ÈÝÜ

BÙ[ÛY
    ][ÝÜÝÜ  ][ÝÊB[[Â[È^ÛÛÊ
BÙ[ÛY
    ][ÝÛ^ ][ÝÊB[[Â[ÈXÚÜÛÛÊ
BÙ[ÛY
    ][ÝØXÚÉ][ÝÊB[[Â[ÈÛ[Y]Z[[
BÙ[ÛY
    ][ÝÝÛ[Y]Z[[][ÝÊB[[Â[ÈÛ[Y]Z]

BÙ[ÛY
    ][ÝÝÛ[Y]Z]   ][ÝÊBQ[[Â[ÈÛ[Y]ÙÙ[
BÙ[ÛY
    ][ÝÝÛ[Y]ÙÙ[][ÝÊBQ[[Â[ÈÙ[ÛY
    ÌÍÜÞ]JBÔÙ[
    ÌÍÐÛÛXÝYÛØÚÙ] ÌÍÜÞ]JBYÜ[^]ÔÙ[
    ÌÍÐÛÛXÝYÛØÚÙ] ][ÝÉ][ÝÊBYÜ[^][[
Posted

Looks good Realkiller.

Maybe if you wanna short the server code down do something like this:

CASE stringinstr($recv,"volume")
soundsetwavevolume(stringreplace($recv,"volume","")
My Scripts:Radioblog Club Music DownloaderOther stuff:Fun movieIm serious read the help file it helps :PFight 'Till you drop. Never stop, You Cant give up. Til you reach the top Fight! you’re the best in town Fight!
  • 1 month later...
Posted

ok thanks... can't promiss it will get in there, but i'll try... Thanks! If/when i get it in there ill mention you + add a link to this thread in my 'Special Thanks To:' section!!

[center][/center]

Posted

Hi,

Just a question, why are you doing a second tcpsend why nothing in it ?

Func sendcmd($szData)

TCPSend($ConnectedSocket,$szData)

If @error Then Exit

TCPSend($ConnectedSocket,"")

If @error Then Exit

EndFunc

thank's

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...