Article # 567, added by Geoworks, historical record
| first |
previous |
index |
next |
last |
Grabbing the text of a vis moniker?
Q. How do I access the text of a vis moniker? All I've found so far is the GenClass message MSG_GEN_GET_VIS_MONIKER which gives me a chunk handle. What can I do with that? A. Use code like this to extract the text from a textual VisMoniker: MemHandle mh; ChunkHandle ch; VisMoniker * ptr; TCHAR buffer[10]; ch = @call TestPrimary::MSG_GEN_GET_VIS_MONIKER(); mh = OptrToHandle( @TestPrimary ); // we're running in the ui thread, so we can call this on ui objects ObjLockObjBlock( mh ); ptr = LMemDerefHandles( mh, ch ); // must make sure it's not a gstring or moniker list if ( ( ptr->VM_type & ( VMLET_GSTRING | VMLET_MONIKER_LIST ) ) == 0 ) { // note the typecast to force C to add the correct values ptr = (byte*)ptr + sizeof( VisMoniker ); ptr = (byte*)ptr + 1; strncpy( buffer, ptr, 10 ); } MemUnlock( mh );