本文整理汇总了C++中Library::GetLibraryID方法的典型用法代码示例。如果您正苦于以下问题:C++ Library::GetLibraryID方法的具体用法?C++ Library::GetLibraryID怎么用?C++ Library::GetLibraryID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Library
的用法示例。
在下文中一共展示了Library::GetLibraryID方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddLibsToCombo
static bool AddLibsToCombo(int lang)
{
// First get the last used library for this language
int lastUsed = -1;
SqliteStatement stmt(g_db, "SELECT LibraryID FROM LangLastUsed WHERE Lang = @langid");
stmt.Bind("@langid", lang);
if (stmt.GetNextRecord())
lastUsed = stmt.GetIntColumn("LibraryID");
stmt.Finalize();
// Get all the libraries for this language
stmt.Prepare("SELECT Library.*, LibraryLang.Lang FROM Library INNER JOIN LibraryLang ON Library.LibraryID = LibraryLang.LibraryID WHERE (LibraryLang.Lang = @langid OR LibraryLang.Lang = -2) ORDER BY Library.Name");
stmt.Bind("@langid", lang);
// Go through the rows
int colLang = stmt.GetColumnCount() - 1;
bool first = true;
bool firstLanguage = false;
bool selectedUsersChoice = false; // Did the user select a library?
while (stmt.GetNextRecord())
{
// Store the library data
Library* lib = new Library(&stmt);
// Add the item to the combo
long item = (long) SendDlgItemMessage(s_hDlg, IDC_NAME, CB_ADDSTRING, (WPARAM) 0, (LPARAM) lib->WGetName());
SendDlgItemMessage(s_hDlg, IDC_NAME, CB_SETITEMDATA, (WPARAM) item, (LPARAM) lib);
// Determine if we need to select this library?
bool selectThisLib = first;
// Did we run into the user selected library already?
if (!selectedUsersChoice)
{
if (lib->GetLibraryID() == lastUsed)
{
selectedUsersChoice = true;
selectThisLib = true;
}
else
{
if (!firstLanguage)
{
int libLang = stmt.GetIntColumn(colLang);
if (libLang >= 0)
{
firstLanguage = true;
selectThisLib = true;
}
}
}
}
// Need to select this library?
if (selectThisLib)
{
SendDlgItemMessage(s_hDlg, IDC_NAME, CB_SETCURSEL, (WPARAM) item, (LPARAM) 0);
s_curLibrary = lib;
}
first = false;
}
stmt.Finalize();
return !first;
}