本文整理汇总了C++中Profile::QueryName方法的典型用法代码示例。如果您正苦于以下问题:C++ Profile::QueryName方法的具体用法?C++ Profile::QueryName怎么用?C++ Profile::QueryName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Profile
的用法示例。
在下文中一共展示了Profile::QueryName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Copy
void Profile::Copy ( Profile &Source ) {
#ifdef __OS2__
// If either profile isn't really open, return w/o doing anything at all.
if ( !Handle || !Source.IsReady() ) {
Log ( "Profile::Copy: Either the source or the target handle is invalid." ) ;
return ;
} /* endif */
// Find out how much memory is needed to get the entire list of keys for this application.
ULONG KeyListSize ;
if ( !PrfQueryProfileSize ( Source.Handle, Source.QueryName(), 0, &KeyListSize ) ) {
ERRORID Error = Sys_GetLastError ( 0 ) ;
Log ( "Profile::Copy: Unable to query for the list of defined keys. Status %08X.", Error ) ;
return ;
} /* endif */
// Allocate memory to hold the key list.
char *KeyList = new char [ ++KeyListSize ] ;
if ( !KeyList ) {
Log ( "Profile::Copy: Unable to allocate memory for the key list." ) ;
return ;
} /* endif */
// Fetch the list of keys.
if ( !PrfQueryProfileData ( Source.Handle, Source.QueryName(), 0, KeyList, &KeyListSize ) ) {
ERRORID Error = Sys_GetLastError ( 0 ) ;
Log ( "Profile::Copy: Unable to query for the key list. Status %08X.", Error ) ;
delete [] KeyList ;
return ;
} /* endif */
// Scan the key list, copying the data to the new profile.
char *Key = KeyList ;
while ( *Key ) {
ULONG ItemSize ;
if ( !PrfQueryProfileSize ( Source.Handle, Source.QueryName(), Key, &ItemSize ) )
break ;
char *Item = new char [ ItemSize ] ;
if ( !Item )
break ;
if ( !PrfQueryProfileData ( Source.Handle, Source.QueryName(), Key, Item, &ItemSize ) ) {
delete [] Item ;
break ;
} /* endif */
if ( !PrfWriteProfileData ( Handle, Name, Key, Item, ItemSize ) ) {
delete [] Item ;
break ;
} /* endif */
Key += strlen(Key) + 1 ;
} /* endwhile */
// Release the memory for the key list.
delete [] KeyList ;
#else // __NT__
// We're not going to implement this one for now, as the only reason for it was
// to convert from MemSize 3.31's INI file to MemSize 4.00's file, and the Win32
// version had no version before 4.00.
Source.QueryName ( ) ;
#endif // __OS2__ vs __NT__
} /* endmethod */