我已經下載了一個名爲快速交談軟電話,一件事這個方案缺乏是輕鬆點擊使用SIP協議撥打的能力。所以,我想我會盡我所能,創建一個簡單的C++程序,將接受號碼點擊,然後將該信息傳遞到快遞通話自動撥打該號碼,我已經嘗試了一些事情,通常會導致我到死結束。我不是太熟悉C++,所以希望這裏有人能幫助我弄清楚什麼是錯的,該文件位於C:/ Program Files文件/ NCHSoftware /通話/ talk.exe。爲了使用命令行撥號,我可以輸入/talk.exe-dial「5555555555」,這將打開程序並撥打號碼。C++編程打開外部EXE(用於處理協議)
這個程序的工作原理,被稱爲dial.exe(位於同一文件夾中talk.exe):
#include <stdlib.h>
#include <windows.h>
int main()
{
system("start talk.exe -dial 5555555555");
}
現在的問題:如果我直接火狐(12.0)來處理SIP鏈接撥號。然後嘗試點擊一個SIP鏈接,我得到的錯誤:「Windows無法找到'talk.exe'。確保你輸入正確的名稱,然後再試一次」
在這一點上,我甚至不關心關於將電話號碼變量傳遞給talk.exe,因爲我只是想確保它在我點擊sip鏈接時打開。我想這也許是找到talk.exe有困難的原因是因爲某些原因,mozilla可能會改變程序的目錄?我不太清楚,所以現在我試圖把talk.exe的完整路徑的程序,所以我試圖
#include <stdlib.h>
#include <windows.h>
int main()
{
system("start \"C:\\Program Files\\NCHSoftware\\Talk\\talk.exe -dial 5555555555\"");
}
這一切確實是開放的,而不實際執行該程序的命令提示符窗口。當然,如果我能以某種方式在Firefox的應用程序窗口中傳遞參數,這一切都可以解決,但這是不允許的。任何人都可以幫助我調試?我只是不知道該做什麼。
下面是當前的代碼:
#include <stdlib.h>
#include <windows.h>
#include <direct.h>
#include <string.h>
#include <string>
//Written to implement click-to-dial functionality for soft phones (assuming softphones allow arguments to be passed to dial the phone.)
int main()
{
_chdir("C:\\Program Files\\NCHSoftware\\Talk\\");
if (argc > 1 && _strnicmp(argv[1], "sip:", 4))
{ // match "sip:" prefix, case insensitive
std::string cmd = "start talk.exe -dial " + std::string(argv[1]+4);
system(cmd.c_str());
}
}
是C:\ Program Files文件\ NCHSoftware \通話文件夾在你的路徑? –