Repo3/main.c

79 lines
2.1 KiB
C

#define _CRT_SECURE_NO_WARNINGS
#define _UNICODE
#define UNICODE
#include <windows.h>
#include <direct.h>
#include <fcntl.h>
#include <io.h>
#include <stdio.h>
#include <tchar.h>
#include <locale.h>
#include <string.h>
#include <wchar.h>
#include <sys/types.h>
#include <sys/stat.h>
extern __declspec(dllimport) void printCreateDirectory();
int main(void)
{
HINSTANCE mylib = LoadLibrary(L"MyLib.dll");
if (mylib == NULL) {
_tprintf(_T("Îøèáóêà"));
return 1;
}
typedef void (*SystemParameters)(wchar_t *);
SystemParameters printSystemParametersInfo;
printSystemParametersInfo = (SystemParameters)GetProcAddress(mylib,"printSystemParametersInfo");
// ïðîãðàììà òîëüêî äëÿ UNICODE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
const wchar_t str[] = L"help";
const wchar_t str1[] = L"exit";
const wchar_t str2[] = L"systemP";
const wchar_t str3[] = L"getD";
const wchar_t str4[] = L"getP";
const wchar_t str5[] = L"setC";
_setmode(_fileno(stdin), _O_U16TEXT);
_setmode(_fileno(stdout), _O_U16TEXT);
_setmode(_fileno(stderr), _O_U16TEXT);
printCreateDirectory();
wchar_t comand[50];
//setlocale(LC_ALL, ".UTF8");
_tprintf(_T("Çäðàâñòâóéòå, â ñâÿçè ñ àòàêîé òåððîðèñòîâ íà ìîå âîîáðàæåíèå ýòà ïðîãðàììà ïîëó÷èëà íàçâàíèå \"Ïðîãðàììà3\"\n"));
while (1) {
_tprintf(_T("Ââåäèòå êîìàíäó: "));
fgetws(comand, sizeof(comand), stdin);
comand[wcslen(comand) - 1] = 0;
if (!wcscmp(comand, str)) {
_tprintf(_T("Òóò äîëæåí áûòü ñïèñîê äîñòóïíûõ êîìàíä, íî åãî íåò - êàê æàëü(\n"));
}
else if (!wcscmp(comand, str1)) {
_tprintf(_T("Ïðîèçîøåë âûõîä èç ïðîãðàììû!\n"));
break;
}
else if (!wcscmp(comand, str2)) {
wchar_t str[255];
printSystemParametersInfo(str, 255);
_tprintf(_T("Ðèñóíîê ñ ðàáî÷åãî ñòîëà ëåæèò â: %s!\n"), str);
}
else {
_tprintf(_T("Íåâåðíàÿ êîìàíäà!\n"));
}
}
return 0;
}