Click here to Skip to main content
15,890,438 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionWinSNMP Pin
msr_codeproject8-Jan-12 19:40
msr_codeproject8-Jan-12 19:40 
AnswerRe: WinSNMP Pin
Richard MacCutchan8-Jan-12 22:55
mveRichard MacCutchan8-Jan-12 22:55 
AnswerRe: WinSNMP Pin
S p k 5219-Jan-12 19:16
S p k 5219-Jan-12 19:16 
QuestionCalling via TAPI Pin
Hadi Dayvary7-Jan-12 4:03
professionalHadi Dayvary7-Jan-12 4:03 
Question#pragma data_seg issue - Sharing only works with multiple instances of the same EXE Pin
bcb_guy6-Jan-12 21:00
bcb_guy6-Jan-12 21:00 
AnswerRe: #pragma data_seg issue - Sharing only works with multiple instances of the same EXE Pin
bcb_guy7-Jan-12 10:37
bcb_guy7-Jan-12 10:37 
QuestionDLL global variable question - VC++ 2010 Express - unable to set Pin
bcb_guy6-Jan-12 15:17
bcb_guy6-Jan-12 15:17 
AnswerRe: DLL global variable question - VC++ 2010 Express - unable to set Pin
«_Superman_»6-Jan-12 15:56
professional«_Superman_»6-Jan-12 15:56 
It is working as expected.
Here is what that is happening.

When button 1 is clicked, the DLL is loaded into memory and the value of MyInt which is 100 is loaded into memory.
After that the value of MyInt is changed in memory to 89.
Then when FreeLibrary is called, the DLL and all memory used by it (including MyInt) is unloaded from memory.
At this point, the value 89 that you set is lost.

Now when button 2 is clicked, the DLL is freshly loaded into memory along with the value 100 that belongs to MyInt.
So when you read the value of MyInt, it is 100 as expected.

To get what you're trying to do here are the steps -
Call LoadLibrary and GetProcAddress in some initialization routine before the button click event handlers are invoked.
In the button 1 click routine simply call SetMyInt.
In the button 2 click routine simply call GetMyInt.
You can call FreeLibrary in a separate cleanup routine that must be invoked only at the end.
«_Superman 
I love work. It gives me something to do between weekends.


Microsoft MVP (Visual C++)

Polymorphism in C

GeneralRe: DLL global variable question - VC++ 2010 Express - unable to set Pin
bcb_guy6-Jan-12 16:53
bcb_guy6-Jan-12 16:53 
Questionpackage and deployment for VC6 Pin
azhari246-Jan-12 2:41
azhari246-Jan-12 2:41 
AnswerRe: package and deployment for VC6 Pin
Maximilien6-Jan-12 9:23
Maximilien6-Jan-12 9:23 
GeneralRe: package and deployment for VC6 Pin
azhari246-Jan-12 17:27
azhari246-Jan-12 17:27 
AnswerRe: package and deployment for VC6 Pin
jeron16-Jan-12 11:01
jeron16-Jan-12 11:01 
GeneralRe: package and deployment for VC6 Pin
azhari246-Jan-12 17:32
azhari246-Jan-12 17:32 
AnswerRe: package and deployment for VC6 Pin
Andy41113-Jan-12 3:56
Andy41113-Jan-12 3:56 
QuestionWhich IDE you use for development on Linux platforms? Pin
rahul.kulshreshtha5-Jan-12 23:51
rahul.kulshreshtha5-Jan-12 23:51 
AnswerRe: Which IDE you use for development on Linux platforms? Pin
Richard MacCutchan6-Jan-12 0:52
mveRichard MacCutchan6-Jan-12 0:52 
GeneralRe: Which IDE you use for development on Linux platforms? Pin
rahul.kulshreshtha6-Jan-12 1:54
rahul.kulshreshtha6-Jan-12 1:54 
AnswerRe: Which IDE you use for development on Linux platforms? Pin
Nemanja Trifunovic7-Jan-12 12:55
Nemanja Trifunovic7-Jan-12 12:55 
GeneralRe: Which IDE you use for development on Linux platforms? Pin
richard_k9-Jan-12 7:50
richard_k9-Jan-12 7:50 
AnswerRe: Which IDE you use for development on Linux platforms? Pin
richard_k9-Jan-12 7:55
richard_k9-Jan-12 7:55 
JokeRe: Which IDE you use for development on Linux platforms? Pin
Wes Aday10-Jan-12 11:40
professionalWes Aday10-Jan-12 11:40 
GeneralRe: Which IDE you use for development on Linux platforms? Pin
Eytukan11-Jan-12 0:40
Eytukan11-Jan-12 0:40 
Questionhow to use excel automation to join multiple excel file in a single excel file? Pin
Le@rner5-Jan-12 23:49
Le@rner5-Jan-12 23:49 
AnswerRe: how to use excel automation to join multiple excel file in a single excel file? Pin
enhzflep7-Jan-12 15:58
enhzflep7-Jan-12 15:58 

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.