Click here to Skip to main content
15,885,951 members
Home / Discussions / C#
   

C#

 
AnswerRe: Button navigate [modified] Pin
Ian Shlasko30-Sep-09 9:23
Ian Shlasko30-Sep-09 9:23 
GeneralRe: Button navigate Pin
Texas38930-Sep-09 11:10
Texas38930-Sep-09 11:10 
QuestionProblem executing a named pipe service Pin
AndyASPVB30-Sep-09 8:55
AndyASPVB30-Sep-09 8:55 
AnswerRe: Problem executing a named pipe service Pin
Ian Shlasko30-Sep-09 9:26
Ian Shlasko30-Sep-09 9:26 
GeneralRe: Problem executing a named pipe service Pin
AndyASPVB30-Sep-09 9:51
AndyASPVB30-Sep-09 9:51 
GeneralRe: Problem executing a named pipe service Pin
saber.softs30-Sep-09 11:02
saber.softs30-Sep-09 11:02 
GeneralRe: Problem executing a named pipe service Pin
AndyASPVB1-Oct-09 10:43
AndyASPVB1-Oct-09 10:43 
QuestionLoadLibrary gets stuck when calling it from a thread that is not the main thread Pin
Alexeirob30-Sep-09 7:50
Alexeirob30-Sep-09 7:50 
Hi,

I have the weirdest problem.
I have a method in C# that call a function from a dll in MFC which preforms LoadLibrary() to another MFC dll.
When I'm calling this C# method from the main thread, everything is works great.
However, when I'm creating a thread (in c#) and calling the same function, the LoadLibrary in the second dll gets stuck, i.e. not returns.

And i tried also AfxLoadLibrary(), gets the same problem.



//C# code:

        [DllImport("UpdateDB.dll")]
        public static extern bool UpdateCommandsDB(String strDllPath, String strDBPath, ref string strError, bool bAppSideDB);

bRes = UpdateCommandsDB(m_sCommandDllPath, DBFilePath, ref sError, false);

//Second Dll code:
extern "C" __declspec(dllexport) BOOL UpdateCommandsDB(LPCTSTR strDllPath,LPCTSTR strDBPath, CString &strError, bool bAppSideDB)
{
	typedef bool(UPDATE_COMMANDS_DB_FUNC)(LPCTSTR, CString&, bool);
	bool bRes;
	AfxMessageBox(strDllPath);
	AfxMessageBox(strDBPath);
	HINSTANCE hDll = AfxLoadLibrary(strDllPath); //-this gets stuck
	//HINSTANCE hDll = AfxLoadLibraryEx(strDllPath,NULL,DONT_RESOLVE_DLL_REFERENCES);//Gets exception when trying to run the method
	AfxMessageBox(hDll?_T("hDll OK"):_T("hDll NOK"));
	UPDATE_COMMANDS_DB_FUNC *lpUpdateCommandsDB = (UPDATE_COMMANDS_DB_FUNC *)::GetProcAddress(hDll, "UpdateCommandsDB");
	AfxMessageBox(lpUpdateCommandsDB?_T("lpUpdateCommandsDB OK"):_T("lpUpdateCommandsDB NOK"));
	bRes = lpUpdateCommandsDB(strDBPath, strError, bAppSideDB);
	AfxMessageBox(bRes?_T("bRes OK"):_T("bRes NOK"));
	::AfxFreeLibrary(hDll);
	return bRes;
}


Please Help Smile | :)
QuestionMultiple log4net files. Pin
Albu Marius30-Sep-09 5:00
Albu Marius30-Sep-09 5:00 
AnswerRe: Multiple log4net files. Pin
Albu Marius1-Oct-09 0:28
Albu Marius1-Oct-09 0:28 
QuestionThe underlying provider failed on Open Pin
abbd30-Sep-09 4:23
abbd30-Sep-09 4:23 
AnswerRe: The underlying provider failed on Open Pin
Matt Meyer30-Sep-09 5:26
Matt Meyer30-Sep-09 5:26 
QuestionRe: The underlying provider failed on Open Pin
abbd30-Sep-09 6:20
abbd30-Sep-09 6:20 
AnswerRe: The underlying provider failed on Open Pin
Not Active30-Sep-09 6:42
mentorNot Active30-Sep-09 6:42 
AnswerRe: The underlying provider failed on Open Pin
Max Paulousky24-Oct-09 11:10
Max Paulousky24-Oct-09 11:10 
QuestionPDF is not shown in Windows Form Pin
Abdul Rahman Hamidy30-Sep-09 4:13
Abdul Rahman Hamidy30-Sep-09 4:13 
QuestionEvent Trigger Pin
eyalle30-Sep-09 4:00
eyalle30-Sep-09 4:00 
AnswerRe: Event Trigger Pin
Md. Marufuzzaman30-Sep-09 5:46
professionalMd. Marufuzzaman30-Sep-09 5:46 
QuestionRegistry problem with 64-bit Vista Pin
Sifar - 030-Sep-09 3:53
Sifar - 030-Sep-09 3:53 
AnswerRe: Registry problem with 64-bit Vista Pin
monstale30-Sep-09 4:16
monstale30-Sep-09 4:16 
Questionhow to use Update command from tableadapter Pin
kalevikas30-Sep-09 3:49
kalevikas30-Sep-09 3:49 
AnswerRe: how to use Update command from tableadapter Pin
Henry Minute30-Sep-09 6:02
Henry Minute30-Sep-09 6:02 
QuestionHow can i let the user insert a new values into a combobox inside of datagridview Pin
bonzaiholding30-Sep-09 3:27
bonzaiholding30-Sep-09 3:27 
QuestionWhy Don't Change Server Time? (Please Help, It is very urgent) Pin
Hamid Khezeli30-Sep-09 3:02
Hamid Khezeli30-Sep-09 3:02 
AnswerRe: Why Don't Change Server Time? (Please Help, It is very urgent) Pin
Luc Pattyn30-Sep-09 3:19
sitebuilderLuc Pattyn30-Sep-09 3:19 

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.