本文整理匯總了C++中CharToOem函數的典型用法代碼示例。如果您正苦於以下問題:C++ CharToOem函數的具體用法?C++ CharToOem怎麽用?C++ CharToOem使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了CharToOem函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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;
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
}
示例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);
}
示例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;
}
示例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);
}
示例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"));
}
示例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;
}
示例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 = "";
}
}
示例12: SystemStringToOemString
AString SystemStringToOemString(const CSysString &srcString)
{
AString result;
CharToOem(srcString, result.GetBuffer(srcString.Length() * 2));
result.ReleaseBuffer();
return result;
}
示例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;
}
示例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;
}
示例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;
}