source: trunk/testapp/encodings/test.c@ 21787

Last change on this file since 21787 was 21466, checked in by dmik, 15 years ago

Added encodings test case.

File size: 1.6 KB
Line 
1#include <windows.h>
2#include <stdio.h>
3#include <stdlib.h>
4
5#ifndef _MSC_VER
6
7#include <odinlx.h>
8
9int _main(int argc, char **argv);
10
11int WIN32API WinMain(HANDLE hInstance,
12 HANDLE hPrevInstance,
13 LPSTR lpCmdLine,
14 int nCmdShow)
15{
16 return _main(__argcA, __argvA);
17}
18
19int main(int argc, char **argv)
20{
21 EnableSEH();
22 RegisterLxExe(WinMain, NULL);
23}
24
25#else
26#define _main main
27#endif
28
29int _main(int argc, char **argv)
30{
31 STARTUPINFO si;
32 PROCESS_INFORMATION pi;
33 BOOL rc;
34 char *cmd;
35
36 /* ANSI encoding */
37 MessageBoxA(NULL,
38 "ANSI: Ðóññêèé 1251, ãá᪚© 866",
39 "ANSI: Ðóññêèé 1251, ãá᪚© 866",
40 MB_ICONINFORMATION | MB_OK);
41
42 /* Unicode */
43 MessageBoxW(NULL,
44 L"Unicode: \x0420\x0443\x0441\x0441\x043a\x0438\x0439",
45 L"Unicode: \x0420\x0443\x0441\x0441\x043a\x0438\x0439",
46 MB_ICONINFORMATION | MB_OK);
47
48 /* Command line */
49 printf("1st Command Line argument: \"%s\"\n", argc > 1 ? argv[1] : NULL);
50 MessageBoxA(NULL,
51 argc > 1 ? argv[1] : NULL,
52 "1st Command Line argument",
53 MB_ICONINFORMATION | MB_OK);
54
55 /* Start a command */
56 memset(&pi, 0, sizeof(pi));
57 memset(&si, 0, sizeof(si));
58 si.cb = sizeof(si);
59 cmd = getenv("COMSPEC");
60 rc = CreateProcess(cmd, "cmd.exe /c òåñò.cmd", NULL, NULL, FALSE, 0,
61 NULL, NULL, &si, &pi);
62 printf("CreateProcess returned %d (error %x)\n", rc, GetLastError());
63 if (rc) {
64 printf("dwProcessId %d\n", pi.dwProcessId);
65 }
66
67 return 0;
68}
Note: See TracBrowser for help on using the repository browser.