JS calls C ++

Source: Internet
Author: User

1. register the C ++ function.

// Register the callback function macro // you can register two function prototypes based on your needs. Note that the functions registered in connect_js_call_simple_handler must be properly coordinated with HTML calls in advance. The parameters must all be characters, the owner will cause unknown problems # define connect_js_call_handler (name, func, pcontext) Do \ {\ If (! Cbkcallbackfunccontainer: getfuncptr ()-> nameid (L # Name) \ cbkcallbackfunccontainer: getfuncptr ()-> connectjsfunchandler (L # name, (jscallbackfunction) & func, false, pcontext) ;\} while (false); connect_js_call_handler (opencustomstockdlg, (jscallbackfunction) & opencustomstockdlg, this );

2. Called function declaration.

static int      OpenCustomStockDlg(DISPPARAMS* params, VARIANT* retval , void* pContext);

3. Implementation of the called function.

int     CXXWindow::OpenCustomStockDlg(DISPPARAMS* params, VARIANT* retval , void* pContext){    CFinancialMainWindow* _pThis = static_cast<CFinancialMainWindow*>(pContext);    ATLASSERT(_pThis);    CString strCur = "0";    if (params->cArgs == 1)    {        strCur = params->rgvarg[0];    }     //_pThis->OpenLogingSetDlg(StrToLong(strCur));    CString strPara = _pThis->Get_SignPara();    CustomStockSynchronous dlgCustomStock(strPara);    dlgCustomStock.DoModal();     return 0;}



Original article: http://www.cnblogs.com/chunyou128/archive/2011/10/26/2225846.html

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.