CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 2 FirstFirst 12
Results 16 to 24 of 24
  1. #16
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,631

    Re: LoadLibrary returns 0

    Quote Originally Posted by funkmonkey View Post
    Hi, I'm trying to generate a DLL that is just a simple timer like routine for activating when a System DLG box pops up.
    Tripped across your other post in C++ & Win API, where the code looks more complete. Have to admit, I cannot see a timer thing in there. Instead, I can see you have absolutely no idea what your EPIQ_ExecuteTimer() really does. You'd better stop fumbling with DLL and pay some attention to your main logic of timed execution, for whatever reason you're up to..
    Best regards,
    Igor

  2. #17
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,903

    Re: LoadLibrary returns 0

    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  3. #18
    Join Date
    Feb 2009
    Posts
    32

    Re: LoadLibrary returns 0

    Quote Originally Posted by Igor Vartanov View Post
    Code:
    #ifdef EPIQUTIL_EXPORTS
    #define EPIQUTIL_API __declspec(dllexport)
    #else
    #define EPIQUTIL_API __declspec(dllimport)
    #endif
    My best guess is EPIQUTIL_EXPORTS is not defined when the DLL gets built, thus no exporting occurs.
    Thanks. What would the define look like? Using _stdcall? as the definition? In all the examples I have looked at this is how the code has been and I have not seen a defenition for the maco. Unless it's in another file or they just did not post it with the question/answer.

  4. #19
    Join Date
    Feb 2009
    Posts
    32

    Re: LoadLibrary returns 0

    Actually I do know. ExecuteTimer is the equivilent of set timer, but very crude. It is a circular call that is simple and calls the EPIQ_TimerProc every second from the Sleep Delay. I figured this was easier than generating a thread with a timer. It's a really simple/stupid form of a timer. It may be crude but it does work and the only reason I need it is to press a system dialog button when obj.click function is called as this function freezes until the system dialog box is dismissed then it picks back up and continues to the next routing.

  5. #20
    Join Date
    Feb 2009
    Posts
    32

    Re: LoadLibrary returns 0

    Quote Originally Posted by Igor Vartanov View Post
    Tripped across your other post in C++ & Win API, where the code looks more complete. Have to admit, I cannot see a timer thing in there. Instead, I can see you have absolutely no idea what your EPIQ_ExecuteTimer() really does. You'd better stop fumbling with DLL and pay some attention to your main logic of timed execution, for whatever reason you're up to..
    DIdn't reply with quotes so here is what I said from below.

    Actually I do know. ExecuteTimer is the equivilent of set timer, but very crude. It is a circular call that is simple and calls the EPIQ_TimerProc every second from the Sleep Delay. I figured this was easier than generating a thread with a timer. It's a really simple/stupid form of a timer. It may be crude but it does work and the only reason I need it is to press a system dialog button when obj.click function is called as this function freezes until the system dialog box is dismissed then it picks back up and continues to the next routing.

    But hey, let's insult the person because you can't figure it out with a circular operation.

  6. #21
    Join Date
    Feb 2009
    Posts
    32

    Re: LoadLibrary returns 0

    Quote Originally Posted by Igor Vartanov View Post
    Code:
    #ifdef EPIQUTIL_EXPORTS
    #define EPIQUTIL_API __declspec(dllexport)
    #else
    #define EPIQUTIL_API __declspec(dllimport)
    #endif
    My best guess is EPIQUTIL_EXPORTS is not defined when the DLL gets built, thus no exporting occurs.
    Thanks. Your are probably correct as I don't define that until it is defined in the ifdef statement. Should I be using __Stdcall or __cdecl with the macro?


    The LoadLibrary issue is somewhat resolved and now working on a similar issue with getprocaddress. The one issue I had is that the DLL will only be loaded in the debug directory, which is fine for now but will need to resolve this later after the code is more functional. Can't place the DLL in the system directory as this is for a company team project for processing records using VBA but with the C developed DLL for pressing a system dialog button in order to move the program on as the program freezes until the dismissal of the system dialog box occurs.


    Moderators...... I guess you can close this post as I am no longer fighting a LoadLibrary issue but a GetProcAddress issue which is a different topic and I do have another thread for this. Thanks.

  7. #22
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,903

    Re: LoadLibrary returns 0

    Quote Originally Posted by funkmonkey View Post
    Thanks. What would the define look like? Using _stdcall? as the definition? In all the examples I have looked at this is how the code has been and I have not seen a defenition for the maco. Unless it's in another file or they just did not post it with the question/answer.
    In the C++ code that generates the .dll (exports) you have at the top:

    Code:
    #define EPIQUTIL_EXPORTS
    In the code that uses the .dll (imports) you don't have this definition.
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  8. #23
    Join Date
    Feb 2009
    Posts
    32

    Re: LoadLibrary returns 0

    Quote Originally Posted by Igor Vartanov View Post
    Code:
    #ifdef EPIQUTIL_EXPORTS
    #define EPIQUTIL_API __declspec(dllexport)
    #else
    #define EPIQUTIL_API __declspec(dllimport)
    #endif
    My best guess is EPIQUTIL_EXPORTS is not defined when the DLL gets built, thus no exporting occurs.
    For the LoadLibrary issue it was that I moved the DLL to another directory, but even with the path defined LoadLibrary would not load the DLL. For now LoadLibrary is not an issue and I will figure out this problem later, as I just leave the DLL where it was compiled and LoadLibrary works. Scratching my head over that one though since the DLL can't seem to be placed elsewhere. Moving on to my other issue now GetProcAddress, with the same results but the DLL seems to not be applying __declspec(dllexport) macro for the compilation.

  9. #24
    Join Date
    Feb 2009
    Posts
    32

    Re: LoadLibrary returns 0

    Moderators, you may close this post as the LoadLibrary issue is sort of resolved. Will visit the issue at a later date as in the DLL debug location the DLL works, but not in another location. Will resolve, attempt, at a later date.

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured