Remove all hardcode string to En.rc

so it can be translate

svn path=/trunk/; revision=15243
This commit is contained in:
Magnus Olsen 2005-05-12 19:31:10 +00:00
parent d344ac5409
commit 08142b98ea
3 changed files with 35 additions and 4 deletions

View file

@ -0,0 +1,12 @@
#include "resource.h"
/*
* Moved all hardcoded strings to En.rc.
* By Magnus Olsen 2005 magnus@itkonsult-olsen.com
*/
LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
STRINGTABLE DISCARDABLE
{
IDS_DllNotLoaded, "LoadLibrary failed to load \'%s\'"
IDS_MissingEntry, "Missing entry point:%s\nIn %s"
}

View file

@ -0,0 +1,7 @@
#define RC_STRING_MAX_SIZE 200
#define IDS_DllNotLoaded 100
#define IDS_MissingEntry 101
/* EOF */

View file

@ -28,6 +28,7 @@
#include <string.h>
#include <malloc.h>
#include <tchar.h>
#include "resource.h"
typedef int (WINAPI *DllWinMainW)(
HWND hWnd,
@ -42,13 +43,17 @@ typedef int (WINAPI *DllWinMainA)(
int nCmdShow
);
/*
LPCTSTR DllNotLoaded = _T("LoadLibrary failed to load \"%s\"");
LPCTSTR MissingEntry = _T("Missing entry point:%s\nIn %s");
*/
LPCTSTR rundll32_wtitle = _T("rundll32");
LPCTSTR rundll32_wclass = _T("rundll32_window");
TCHAR ModuleFileName[MAX_PATH+1];
LPTSTR ModuleTitle;
// CommandLineToArgv converts a command-line string to argc and
// argv similar to the ones in the standard main function.
// This is a specialized version coded specifically for rundll32
@ -327,6 +332,8 @@ int WINAPI WinMain(
)
{
int argc;
TCHAR szMsg[RC_STRING_MAX_SIZE];
LPTSTR *argv;
LPTSTR lptCmdLine,lptDllName,lptFuncName,lptMsgBuffer;
LPSTR lpFuncName,lpaCmdLine;
@ -440,8 +447,10 @@ int WINAPI WinMain(
else {
// The specified dll function was not found; display an error message
GetModuleTitle();
lptMsgBuffer = (LPTSTR)malloc((_tcslen(MissingEntry) - 4 + _tcslen(lptFuncName) + _tcslen(lptDllName) + 1) * sizeof(TCHAR));
_stprintf(lptMsgBuffer,MissingEntry,lptFuncName,lptDllName);
LoadString( GetModuleHandle(NULL), IDS_MissingEntry, (LPTSTR) szMsg,RC_STRING_MAX_SIZE);
lptMsgBuffer = (LPTSTR)malloc((_tcslen(szMsg) - 4 + _tcslen(lptFuncName) + _tcslen(lptDllName) + 1) * sizeof(TCHAR));
_stprintf(lptMsgBuffer,szMsg,lptFuncName,lptDllName);
MessageBox(0,lptMsgBuffer,ModuleTitle,MB_ICONERROR);
free(lptMsgBuffer);
}
@ -455,8 +464,11 @@ int WINAPI WinMain(
else {
// The dll could not be loaded; display an error message
GetModuleTitle();
lptMsgBuffer = (LPTSTR)malloc((_tcslen(DllNotLoaded) - 2 + _tcslen(lptDllName) + 1) * sizeof(TCHAR));
_stprintf(lptMsgBuffer,DllNotLoaded,lptDllName);
LoadString( GetModuleHandle(NULL), IDS_DllNotLoaded, (LPTSTR) szMsg,RC_STRING_MAX_SIZE);
lptMsgBuffer = (LPTSTR)malloc((_tcslen(szMsg) - 2 + _tcslen(lptDllName) + 1) * sizeof(TCHAR));
_stprintf(lptMsgBuffer,szMsg,lptDllName);
MessageBox(0,lptMsgBuffer,ModuleTitle,MB_ICONERROR);
free(lptMsgBuffer);
}