Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

1812 error when trying to create dialog 2

Status
Not open for further replies.

snuv

Programmer
Oct 30, 2001
751
0
0
GB
I have a very small dll that only contains 1 simple dialog with two member variables

Code:
#define DLLExport _declspec( dllexport )
extern "C"
{
	DLLExport int GetUserLoginAuto(char * pszUserName, BOOL* pbPermission);
}

int GetUserLoginAuto(char * pszUserName, BOOL* pbPermission)
{
	CPermissions test;
	int nRet = test.DoModal();
	*pbPermission = test.m_bAutoLogin;
	if (nRet !=IDOK)
		test.m_nErrorCode = nRet;
	return test.m_nErrorCode;
}

message boxes work ok but the do modal returns -1 and the last error is 1812
Can anyone shed any light on this one?




Go not to cats for advice for they will just walk over the keyboard
 
The problem with MFC DLLs is wrong ResourceHandle (it is the handle of executable called LoadLibrary(), not dll!). You can change this handle with AfxSetResourceHandle(m_Hinst_of_your_dll) and then call DoModal().
Do not forget to restore old handle after it!
 
1812 - ERROR_RESOURCE_DATA_NOT_FOUND.
See MSDN for AFX_MANAGE_STATE macros. There are a lot of articles about 'howto: Properly Export Functions Using the MFC Shared Library' and related DLL/CDialog/DoModal issues (there are some special cases on this topic). May be it helps...
 
Thanks for the help
problem solved
:)


Go not to cats for advice for they will just walk over the keyboard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top