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/