You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/mfc/reference/application-control.md
+84-7Lines changed: 84 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -35,7 +35,7 @@ translation.priority.ht:
35
35
- "zh-tw"
36
36
---
37
37
# Application Control
38
-
OLE requires substantial control over applications and their objects. The OLE system DLLs must be able to launch and release applications automatically, coordinate their production and modification of objects, and so on. The functions in this topic meet those requirements. In addition to being called by the OLE system DLLs, these functions must sometimes be called by applications as well.
38
+
OLE requires substantial control over applications and their objects. The OLE system DLLs must be able to launch and release applications automatically, coordinate their production and modification of objects, and so on. The functions in this topic meet those requirements. In addition to being called by the OLE system DLLs, these functions must sometimes be called by applications as well.
39
39
40
40
### Application Control
41
41
@@ -46,9 +46,12 @@ OLE requires substantial control over applications and their objects. The OLE sy
46
46
|[AfxOleGetUserCtrl](#afxolegetuserctrl)|Retrieves the current user-control flag.|
47
47
|[AfxOleSetUserCtrl](#afxolesetuserctrl)|Sets or clears the user-control flag.|
48
48
|[AfxOleLockApp](#afxolelockapp)|Increments the framework's global count of the number of active objects in an application.|
49
-
|[AfxOleUnlockApp](#afxoleunlockapp)|Decrements the framework's count of the number of active objects in an application.|
49
+
|[AfxOleLockControl](#afxolelockcontrol)| Locks the class factory of the specified control. |
50
+
|[AfxOleUnlockApp](#afxoleunlockapp)|Decrements the framework's count of the number of active objects in an application.|
51
+
|[AfxOleUnlockControl](#afxoleunlockcontrol)| Unlocks the class factory of the specified control. |
50
52
|[AfxOleRegisterServerClass](#afxoleregisterserverclass)|Registers a server in the OLE system registry.|
51
53
|[AfxOleSetEditMenu](#afxoleseteditmenu)|Implements the user interface for the *typename* Object command.|
Nonzero if the class factory of the control was successfully locked; otherwise 0.
186
+
187
+
### Remarks
188
+
This can significantly speed up display of the controls. For example, once you create a control in a dialog box and lock the control with `AfxOleLockControl`, you do not need to create and kill it again every time the dialog is shown or destroyed. If the user opens and closes a dialog box repeatedly, locking your controls can significantly enhance performance. When you are ready to destroy the control, call `AfxOleUnlockControl`.
189
+
190
+
### Example
191
+
```cpp
192
+
// Starts and locks control's (Microsoft Calendar) class factory.
193
+
// Control will remain in memory for lifetime of
194
+
// application or until AfxOleUnlockControl() is called.
Nonzero if the class factory of the control was successfully unlocked; otherwise 0.
333
+
334
+
### Remarks
335
+
A control is locked with `AfxOleLockControl`, so that dynamically created data associated with the control remains in memory. This can significantly speed up display of the control because the control need not be created and destroyed every time it is displayed. When you are ready to destroy the control, call `AfxOleUnlockControl`.
336
+
337
+
### Example
338
+
```cpp
339
+
// Unlock control's (Microsoft Calendar Control) class factory.
0 commit comments