Click here to Skip to main content
15,904,153 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Opening existing file without checking the file extension Pin
Christian Graus7-May-08 22:24
protectorChristian Graus7-May-08 22:24 
GeneralRe: Opening existing file without checking the file extension Pin
FPeeters7-May-08 22:41
FPeeters7-May-08 22:41 
GeneralRe: Opening existing file without checking the file extension Pin
Iain Clarke, Warrior Programmer8-May-08 4:36
Iain Clarke, Warrior Programmer8-May-08 4:36 
AnswerRe: Opening existing file without checking the file extension Pin
Michael Schubert8-May-08 0:00
Michael Schubert8-May-08 0:00 
AnswerRe: Opening existing file without checking the file extension Pin
David Crow8-May-08 4:11
David Crow8-May-08 4:11 
Questionerror loading functions from dll.... Pin
alex7867-May-08 21:55
alex7867-May-08 21:55 
QuestionRe: error loading functions from dll.... Pin
CPallini7-May-08 22:33
mveCPallini7-May-08 22:33 
AnswerRe: error loading functions from dll.... Pin
Nitheesh George7-May-08 23:09
Nitheesh George7-May-08 23:09 
Hi,

try this

<br />
<br />
#include "stdafx.h"<br />
#include "DLL.h"<br />
<br />
BOOL APIENTRY DllMain( HMODULE hModule,<br />
                       DWORD  ul_reason_for_call,<br />
                       LPVOID lpReserved<br />
					 )<br />
{<br />
	switch (ul_reason_for_call)<br />
	{<br />
	case DLL_PROCESS_ATTACH:<br />
	case DLL_THREAD_ATTACH:<br />
	case DLL_THREAD_DETACH:<br />
	case DLL_PROCESS_DETACH:<br />
		break;<br />
	}<br />
    return TRUE;<br />
}<br />
<br />
// This is an example of an exported variable<br />
DLL_API int nDLL=0;<br />
<br />
// This is an example of an exported function.<br />
extern "C" DLL_API void test(void)<br />
{<br />
	MessageBox(NULL,"TEST","Code Project",MB_OK);<br />
}<br />
<br />
<br />


and in your main application

<br />
typedef void (*MYPROC)(void);<br />
<br />
void CDialogDlg::OnBnClickedButton1()<br />
{<br />
	HMODULE hMod = 0;<br />
	hMod = LoadLibrary("DLL.dll");<br />
	if(hMod == NULL)<br />
	{<br />
		return;<br />
	}<br />
	MYPROC test = 0;<br />
	test = (MYPROC)GetProcAddress(hMod,"test");<br />
	if(!test)<br />
	{<br />
		FreeLibrary(hMod);<br />
		return;<br />
	}<br />
	<br />
	test();<br />
<br />
	FreeLibrary(hMod);<br />
<br />
}<br />
<br />


thanks

Nitheesh
AnswerRe: error loading functions from dll.... Pin
Nitheesh George7-May-08 23:11
Nitheesh George7-May-08 23:11 
Question0xC0000005: Access Violation Pin
Bernaad7-May-08 20:33
Bernaad7-May-08 20:33 
AnswerRe: 0xC0000005: Access Violation Pin
Cedric Moonen7-May-08 20:40
Cedric Moonen7-May-08 20:40 
AnswerRe: 0xC0000005: Access Violation Pin
dehseth7-May-08 20:55
dehseth7-May-08 20:55 
AnswerRe: 0xC0000005: Access Violation Pin
Jonathan [Darka]7-May-08 21:04
professionalJonathan [Darka]7-May-08 21:04 
AnswerRe: 0xC0000005: Access Violation Pin
Hamid_RT7-May-08 21:16
Hamid_RT7-May-08 21:16 
AnswerRe: 0xC0000005: Access Violation Pin
CPallini7-May-08 21:33
mveCPallini7-May-08 21:33 
GeneralRe: 0xC0000005: Access Violation Pin
Bernaad8-May-08 0:14
Bernaad8-May-08 0:14 
Questionprinting Pin
bijumon Mathew7-May-08 20:28
bijumon Mathew7-May-08 20:28 
AnswerRe: printing Pin
Hamid_RT7-May-08 20:45
Hamid_RT7-May-08 20:45 
QuestionURLDownloadToCacheFile() or URLDownloadToFile() question Pin
monsieur_jj7-May-08 20:27
monsieur_jj7-May-08 20:27 
AnswerRe: URLDownloadToCacheFile() or URLDownloadToFile() question Pin
Hamid_RT7-May-08 20:48
Hamid_RT7-May-08 20:48 
GeneralRe: URLDownloadToCacheFile() or URLDownloadToFile() question Pin
monsieur_jj7-May-08 20:50
monsieur_jj7-May-08 20:50 
GeneralRe: URLDownloadToCacheFile() or URLDownloadToFile() question Pin
David Crow8-May-08 4:27
David Crow8-May-08 4:27 
AnswerRe: URLDownloadToCacheFile() or URLDownloadToFile() question Pin
Garth J Lancaster7-May-08 23:21
professionalGarth J Lancaster7-May-08 23:21 
QuestionRe: URLDownloadToCacheFile() or URLDownloadToFile() question Pin
David Crow8-May-08 4:22
David Crow8-May-08 4:22 
QuestionHow to get the following date and time format Pin
pl_kode7-May-08 20:10
pl_kode7-May-08 20:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.