diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2012-06-23 16:18:15 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2012-06-23 16:18:15 +0000 |
commit | fea5afddc76becda4d23aaa0614bcb01e948e9d0 (patch) | |
tree | e9076ac02cfe6282d49caa91f420eb9e1cdc4b1e /plugins/UserGuide | |
parent | 89b916a420146a1981b9125f5ade53d089b85fb1 (diff) |
UserGuide:
plusified
git-svn-id: http://svn.miranda-ng.org/main/trunk@566 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/UserGuide')
-rw-r--r-- | plugins/UserGuide/UserGuide_10.vcxproj | 10 | ||||
-rw-r--r-- | plugins/UserGuide/UserGuide_10.vcxproj.filters | 2 | ||||
-rw-r--r-- | plugins/UserGuide/main.cpp | 94 |
3 files changed, 54 insertions, 52 deletions
diff --git a/plugins/UserGuide/UserGuide_10.vcxproj b/plugins/UserGuide/UserGuide_10.vcxproj index 69a1cfbf08..e9d9e7693e 100644 --- a/plugins/UserGuide/UserGuide_10.vcxproj +++ b/plugins/UserGuide/UserGuide_10.vcxproj @@ -25,20 +25,20 @@ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>MultiByte</CharacterSet>
+ <CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>MultiByte</CharacterSet>
+ <CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>MultiByte</CharacterSet>
+ <CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>MultiByte</CharacterSet>
+ <CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
@@ -146,7 +146,7 @@ </Link>
</ItemDefinitionGroup>
<ItemGroup>
- <ClCompile Include="main.c" />
+ <ClCompile Include="main.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="commonheaders.h" />
diff --git a/plugins/UserGuide/UserGuide_10.vcxproj.filters b/plugins/UserGuide/UserGuide_10.vcxproj.filters index a9fe7c62a4..711c4c9dc2 100644 --- a/plugins/UserGuide/UserGuide_10.vcxproj.filters +++ b/plugins/UserGuide/UserGuide_10.vcxproj.filters @@ -15,7 +15,7 @@ </Filter>
</ItemGroup>
<ItemGroup>
- <ClCompile Include="main.c">
+ <ClCompile Include="main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
diff --git a/plugins/UserGuide/main.cpp b/plugins/UserGuide/main.cpp index 8fd3f6f818..908c99e09b 100644 --- a/plugins/UserGuide/main.cpp +++ b/plugins/UserGuide/main.cpp @@ -3,7 +3,7 @@ struct MM_INTERFACE mmi;
HINSTANCE hInst;
PLUGINLINK *pluginLink;
-HANDLE hModulesLoaded;
+HANDLE hModulesLoaded, hShowGuide;
int hLangpack;
PLUGININFOEX pluginInfo={
@@ -15,7 +15,7 @@ PLUGININFOEX pluginInfo={ "yasnovidyashii@gmail.com",
"© 2009 Mikhail Yuriev",
"http://miranda-im.org/",
- 0, //not transient
+ UNICODE_AWARE, //not transient
0, //doesn't replace anything built-in
// Generate your own unique id for your plugin.
// Do not use this UUID!
@@ -28,53 +28,54 @@ static INT_PTR ShowGuideFile(WPARAM wParam,LPARAM lParam) DBVARIANT dbv = {0};
int iRes;
- LPCSTR pszEmptySting="";
- LPSTR pszDirName, pszDirNameEx, pszFileName,pszDivider;
+ LPCTSTR pszEmptySting = _T("");
+ LPTSTR pszDirName, pszDirNameEx, pszFileName,pszDivider;
REPLACEVARSDATA dat = {0};
dat.cbSize = sizeof( dat );
- dat.dwFlags = 0;
+ dat.dwFlags = RVF_TCHAR;
- pszDirName=(LPSTR)mir_alloc(250*sizeof(CHAR));
- pszFileName=(LPSTR)mir_alloc(250*sizeof(CHAR));
+ pszDirName = (LPTSTR)mir_alloc(250*sizeof(TCHAR));
+ pszFileName = (LPTSTR)mir_alloc(250*sizeof(TCHAR));
- iRes = DBGetContactSettingString(NULL,"UserGuide","PathToHelpFile",&dbv);
+ iRes = DBGetContactSettingTString(NULL, "UserGuide", "PathToHelpFile", &dbv);
if (iRes!=0)
{
- strcpy(pszDirName, "%miranda_path%\\Plugins");
- strcpy(pszFileName, "UserGuide.chm");
+ _tcscpy(pszDirName, _T("%miranda_path%\\Plugins"));
+ _tcscpy(pszFileName, _T("UserGuide.chm"));
}
else
- if(strcmp((dbv.pszVal),pszEmptySting)==0)
- {
- strcpy(pszDirName, "%miranda_path%\\Plugins");
- strcpy(pszFileName, "UserGuide.chm");
- mir_free(dbv.pszVal);
+ {
+ if(!_tcscmp((dbv.ptszVal), pszEmptySting))
+ {
+ _tcscpy(pszDirName, _T("%miranda_path%\\Plugins"));
+ _tcscpy(pszFileName, _T("UserGuide.chm"));
+ }
+ else
+ {
+ pszDivider = _tcsrchr(dbv.ptszVal, '\\');
+ if (pszDivider == NULL)
+ {
+ pszDirName = _T("");
+ _tcsncpy(pszFileName, dbv.ptszVal, _tcslen(dbv.ptszVal));
}
- else
+ else
{
- pszDivider = strrchr(dbv.pszVal, '\\');
- if (pszDivider == NULL)
- {
- pszDirName = "";
- strncpy(pszFileName, dbv.pszVal, strlen(dbv.pszVal));
- }
- else
- {
- strncpy(pszFileName, pszDivider+1, strlen(dbv.pszVal)-strlen(pszDivider)-1);
- pszFileName[strlen(dbv.pszVal)-strlen(pszDivider)-1] = 0;
- strncpy(pszDirName, dbv.pszVal, pszDivider-dbv.pszVal);
- pszDirName[pszDivider-dbv.pszVal] = 0;
- }
- mir_free(dbv.pszVal);
+ _tcsncpy(pszFileName, pszDivider + 1, _tcslen(dbv.ptszVal) - _tcslen(pszDivider) - 1);
+ pszFileName[_tcslen(dbv.ptszVal) - _tcslen(pszDivider) - 1] = 0;
+ _tcsncpy(pszDirName, dbv.ptszVal, pszDivider - dbv.ptszVal);
+ pszDirName[pszDivider - dbv.ptszVal] = 0;
}
+ }
+ DBFreeVariant(&dbv);
+ }
if (ServiceExists(MS_UTILS_REPLACEVARS))
- pszDirNameEx = (char *) CallService(MS_UTILS_REPLACEVARS,(WPARAM)pszDirName,(LPARAM)&dat);
+ pszDirNameEx = (TCHAR *) CallService(MS_UTILS_REPLACEVARS, (WPARAM)pszDirName, (LPARAM)&dat);
else
- pszDirNameEx = mir_strdup(pszDirName);
+ pszDirNameEx = mir_tstrdup(pszDirName);
- ShellExecuteA(NULL,"open",pszFileName,NULL,pszDirNameEx,SW_SHOW);
+ ShellExecute(NULL, _T("open"), pszFileName, NULL, pszDirNameEx, SW_SHOW);
mir_free(pszDirName);
mir_free(pszFileName);
mir_free(pszDirNameEx);
@@ -85,14 +86,14 @@ int ModulesLoaded(WPARAM wParam,LPARAM lParam) {
CLISTMENUITEM mi;
- CreateServiceFunction("UserGuide/ShowGuide",ShowGuideFile);
- ZeroMemory(&mi,sizeof(mi));
- mi.cbSize=sizeof(mi);
- mi.position=500000;
- mi.flags=0;
- mi.hIcon=LoadSkinnedIcon(SKINICON_OTHER_HELP);
- mi.pszName=LPGEN("User Guide");
- mi.pszService="UserGuide/ShowGuide";
+ hShowGuide = CreateServiceFunction("UserGuide/ShowGuide", ShowGuideFile);
+ ZeroMemory(&mi, sizeof(mi));
+ mi.cbSize = sizeof(mi);
+ mi.position = 500000;
+ mi.flags = CMIF_TCHAR;
+ mi.hIcon = LoadSkinnedIcon(SKINICON_OTHER_HELP);
+ mi.ptszName = LPGENT("User Guide");
+ mi.pszService = "UserGuide/ShowGuide";
Menu_AddMainMenuItem(&mi);
return 0;
@@ -100,27 +101,28 @@ int ModulesLoaded(WPARAM wParam,LPARAM lParam) BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved)
{
- hInst=hinstDLL;
+ hInst = hinstDLL;
return TRUE;
}
-__declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
+extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
{
return &pluginInfo;
}
-int __declspec(dllexport) Load(PLUGINLINK *link)
+extern "C" __declspec(dllexport) int Load(PLUGINLINK *link)
{
- pluginLink=link;
+ pluginLink = link;
mir_getMMI(&mmi);
mir_getLP(&pluginInfo);
hModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED,ModulesLoaded);
return 0;
}
-int __declspec(dllexport) Unload(void)
+extern "C" __declspec(dllexport) int Unload(void)
{
UnhookEvent(hModulesLoaded);
+ DestroyServiceFunction(hShowGuide);
return 0;
}
\ No newline at end of file |