I have an mfc dll, it was an mfc console application which I want to add the code as dll to a clr c++ aoo.
code of console :
#include <windows.h>
#include <iostream>
#include <complex>
void main()
{
double i,c,d,f,g,e;
HDC hdc = GetDC(GetDesktopWindow());
DWORD ret = GetDeviceCaps(hdc, HORZSIZE);
DWORD ret2 = GetDeviceCaps(hdc, VERTSIZE);
std::cout << "Your screen size in inches is " << ret/25.4 << "\" x " << ret2/25.4 << "\" \n";
ReleaseDC(GetDesktopWindow(), hdc);
i=ret/25.4;
c=ret2/25.4;
d=0;
f=0;
d=((i*i)+(c*c));
g=sqrt(d);
std::cout << "Your screen size in inches is " << g << "\" \n";
getchar();
}
code of mydll.dll (mydll.cpp):
#include "stdafx.h"
#include "mydll.h"
#include <windows.h>
#include <iostream>
#include <complex>
#include <math.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
BEGIN_MESSAGE_MAP(CmydllApp, CWinApp)
END_MESSAGE_MAP()
CmydllApp::CmydllApp()
{
}
CmydllApp theApp;
BOOL CmydllApp::InitInstance()
{
CWinApp::InitInstance();
return TRUE;
}
void MyWin32ClassTwo()
{
double i,c,d,f,g,k;
char l;
HDC hdc = GetDC(GetDesktopWindow());
DWORD ret = GetDeviceCaps(hdc, HORZSIZE);
DWORD ret2 = GetDeviceCaps(hdc, VERTSIZE);
ReleaseDC(GetDesktopWindow(), hdc);
i=ret/25.4;
c=ret2/25.4;
d=0;
f=0;
d=((i*i)+(c*c));
g=sqrt(d);
}
how to create dll and add to win32 form (clr) application and call the dll's g variable, do I have to create function in dll?
simple answer please I am NEW to C++.
In simple how to get the horzsize of monitor in a C++ clr forms Project.
Thank you