|
// Test1.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "windows.h"
#include "conio.h"
typedef TCHAR* (*PGETFUN)(TCHAR* key);
typedef void (*PSETFUN)(TCHAR* key, TCHAR* value);
int _tmain(int argc, _TCHAR* argv[])
{
HMODULE hModule = LoadLibrary(L"SharedMem.dll");
PSETFUN setfuncptr = (PSETFUN)GetProcAddress(hModule, "SetValue");
PGETFUN getfuncptr = (PGETFUN)GetProcAddress(hModule, "GetValue");
while(true){
printf("\nPress S=Set G=Get E=Exit\n");
switch(_getch())
{
case 'S':
{
printf("Enter Key Value Now :");
TCHAR key[MAX_PATH], value[MAX_PATH];
scanf("%S %S", key, value);
setfuncptr(key, value);
}
break;
case 'G':
{
printf("Enter Lookup Key: ");
TCHAR key[MAX_PATH];
scanf("%S",key);
printf("Found Value %S", getfuncptr(key));
}
break;
case 'E':
goto end;
break;
}
}
end:
return 0;
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.