DLL Entry Point

Discussion in 'C++' started by FFrozTT, Sep 5, 2007.

  1. FFrozTT

    FFrozTT Guest

    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.
    FFrozTT, Sep 5, 2007
    #1
    1. Advertising

  2. FFrozTT

    red floyd Guest

    FFrozTT wrote:
    > 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
    red floyd, Sep 5, 2007
    #2
    1. Advertising

  3. FFrozTT wrote:
    > 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.
    Miguel Guedes, Sep 5, 2007
    #3
  4. FFrozTT

    mike3 Guest

    On Sep 5, 10:45 am, FFrozTT <> wrote:
    > 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.*.
    mike3, Sep 5, 2007
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sam Fields
    Replies:
    0
    Views:
    2,800
    Sam Fields
    Oct 22, 2004
  2. Lynn McGuire
    Replies:
    3
    Views:
    829
    Lynn McGuire
    Jan 4, 2007
  3. Sam Fields
    Replies:
    0
    Views:
    161
    Sam Fields
    Oct 22, 2004
  4. Saraswati lakki
    Replies:
    0
    Views:
    1,321
    Saraswati lakki
    Jan 6, 2012
  5. Replies:
    0
    Views:
    163
Loading...

Share This Page