Click here to Skip to main content
Sign Up to vote bad
good
See more: C++Win32
I'm trying to get a value from my dll.
I made a application (In WIN32 C++) and Dll with it.
And I like to take some 'int' value or soneting like that,
from the dll to the application.
 
Thans for help Smile | :)
 
Copied from solution:
OK, So I have Application, DLL and Loader.
When I'm load the Loader, Its load the Pinball game.
And with the dll, its makes console and write the score of the current score in the pinball game.
(Codecave)

My Question is:
How I can get the current score from the dll, and send it to the application ?

I made a simple 'int' varible, with the value 60.
and send it to the application.
But I need to know how I can update it all the time ?
Because its stuck in the first value I typed.
I want its update in real time with the dll's score value.
Posted 19 Jul '12 - 10:42
Edited 19 Jul '12 - 15:23
Wes Aday59.2K

Comments
Wes Aday - 19 Jul '12 - 16:46
Don't you think that your question is a bit vague? Write a function in your DLL that returns an int or something like that. Then call that function from your application.
Wes Aday - 19 Jul '12 - 21:25
In this case I would create a custom event then when I needed to update the score then I would fire the event and in your application, handle the event just like any other.
Richard MacCutchan - 20 Jul '12 - 5:05
Why are you keeping the score in the DLL and not in the game application? That is the wrong way to do things. DLLs should be helper libraries that do work that is common to other applications, they should not be used to do things, or hold data that properly belongs to the calling application.

1 solution

__declspec( dllexport) int score;
 
above of code can export a varible of dll.
 
HMODULE hDLL = LoadLibrary("test.dll");
int score = (int)GetProcAddress(hDLL,"score");
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 514
1 CPallini 245
2 Mahesh Bailwal 244
3 Maciej Los 240
4 Aarti Meswania 213
0 Sergey Alexandrovich Kryukov 9,162
1 OriginalGriff 7,179
2 CPallini 3,913
3 Rohan Leuva 3,176
4 Maciej Los 2,588


Advertise | Privacy | Mobile
Web04 | 2.6.130516.1 | Last Updated 19 Jul 2012
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid