tailieunhanh - Mac OS X Programming phần 6

cơ bản là giống nhau. Một biến của loại này được sử dụng để tham khảo một cửa sổ. Cảnh báo được coi là một hộp thoại, nhưng một hộp thoại là không có gì nhiều hơn một loại cửa sổ. Các đối số thứ hai và thứ ba là xứng đáng của cuộc thảo luận nhiều hơn một chút. Chuỗi dịch vụ và văn bản CFString Đối tượng nhân vật và | CheckboxDemo introduces a couple of new routines unrelated to the handling of controls. The Carbon routine GetDefaultOutputVolume queries the system to determine the current volume level of the user s computer. The corresponding SetDefaultOutputVolume function changes the volume of the user s computer to a specified level. Both functions are called from within the main routine SInt32 gUserVolumeLevel int main int argc char argv GetDefaultOutputVolume gUserVolumeLevel RunApplicationEventLoop SetDefaultOutputVolume gUserVolumeLevel return 0 Shortly after application startup GetDefaultOutputVolume is called to get the current volume level of the user s computer. That level is retained in the global variable gUserVolumeLevel. When the program is about to exit when RunApplicationEvenLoop returns the speaker volume is restored to its initial setting. The CheckboxDemo program is capable of muting the speakers of the user s computer so what would happen if the program didn t include this speaker volume code in main If the user checked the mute checkbox clicked the OK button and then quit the program the speaker volume would remain off. Note that a Macintosh user typically makes a systemwide change which is a change that affects the system not just one program. These changes include changing speaker volume or monitor resolution by choosing System Preferences from the Apple menu. Unless a program exists specifically to serve as a utility that alters systemwide settings that program shouldn t make lasting changes to the user s computer. When the user quits a program he or she typically expects the computer to be in the same state as it was before the program was launched. In the spirit of that expectation CheckboxDemo is capable of muting the user s speakers. CheckboxDemo is a simple application that exists to demonstrate a programming technique. It is not a full-fledged application that a user expects to be a speaker-volume-adjusting utility Being a good citizen of Mac OS X

TỪ KHÓA LIÊN QUAN
crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.