DLL Entry Point

F

FFrozTT

I have a small project that works fine as an EXE. Now I want to make
it into a DLL. I've created a DllMain routine and set it as the entry
point (code below). Then from DllMain I try to initialize my main
routine called ThreadProc. I've tryed this several different ways and
can't get it to work. It compiles fine but when I go rundll32
mydll.dll nothing happenes (works in exe form.)

BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call,
LPVOID lpReserved)
{
if (ul_reason_for_call == DLL_PROCESS_ATTACH)
{
HANDLE hThread = CreateThread(NULL,0,&ThreadProc,NULL,0,NULL);
CloseHandle(hThread);
}

return TRUE;
}

Any assistance would be greatly appreciated.
 
R

red floyd

FFrozTT said:
I have a small project that works fine as an EXE. Now I want to make
it into a DLL. I've created a DllMain routine and set it as the entry
point (code below). Then from DllMain I try to initialize my main
routine called ThreadProc. I've tryed this several different ways and
can't get it to work. It compiles fine but when I go rundll32
mydll.dll nothing happenes (works in exe form.)

BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call,
LPVOID lpReserved)
{
if (ul_reason_for_call == DLL_PROCESS_ATTACH)
{
HANDLE hThread = CreateThread(NULL,0,&ThreadProc,NULL,0,NULL);
CloseHandle(hThread);
}

return TRUE;
}

Any assistance would be greatly appreciated.

Wrong group. Try a group with "windows" or "microsoft" in its name.

http://www.parashift.com/c++-faq-lite/how-to-post.html#faq-5.9
 
M

Miguel Guedes

FFrozTT said:
I have a small project that works fine as an EXE. Now I want to make
it into a DLL. I've created a DllMain routine and set it as the entry
point (code below). Then from DllMain I try to initialize my main
routine called ThreadProc. I've tryed this several different ways and
can't get it to work. It compiles fine but when I go rundll32
mydll.dll nothing happenes (works in exe form.)

BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call,
LPVOID lpReserved)
{
if (ul_reason_for_call == DLL_PROCESS_ATTACH)
{
HANDLE hThread = CreateThread(NULL,0,&ThreadProc,NULL,0,NULL);
CloseHandle(hThread);
}

return TRUE;
}

Any assistance would be greatly appreciated.

You will get an answer in microsoft.public.vc.language.
 
M

mike3

I have a small project that works fine as an EXE. Now I want to make
it into a DLL. I've created a DllMain routine and set it as the entry
point (code below). Then from DllMain I try to initialize my main
routine called ThreadProc. I've tryed this several different ways and
can't get it to work. It compiles fine but when I go rundll32
mydll.dll nothing happenes (works in exe form.)

BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call,
LPVOID lpReserved)
{
if (ul_reason_for_call == DLL_PROCESS_ATTACH)
{
HANDLE hThread = CreateThread(NULL,0,&ThreadProc,NULL,0,NULL);
CloseHandle(hThread);
}

return TRUE;

}

Any assistance would be greatly appreciated.

This is a Windows question, not a C++ question, unless
I'm missing something. Try posting this on a Windows
programming group like those in
comp.os.ms-windows.programmer.*.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top