Click here to Skip to main content
16,011,680 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to verify if an application exsist in the system? Pin
benjymous6-Jan-05 22:06
benjymous6-Jan-05 22:06 
GeneralDFB Bitmap on second graphics card Pin
cirocco6-Jan-05 21:17
cirocco6-Jan-05 21:17 
GeneralAdding Custom property type VARIANT_BOOL using VC++.Net 2003 Pin
mgnaik6-Jan-05 21:13
mgnaik6-Jan-05 21:13 
QuestionCan a dll call/use another dll? Pin
heinzster6-Jan-05 18:42
heinzster6-Jan-05 18:42 
AnswerRe: Can a dll call/use another dll? Pin
jan larsen7-Jan-05 1:13
jan larsen7-Jan-05 1:13 
AnswerRe: Can a dll call/use another dll? Pin
Antony M Kancidrowski7-Jan-05 1:49
Antony M Kancidrowski7-Jan-05 1:49 
GeneralRe: Can a dll call/use another dll? Pin
heinzster10-Jan-05 22:40
heinzster10-Jan-05 22:40 
GeneralRe: Can a dll call/use another dll? Pin
jan larsen10-Jan-05 23:45
jan larsen10-Jan-05 23:45 
If you have the .h and the .lib files for the dll:
(VS .NET) In your (C++) DLL project: #include the .h file where you refer to the functions.
In the menu, you will find the menu item project->properties...
In the dialog window, locate the tree node [configuration properties]->[linker]->[command line]. In the 'additional options' text field, you add the name of the .lib file.

If you don't have the .h file, and/or you dont have the .lib file. You can do this (provided that you know the signature of the functions you want to use):
<span style="color: green;">
/**
 * A test function. Remember that you can't invoke this when the parent dll is loading, because
 * the system will synchronize LoadLibrary(), and this would cause a deadlock in your application.
 */
</span>
<span style="color: blue">void</span> DllTest()
{
   <span style="color: green;">
   // This is the handle to the dll.
   </span>
   HMODULE      hDll;<br> <br>

   <span style="color: green;">
   // This is the pointer to the function in the dll, remember that all functions actually are
   // constant pointers to blocks in memory where code can be found.
   </span>
   <span style="color: blue">void</span> (* pPointerToFunctionInDll) (<span style="color: blue">char</span> * message);<br> <br>

   <span style="color: green;">
   // This call to LoadLibrary will make the system try to locate a dll with the given name.
   // If it finds the dll, it will load it into the process memory space.
   </span>
   hDll = LoadLibrary("test.dll");
   
   <span style="color: blue">if</span> (hDll)
   {
      <span style="color: green;">
      // The call to GetProcAddress, will try to find the exported function with the given
      // name. The return value must of course be cast to match the signature of receiving
      // function pointer.
      </span>
      pPointerToFunctionInDll = (<span style="color: blue">void</span> (*) (<span style="color: blue">char</span> *)) GetProcAddress(hDll, <span style="color: red">"ShowMessage"</span>);

      <span style="color: blue">if</span> (pPointerToFunctionInDll)
      {
         pPointerToFunctionInDll("Hello World!");
      }

      <span style="color: green;">
      // When you're done using your dll, you must unload it from the process space.
      </span>
      FreeLibrary(hDll);
   }
}


"After all it's just text at the end of the day. - Colin Davies

"For example, when a VB programmer comes to my house, they may say 'does your pool need cleaning, sir ?' " - Christian Graus
GeneralBOOST and Visual C++ Pin
Imtiaz Murtaza6-Jan-05 18:08
Imtiaz Murtaza6-Jan-05 18:08 
QuestionVisual Studio .net and VC 6.0 on same system? Pin
bryce6-Jan-05 18:00
bryce6-Jan-05 18:00 
AnswerRe: Visual Studio .net and VC 6.0 on same system? Pin
Nish Nishant6-Jan-05 22:09
sitebuilderNish Nishant6-Jan-05 22:09 
GeneralRe: Visual Studio .net and VC 6.0 on same system? Pin
vbmike9-Jan-05 2:54
vbmike9-Jan-05 2:54 
GeneralSCard Coding Pin
max_gundam156-Jan-05 16:53
max_gundam156-Jan-05 16:53 
GeneralChange Font to MainMenu Pin
kksoft6-Jan-05 16:31
kksoft6-Jan-05 16:31 
QuestionHow to know the version of Excel by Vc++? Pin
ty cheng6-Jan-05 15:39
ty cheng6-Jan-05 15:39 
Generalmicrosoft acoustic echo canceller !! help Pin
usman sarwar6-Jan-05 15:08
usman sarwar6-Jan-05 15:08 
Generalplaying mp3/tone Pin
vinnzy6-Jan-05 14:39
vinnzy6-Jan-05 14:39 
GeneralWndProc : Passing parameters to Pin
tnguyen4446-Jan-05 11:24
tnguyen4446-Jan-05 11:24 
GeneralRe: WndProc : Passing parameters to Pin
User 66586-Jan-05 14:19
User 66586-Jan-05 14:19 
GeneralRe: WndProc : Passing parameters to Pin
tnguyen4446-Jan-05 14:43
tnguyen4446-Jan-05 14:43 
GeneralRe: WndProc : Passing parameters to Pin
User 66587-Jan-05 2:46
User 66587-Jan-05 2:46 
GeneralRe: WndProc : Passing parameters to Pin
tnguyen4447-Jan-05 7:15
tnguyen4447-Jan-05 7:15 
GeneralCan't send text trough socket-connection, help me please! Pin
SimCom6-Jan-05 9:34
SimCom6-Jan-05 9:34 
GeneralRe: Can't send text trough socket-connection, help me please! Pin
lzzqqq6-Jan-05 16:57
lzzqqq6-Jan-05 16:57 
GeneralRe: Can't send text trough socket-connection, help me please! Pin
SimCom6-Jan-05 23:41
SimCom6-Jan-05 23:41 

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.