
Introduction
How use from a Dll in our programs.
this is a good example for this task.
this Dll is programed by me.(Name of Dll is InfoWindows.dll )
in this Dll , I use from Four Fuctions.
that are :
<P dir=ltr>1. BOOL IsWindowsNT(void)</P><P dir=ltr>2. CString GetPathWindows(void)</P><P dir=ltr>3. CString GetPathSystem(void)</P><P dir=ltr>4. CString GetDriveCDrom(void)</P>
1. Bool IsWindowsNT (void)
we can use this fuction to distinguish winNT from Win98.
2. CString GetPathWindows(void)
we can use this fuction to distinguish path of our installed windows.
3. CString GetPathSystem(void)
we can use this fuction to distinguish path of system folder.
4. CString GetDriveCDrom(void)
we can use this fuction to distinguish path of our CDrom.
Notice:
To useing Dll File we must be Copy Dll file into System Folder of our Windows.
See part of program together :
For Load Dll File , Written this code into OnInitDialog() :
if(gLibMyDLL != NULL)
{
MessageBox("The InfoWindows.Dll Dll has already been loaded");
return 0;
}
gLibMyDLL=LoadLibrary("InfoWidows.dll");</P>
<P> if(gLibMyDLL ==NULL)
{
char
msg[300];
strcpy(msg,"Cannot load the DLL");
strcat(msg,"Make sure that the file DLL");
strcat (msg,"is in your <A href="file://WINDOWS//SYSTEM">file://WINDOWS//SYSTEM</A> directory.");
MessageBox(msg);
}</P>
<P> GetPathWindows=(GETPATHWINDOWS) GetProcAddress (gLibMyDLL,"GetPathWindows");
</P><P> </P><P> GetPathSystem=(GETPATHWINDOWS) GetProcAddress (gLibMyDLL,"GetPathSystem");
</P><P> IsWindowsNT=(ISWINDOWSNT) GetProcAddress (gLibMyDLL,"IsWindowsNT");</P>
<P> GetDriveCDrom=(GETDRIVECDROM) GetProcAddress (gLibMyDLL,"GetDriveCDrom");
//*******************</P>
Continue :
<P>void CUseInfoWindowsDllDlg::OnButtonPathwindows()
{
your control notification handler code here
</P>
<P> if(gLibMyDLL ==NULL)
{</P>
<P> MessageBox("You must first load The DLL
file");
return;
}</P>
<P>m_str2=GetPathWindows();
UpdateData(0);</P>
<P> </P>
<P>}</P>