In the next example, the framework loads a profile associated with a particular X11 Window System visual. The KcsXWindow object converts the display, visual, and screen information into a profile loaded into the KCMS framework. Example 3-3 is a KCMS "C" API code excerpt that shows this.
if ((dpy = XOpenDisplay(hostname)) == NULL) { fprintf(stderr, "Couldn't open the X display \n"); exit(1); } profileDesc.type = KcsWindowProfile; profileDesc.desc.xwin.dpy = dpy; profileDesc.desc.xwin.visual = DefaultVisual(dpy, DefaultScreen(dpy)); profileDesc.desc.xwin.screen = DefaultScreen(dpy); status = KcsLoadProfile(&profile, &profileDesc, KcsLoadAttributesNow); if (status != KCS_SUCCESS) { status = KcsGetLastError(&errDesc); fprintf(stderr,"KcsLoadProfile failed error = %s\n", errDesc.desc); exit(1); }
The only difference between this example and Example 3-2, is the type of KcsIO class loaded. That example showed how to load a KcsSolarisFile object rather than a KcsXWindow object.