注册 登录
编程论坛 JavaScript论坛

js如何调用C++程序(程序有点大,有库)

lijianghu 发布于 2023-04-06 21:50, 89 次点击
就是想使用js在阿里云中调用c++程序,前端是html+css+js,后端是c++。c++代码可以在vs上正常运行,就想问问如何让js调用c++?
1 回复
#2
东海ECS2023-04-07 20:58
程序代码:

void CAddGoogleMap_CHtmlView::OnBeforeNavigate2(LPCTSTR lpszURL, DWORD nFlags, LPCTSTR lpszTargetFrameName, CByteArray& baPostedData, LPCTSTR lpszHeaders, BOOL* pbCancel)

 {
     // TODO: Add your specialized code here and/or call the base class  CString strUrl = lpszURL;
  if(strUrl.Left(4) == _T("app:"))

 {  

 // cancel the common url navigate and call your c++ code here   
*pbCancel = TRUE;   
MessageBox("调用了C++函数", "来自对话框消息");   
// call other c++ function here or parse the argument in the strUrl   
}


 CHtmlView::OnBeforeNavigate2(lpszURL, nFlags, lpszTargetFrameName, baPostedData, lpszHeaders, pbCancel); }
1