SAS/main.cpp

34 lines
890 B
C++
Raw Permalink Normal View History

/*
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
2022-07-03 18:22:02 +08:00
#import "c:\\Program Files\\Common Files\\System\\ado\\msado15.dll" no_namespace rename("EOF", "EndOfFile")
#include <stdio.h> // wprintf
#include <locale.h> // setlocale
#include "DBCUtils.h"
2022-07-04 00:31:52 +08:00
#include "Menu.h"
2022-07-03 18:22:02 +08:00
using namespace std;
int main() {
setlocale(LC_ALL, "chs");
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
string pwd;
2022-07-04 15:59:30 +08:00
while (true) {
try {
wprintf(L"Enter password:");
getline(cin, pwd);
2022-07-03 18:22:02 +08:00
2022-07-04 15:59:30 +08:00
_ConnectionPtr pconnect(_uuidof(Connection));
if (getConnection(pwd, pconnect)) {
2022-07-04 00:31:52 +08:00
mainMenu(pconnect);
}
2022-07-04 15:59:30 +08:00
}
catch (_com_error& err) {
wprintf(L"The application throws the error: %s\n", (wchar_t*)err.ErrorMessage());
wprintf(L"Description = %s\n", (wchar_t*)err.Description());
2022-07-03 18:22:02 +08:00
}
}
CoUninitialize();
return 0;
}