How does VC ++ register or deregister ActiveX Controls (. ocx) in the MFC program)

Source: Internet
Author: User

How to register/deregister ActiveX Control (. ocx) in the MFC Program)

{
Neblog. gpermalinkpage. updownmenu. opensameclass ('fks _ 000000', 'vc ++ ');
} "Href =" http://writeblog.csdn.net/# "> VC ++ read 83 comments 0 font size :{
Neblog. gpermalinkpage. updownmenu. changefont ('blogtext _ fks_0820700830830840690820820840950870940830710900007071 ', 1); Return false;
} "Href =" http://writeblog.csdn.net/# "> large Large{
Neblog. gpermalinkpage. updownmenu. changefont ('blogtext _ fks_0820700830830840690820820840950870940830710900007071 ', 2); Return false;
} "Href =" http://writeblog.csdn.net/# "> in Medium{
Neblog. gpermalinkpage. updownmenu. changefont ('blogtext _ fks_0820700830830840690820820840950870940830710900007071 ', 3); Return false;
} "Href =" http://writeblog.csdn.net/# "> small Small

Register ActiveX Control (. ocx) functions in the program

Bool registerocx (lpctstr ocxfilename)

{

Lpctstr pszdllname = ocxfilename; // ActiveX control path and file name

Hinstance hlib = loadlibrary (pszdllname); // load ActiveX Control

If (hlib <(hinstance) hinstance_error)

{

Return false;

}

Farproc lpdllentrypoint;

Lpdllentrypoint = getprocaddress (hlib, _ T ("dllregisterserver"); // obtain the address of the registration function dllregisterserver

 

If (lpdllentrypoint! = NULL) // call the registration function dllregisterserver

{

If (failed (* lpdllentrypoint )()))

{

Freelibrary (hlib );

Return false;

}

Return true;

}

Else

Return false;

}

//----------------------------------

Unregister the ActiveX control (. ocx) function in the program

 

Bool unregisterocx (lpctstr ocxfilename)

{

Lpctstr pszdllname = ocxfilename; // ActiveX control path and file name

Hinstance hlib = loadlibrary (pszdllname); // load ActiveX Control

If (hlib <(hinstance) hinstance_error)

{

Return false;

}

Farproc lpdllentrypoint;

Lpdllentrypoint = getprocaddress (hlib, _ T ("dllunregisterserver"); // obtain the address of the registration function dllunregisterserver

 

If (lpdllentrypoint! = NULL) // call the registration function dllunregisterserver

{

If (failed (* lpdllentrypoint )()))

{

Freelibrary (hlib );

Return false;

}

Return true;

}

Else

Return false;

}

 

Reprinted statement: This article from http://wmnmtm.blog.163.com/blog/static/382457142009629102522273/

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.