dimanche 10 janvier 2021

Media player classic. Can't set video position by using WM_COMMAND. I

I try to make my own control to MPC HC64. I can set position when i start MPC with CreateProcessA with argument "/startpos 00:05:01". I can change video position with SendMessage(hwndFW,WM_COMMAND,904,0) same as JumpForward(large),or SendMessage(hwndFW,WM_COMMAND,893,0) same as "Go to",and last option is using webinterface of MPC-HC,and it works fine "localhost:13579/command.html?wm_command=-1&position=00:06:55" in browser. I try to use all 4 options in my "program". But first option can't be used after MPC was launched, second option not so precise, third option require user confirmation(and i try to find handle of that dialogbox but not successful) and last option is what i try to use. I make a little function to send message to 127.0.0.1:13579 and it send but nothing happens after.

And first question: is there simple way to seek to position in MPCHC? Second question: what i should to send to localhost:13579 to manage MPC?

void sendmesstoport0()

{   WORD wVersionRequested;
    WSADATA wsaData;
    wVersionRequested = MAKEWORD(2, 2);
    int err1 = WSAStartup(wVersionRequested, &wsaData);
        //char     *buf="127.0.0.1:13579/command.html?wm_command=-1&position=00:06:55";
        char   *buf=" /command.html?wm_command=887 ";
        int buflen=sizeof(*buf);
        sockaddr_in clientService;
        clientService.sin_family = AF_INET;
        clientService.sin_addr.s_addr = inet_addr("127.0.0.1");
        clientService.sin_port = htons(13579);

        // Connect to server.

        SOCKET ConnectSocket;
        ConnectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
        int iResult = connect(ConnectSocket, (SOCKADDR *) & clientService, sizeof (clientService));
        //connect return 0
        int sendres0 =sendto(ConnectSocket,buf, buflen,0, (SOCKADDR *) & clientService, sizeof (clientService));
        //sendto return 1
        int iResul0= closesocket(ConnectSocket);
        WSACleanup();
}

Aucun commentaire:

Enregistrer un commentaire