Skip to content

Commit

Permalink
Update WeaselTSF.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
QianmuZ authored Jul 25, 2023
1 parent a704fe6 commit 67f117b
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion WeaselTSF/WeaselTSF.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
#include "stdafx.h"
#include "stdafx.h"

#include "WeaselTSF.h"
#include "WeaselCommon.h"
#include "CandidateList.h"
#include "LanguageBar.h"
#include "Compartment.h"
#include "ResponseParser.h"
#include <psapi.h>
#include <boost/filesystem.hpp>
#pragma comment(lib, "psapi.lib")
namespace fs = boost::filesystem;

static void error_message(const WCHAR *msg)
{
Expand Down Expand Up @@ -34,6 +38,22 @@ WeaselTSF::WeaselTSF()
_cand = new CCandidateList(this);

DllAddRef();

auto pid = GetCurrentProcessId();

auto hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, pid);

std::wstring name;
name.reserve(MAX_PATH);

GetProcessImageFileName(hProcess, &name[0], name.capacity());
name = &name[0];

CloseHandle(hProcess);
if (fs::path(name).filename().wstring() == L"WINWORD.EXE")
{
_WinWord = true;
}
}

WeaselTSF::~WeaselTSF()
Expand Down

0 comments on commit 67f117b

Please sign in to comment.