加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
main.cpp 1.45 KB
一键复制 编辑 原始数据 按行查看 历史
xiao17174 提交于 2018-03-08 15:44 . first commit
#include "sy_ocr.h"
#include <QtWidgets/QApplication>
#include <QMenu>
#include <QSystemTrayIcon>
#include <QSharedMemory>
#include <QLocalServer>
#include <QLocalSocket>
#include <QResource>
#include <QDirIterator>
int main(int argc, char *argv[])
{
// auto hres = CoInitializeEx(0, COINIT_MULTITHREADED);
// init_apartment();
// APTTYPE aptType;
// APTTYPEQUALIFIER aptTypeQualifier;
// auto dd = CoGetApartmentType(&aptType, &aptTypeQualifier);
QApplication a(argc, argv);
//auto hres = CoInitializeEx(0, COINIT_APARTMENTTHREADED);
// if (hres == RPC_E_CHANGED_MODE) {
// OleUninitialize();
// hres = CoInitializeEx(0, COINIT_MULTITHREADED);
// }
// Uri uri(L"http://kennykerr.ca/feed");
// SyndicationClient client;
// SyndicationFeed feed = client.RetrieveFeedAsync(uri).get();
//
// for (SyndicationItem item : feed.Items())
// {
// hstring title = item.Title().Text();
// printf("%ls\n", title.c_str());
// qDebug() << QString::fromWCharArray(title.c_str());
// }
//uninit_apartment();
QSharedMemory shared("sy_ocr");//־
if (shared.attach())
{
if (argc > 1)
{
QLocalSocket ls;
ls.connectToServer("sy_ocr");
if (ls.waitForConnected(1000))
{
ls.write(argv[1]);
ls.disconnectFromServer();
ls.close();
}
}
return 0;
}
shared.create(1);
a.setQuitOnLastWindowClosed(false);
sy_ocr w;
w.show();
//
if (argc > 1)
{
w.LoadImageFile(argv[1]);
}
auto ret = a.exec();
return ret;
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化