本文整理汇总了C++中CharToOem函数的典型用法代码示例。如果您正苦于以下问题:C++ CharToOem函数的具体用法?C++ CharToOem怎么用?C++ CharToOem使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CharToOem函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: EnumWindowProc
BOOL CALLBACK EnumWindowProc(HWND hWnd, LPARAM lparam)
{
char cBuf[MAX_PATH] = "";
DWORD dwPid = 0;
DWORD dwTid = GetWindowThreadProcessId(hWnd, &dwPid);
if (bNoHidden)
if (!IsWindowVisible(hWnd) | !IsWindowEnabled(hWnd))
return TRUE;
if (dwFindPid)
if (dwFindPid != dwPid)
return TRUE;
++dwWndCount;
printf("%i\t%i\t", dwPid, dwTid);
GetClassName(hWnd, cBuf, sizeof cBuf);
CharToOem(cBuf, cBuf);
printf("%s\\", cBuf);
GetWindowText(hWnd, cBuf, sizeof cBuf);
CharToOem(cBuf, cBuf);
printf("%s\n", cBuf);
if (bEnumChildren)
EnumChildWindows(hWnd, (WNDENUMPROC)EnumChildWindowProc, 0);
return TRUE;
}
开发者ID:richardneish,项目名称:ltrdata,代码行数:30,代码来源:enumwin.c
示例2: EnumChildWindowProc
BOOL CALLBACK
EnumChildWindowProc(HWND hWnd, LPARAM lparam)
{
char cBuf[MAX_PATH] = "";
int i;
if (bNoHidden)
if (!IsWindowVisible(hWnd) | !IsWindowEnabled(hWnd))
return TRUE;
++dwChildrenCount;
++iLevel;
putch('\t');
for (i = iLevel; i; i--)
putch('\t');
putch('\t');
GetClassName(hWnd, cBuf, sizeof cBuf);
CharToOem(cBuf, cBuf);
printf("%s\\", cBuf);
GetWindowText(hWnd, cBuf, sizeof cBuf);
CharToOem(cBuf, cBuf);
printf("%s\n", cBuf);
EnumChildWindows(hWnd, (WNDENUMPROC)EnumChildWindowProc, 0);
--iLevel;
return TRUE;
}
开发者ID:richardneish,项目名称:ltrdata,代码行数:30,代码来源:enumwin.c
示例3: dbase_loadFromFile
/* ф-ция загрузки БД из файла в оперативную память */
void dbase_loadFromFile(char *fname) {
FILE *binFile = NULL;
unsigned long lSize;
size_t result;
binFile = fopen(fname, "rb");
if (binFile == NULL) {
CharToOem("Ошибка! Файл недоступен!", oem_str);
printf("%s\n", oem_str);
getch();
exit(1);
}
fseek(binFile, 0, SEEK_END);
lSize = ftell(binFile);
rewind (binFile);
empCount = lSize / sizeof(orgDBase);
orgDBArray = (orgDBase*)malloc(sizeof(orgDBase) * lSize);
if (orgDBArray == NULL) {
CharToOem("Ошибка памяти!", oem_str);
printf("%s\n", oem_str);
exit(2);
}
result = fread(orgDBArray, 1, lSize, binFile);
if (result != lSize) {
CharToOem("Ошибка чтения файла!", oem_str);
printf("%s\n", oem_str);
exit (3);
}
fclose(binFile);
}
开发者ID:d1v0id,项目名称:UniversityProjects,代码行数:34,代码来源:cw.cpp
示例4: menu
void menu()
{
char *str=new char[100];
CharToOem("b - нажать кнопку для приготовления еды",str);
printf("\n%s\n",str);
CharToOem("d - открыть/закрыть дверь",str);
printf("%s\n",str);
CharToOem("ESC - выход",str);
printf("%s\n\n",str);
}
开发者ID:xhikki,项目名称:univer,代码行数:10,代码来源:stove.cpp
示例5: PrintShortDateAndTime
EXTERN_C VOID CDECL PrintShortDateAndTime(SYSTEMTIME *st)
{
char cBuf[160];
if (GetDateFormat(LOCALE_USER_DEFAULT, 0, st, NULL, cBuf, sizeof cBuf))
{
CharToOem(cBuf, cBuf);
printf("%s ", cBuf);
}
if (GetTimeFormat(LOCALE_USER_DEFAULT, 0, st, NULL, cBuf, sizeof cBuf))
{
CharToOem(cBuf, cBuf);
fputs(cBuf, stdout);
}
}
开发者ID:richardneish,项目名称:ltrdata,代码行数:15,代码来源:wtime.c
示例6: GetFileOwner
int GetFileOwner (const char *Computer, const char *Name, char *Owner)
{
SECURITY_INFORMATION si = OWNER_SECURITY_INFORMATION|GROUP_SECURITY_INFORMATION;
SECURITY_DESCRIPTOR *sd;
char sddata[500];
*Owner=0;
sd=(SECURITY_DESCRIPTOR *)sddata;
char AnsiName[NM];
OemToChar(Name,AnsiName);
SetFileApisToANSI();
DWORD Needed;
int GetCode=GetFileSecurity(AnsiName,si,sd,sizeof(sddata),&Needed);
SetFileApisToOEM();
if (!GetCode || (Needed>sizeof(sddata)))
return(FALSE);
PSID pOwner;
BOOL OwnerDefaulted;
if (!GetSecurityDescriptorOwner(sd,&pOwner,&OwnerDefaulted))
return(FALSE);
char AccountName[200],DomainName[200];
DWORD AccountLength=sizeof(AccountName),DomainLength=sizeof(DomainName);
SID_NAME_USE snu;
if (!LookupAccountSid(Computer,pOwner,AccountName,&AccountLength,DomainName,&DomainLength,&snu))
return(FALSE);
CharToOem(AccountName,Owner);
return(TRUE);
}
开发者ID:BackupTheBerlios,项目名称:far-unlimited-svn,代码行数:29,代码来源:FAR_SF.cpp
示例7: ansi_emulate_write
static int ansi_emulate_write(int fd, const void *buf, size_t count)
{
int rv = 0, i;
const char *s = (const char *)buf;
char *pos, *str;
size_t len, out_len;
static size_t max_len = 0;
static char *mem = NULL;
/* if no special treatment is required output the string as-is */
for ( i=0; i<count; ++i ) {
if ( s[i] == '\033' || s[i] > 0x7f ) {
break;
}
}
if ( i == count ) {
return write(fd, buf, count);
}
/* make a writable copy of the data and retain it for reuse */
if ( count > max_len ) {
free(mem);
mem = malloc(count+1);
max_len = count;
}
memcpy(mem, buf, count);
mem[count] = '\0';
pos = str = mem;
/* we're writing to the console so we assume the data isn't binary */
while (*pos) {
pos = strstr(str, "\033[");
if (pos) {
len = pos - str;
if (len) {
CharToOemBuff(str, str, len);
out_len = write(fd, str, len);
rv += out_len;
if (out_len < len)
return rv;
}
str = pos + 2;
rv += 2;
pos = (char *)set_attr(str);
rv += pos - str;
str = pos;
} else {
len = strlen(str);
rv += len;
CharToOem(str, str);
write(fd, str, len);
return rv;
}
}
return rv;
}
开发者ID:Dialga,项目名称:busybox-w32,代码行数:60,代码来源:winansi.c
示例8: main
void main(int argc, char **argv) {
HINSTANCE hinst;
WCHAR buffer[128];
unsigned char winbuf[128],oembuf[128];
unsigned int number;
if (argc <3)
return;
hinst = LoadLibrary(argv[1]);
number = atoi(argv[2]);
printf("Load String returns %i\n",
LoadStringW(hinst, number, buffer, sizeof(buffer)));
WideCharToMultiByte(CP_OEMCP,
0,
buffer,
-1,
winbuf,
128,
NULL,
NULL);
CharToOem(winbuf,oembuf);
printf("oem: %s\n",oembuf);
}
开发者ID:phase,项目名称:tcsh,代码行数:28,代码来源:test.c
示例9: do_query
void do_query(const SOCKET sock, const char *query)
{
char buf[2000];
int i = 0, hide = hide_discl;
if (send(sock, query, (int) strlen(query), 0) == SOCKET_ERROR)
err_exit("send");
/* Using shutdown breaks the buggy RIPE server.
if (shutdown(sock, 1) == SOCKET_ERROR)
err_exit("shutdown");
*/
for (;;) {
if (LineRecv((HANDLE)sock, buf, sizeof(buf), 60000) == 0)
if (win_errno != ERROR_SUCCESS)
if (win_errno == ERROR_HANDLE_EOF)
break;
else
err_exit("Receive error");
if (hide == 1) {
if (strncmp(buf, hide_strings[i+1], strlen(hide_strings[i+1]))==0)
hide = 2; /* stop hiding */
continue; /* hide this line */
}
if (hide == 0) {
for (i = 0; hide_strings[i] != NULL; i += 2) {
if (strncmp(buf, hide_strings[i], strlen(hide_strings[i]))==0){
hide = 1; /* start hiding */
break;
}
}
if (hide == 1)
continue; /* hide the first line */
}
#ifdef EXT_6BONE
/* % referto: whois -h whois.arin.net -p 43 as 1 */
if (strncmp(buf, "% referto:", 10) == 0) {
char nh[256], np[16], nq[1024];
if (sscanf(buf, REFERTO_FORMAT, nh, np, nq) == 3) {
SOCKET fd;
if (verb)
printf(_("Detected referral to %s on %s.\n"), nq, nh);
strcat(nq, "\r\n");
fd = openconn(nh, np);
do_query(fd, nq);
continue;
}
}
#endif
CharToOem(buf, buf);
puts(buf);
}
if (hide == 1)
err_quit(_("Catastrophic error: disclaimer text has been changed.\r\n"
"Please upgrade this program.\r\n"));
}
开发者ID:richardneish,项目名称:ltrdata,代码行数:60,代码来源:whois.c
示例10: GetWin32Error
LPSTR GetWin32Error()
{
int err = GetLastError();
LPSTR lpMsgBuf;
if (!FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
err,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR) &lpMsgBuf,
0,
NULL))
{
return "FormatMessage failed";
}
size_t x = strlen(lpMsgBuf);
if (x >= 2 && lpMsgBuf[x - 1] == 0x0A && lpMsgBuf[x - 2] == 0x0D)
{
lpMsgBuf[x - 2] = '\0';
}
static CHAR s[512];
_snprintf(s, sizeof(s), "%s", lpMsgBuf);
CharToOem(s, s);
LocalFree(lpMsgBuf);
return s;
}
开发者ID:B-Rich,项目名称:CATS,代码行数:34,代码来源:test.cpp
示例11: CharToOem
//---------------------------------------------------------------------
void FileSystemLayerImpl::prepareUserHome(const Ogre::String& subdir)
{
TCHAR path[MAX_PATH];
if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_PERSONAL|CSIDL_FLAG_CREATE, NULL, 0, path)))
{
// need to convert to OEM codepage so that fstream can use
// it properly on international systems.
TCHAR oemPath[MAX_PATH];
CharToOem(path, oemPath);
mHomePath = oemPath;
// create Ogre subdir
mHomePath += "\\Ogre\\";
if (! CreateDirectory(mHomePath.c_str(), NULL) && GetLastError() != ERROR_ALREADY_EXISTS)
{
// couldn't create directory, fall back to current working dir
mHomePath.clear();
}
else
{
mHomePath += subdir + '\\';
// create release subdir
if (! CreateDirectory(mHomePath.c_str(), NULL) && GetLastError() != ERROR_ALREADY_EXISTS)
{
// couldn't create directory, fall back to current working dir
mHomePath.clear();
}
}
}
if (mHomePath.empty())
{
// couldn't create dir in home directory, fall back to cwd
mHomePath = "";
}
}
开发者ID:logtcn,项目名称:ogre,代码行数:36,代码来源:FileSystemLayerImpl_WIN32.cpp
示例12: SystemStringToOemString
AString SystemStringToOemString(const CSysString &srcString)
{
AString result;
CharToOem(srcString, result.GetBuffer(srcString.Length() * 2));
result.ReleaseBuffer();
return result;
}
开发者ID:cugxiangzhenwei,项目名称:MySrcCode,代码行数:7,代码来源:StringConvert.cpp
示例13: while
void stove::Run(void)
{
int i,flag=0;
char *str=new char[100];
char *str1=new char[100];
while (flag!=1)
{
while (!kbhit() && time>0)
{
time--;
Sleep(100);
sprintf(str1,"Осталось %d секунд",time);
CharToOem(str1,str);
printf("%s\n",str);
}
if (time==0)
{
strcpy(str,ready());
printf("%s\n",str);
}
if (time==-1)
menu();
i=getch();
switch (i)
{ case 'b': strcpy(str,push_button()); break;
case 'd': strcpy(str,take_door()); break;
case 27: flag=1; break;
}
fflush(stdin);
if (i=='b' || i=='d')
printf("%s\n",str);
}
return;
}
开发者ID:xhikki,项目名称:univer,代码行数:34,代码来源:stove.cpp
示例14: ExternalFilter
int ExternalFilter(const char *Command, const char *Keyword, const char *Output, char *Error)
{
char CommandLine[2048];
lstrcpy(CommandLine,"%COMSPEC% /C ");
FSF.ExpandEnvironmentStr(CommandLine,CommandLine,sizeof(CommandLine));
MakeCommandLine(CommandLine+lstrlen(CommandLine),Command,Keyword,Output);
STARTUPINFO si={0};
si.cb=sizeof(si);
PROCESS_INFORMATION pi;
int ret = CreateProcess(NULL,CommandLine,NULL,NULL,TRUE,0,NULL,NULL,&si,&pi);
if (!ret)
{
LPSTR MessageBuffer;
DWORD dwFormatFlags = FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_IGNORE_INSERTS|FORMAT_MESSAGE_FROM_SYSTEM;
DWORD dwBufferLength = FormatMessageA(dwFormatFlags,NULL,GetLastError(),MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT),(LPSTR)&MessageBuffer,0,NULL);
lstrcpyn(Error,MessageBuffer,dwBufferLength>128?128:dwBufferLength);
CharToOem(Error,Error);
}
else
{
WaitForSingleObject(pi.hProcess,INFINITE);
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
}
return ret;
}
开发者ID:CS-svnmirror,项目名称:evil-programmers,代码行数:26,代码来源:ahp_custom.cpp
示例15: MSHelp2
int MSHelp2(const char *Keyword, const char *FileName, char *Error)
{
char CommandLine[2048];
if (Keyword)
MakeCommandLine(CommandLine,PathToViewer,KeywordSearch,FileName,Keyword);
else
MakeCommandLine(CommandLine,PathToViewer,OpenContents,FileName,Keyword);
STARTUPINFO si={0};
si.cb=sizeof(si);
PROCESS_INFORMATION pi;
int ret = CreateProcess(NULL,CommandLine,NULL,NULL,TRUE,0,NULL,NULL,&si,&pi);
if (!ret)
{
LPSTR MessageBuffer;
DWORD dwFormatFlags = FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_IGNORE_INSERTS|FORMAT_MESSAGE_FROM_SYSTEM;
DWORD dwBufferLength = FormatMessageA(dwFormatFlags,NULL,GetLastError(),MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT),(LPSTR)&MessageBuffer,0,NULL);
lstrcpyn(Error,MessageBuffer,dwBufferLength>128?128:dwBufferLength);
CharToOem(Error,Error);
}
else
{
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
}
return ret;
}
开发者ID:CS-svnmirror,项目名称:evil-programmers,代码行数:26,代码来源:ahp_mshelp2.cpp
示例16: ShowStrings
static void ShowStrings(void *const info, const DWORD lang)
{
#define ARRAY_LEN(Array) (sizeof(Array) / sizeof(Array[0]))
char *stringnames[] =
{"Comments",
"CompanyName",
"FileDescription",
"FileVersion",
"InternalName",
"LegalCopyright",
"LegalTrademarks",
"OriginalFilename",
"PrivateBuild",
"ProductName",
"ProductVersion",
"SpecialBuild"
};
int i;
for (i = 0; i < ARRAY_LEN(stringnames); i++)
{
char query[500];
LPSTR value;
UINT len;
sprintf(query, "\\StringFileInfo\\%04x%04x\\%s", LOWORD(lang), HIWORD(lang), stringnames[i]);
if (!VerQueryValue(info, query, &value, &len) || !len)
continue;
CharToOem(value, value);
printf(" %-16s: %s\n", stringnames[i], value);
}
#undef ARRAY_LEN
}
开发者ID:death,项目名称:pelib,代码行数:35,代码来源:versinfo.c
示例17: installer_uninstall
bool
installer_uninstall(struct installer *inst)
{
int ret;
char batname[PATH_MAX];
char *script = NULL;
char pname[MAX_PATH];
assert(inst != NULL);
DEBUG(LOG_DEFAULT, "self deleting\n");
//йобаная винда
CharToOem(inst->pname, pname);
if (!file_create_temp_file(batname, sizeof(batname), NULL, ".bat"))
return false;
ret = str_sprintf_ex(&script,
"@echo off\r\n"
":loop\r\n"
"del \"%s\"\r\n"
"if exist \"%s\" goto loop\r\n"
/* "del \"%s\"\r\n"*/,
pname, pname, batname);
if (ret != true)
return false;
DEBUG(LOG_VERBOSE, "builded script: %s\n", batname);
if (!file_write_to_file(batname, script, str_len(script)))
return false;
/* run bat file */
{
STARTUPINFO si;
PROCESS_INFORMATION pi;
char *cmdline = NULL;
ret = str_sprintf_ex(&cmdline,
"%s /c \"%s\"", "cmd.exe", batname);
DEBUG(LOG_VERBOSE, "cmd line is: %s\n", cmdline);
ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
si.dwFlags = STARTF_USESHOWWINDOW;
si.wShowWindow = SW_HIDE;
CreateProcessA(NULL, cmdline,
NULL, NULL,
false, 0,
NULL, NULL,
&si, &pi);
win_perror("createprocess");
free (cmdline);
}
free(script);
exit(0);
err:
DEBUG(LOG_DEFAULT, "can't destroy myself=(\n");
file_delete(batname);
return false;
}
开发者ID:dzruyk,项目名称:win-malware-tests,代码行数:60,代码来源:coreinstall.c
示例18: main
int main(int argc, char **argv)
{
if (argc == 1)
{
puts("stdin:");
print_info(hStdIn);
return 0;
}
while (argc > 1)
{
DWORD dwFileAttr = GetFileAttributes(argv[1]);
if (dwFileAttr == INVALID_FILE_ATTRIBUTES)
dwFileAttr = 0;
HANDLE h = CreateFile(argv[1], 0, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL,
OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS |
(dwFileAttr & FILE_ATTRIBUTE_REPARSE_POINT ?
FILE_FLAG_OPEN_REPARSE_POINT : 0), NULL);
if (h == INVALID_HANDLE_VALUE)
win_perror(argv[1]);
else
{
CharToOem(argv[1], argv[1]);
printf("\nFilename: %s\n", argv[1]);
print_info(h);
CloseHandle(h);
}
argc--;
argv++;
}
}
开发者ID:richardneish,项目名称:ltrdata,代码行数:34,代码来源:fileinfo.cpp
示例19: GetIOErrorS_
/** @brief Returns text description for error code.
@param Error Optional error code to describe.
@return Constant string with error description.
If error code set to FIO_ERROR_NONE function returns description for
last RTL error.
*/
CONSTSTR MYRTLEXP GetIOErrorS_( FIO_ERR_TYPE Error, BOOL decode )
{
if ( Error == FIO_ERROR_NONE || Error == ERROR_STD )
Error = _FIO_ERRORN;
if ( ((unsigned)Error) < MAX_ERRNUM ) {
#if defined(__HWIN32__)
if ( decode ) {
static char errorbuf[ MAX_PATH_SIZE ];
CharToOem( _OSErrorS(Error),errorbuf );
return errorbuf;
}
#endif
return _OSErrorS(Error);
}
if ( Error == ERROR_USER )
return MyErrors[0];
Error -= MAX_ERRNUM;
if ( Error < ARRAY_SIZE(MyErrors) )
return MyErrors[ Error ];
return "Unknown error";
}
开发者ID:CS-svnmirror,项目名称:farmanager,代码行数:32,代码来源:io_err.cpp
示例20: strdup
void LoggableFrontend::PrintMessage(Message * pMessage)
{
#ifdef WIN32
char* msg = strdup(pMessage->GetText());
CharToOem(msg, msg);
#else
const char* msg = pMessage->GetText();
#endif
switch (pMessage->GetKind())
{
case Message::mkDebug:
printf("[DEBUG] %s\n", msg);
break;
case Message::mkError:
printf("[ERROR] %s\n", msg);
break;
case Message::mkWarning:
printf("[WARNING] %s\n", msg);
break;
case Message::mkInfo:
printf("[INFO] %s\n", msg);
break;
case Message::mkDetail:
printf("[DETAIL] %s\n", msg);
break;
}
#ifdef WIN32
free(msg);
#endif
}
开发者ID:0BruceWayne0,项目名称:nzbget,代码行数:30,代码来源:LoggableFrontend.cpp
注:本文中的CharToOem函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论