Click here to Skip to main content
15,891,375 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to do... Pin
David Crow1-Aug-08 3:42
David Crow1-Aug-08 3:42 
Questionset up and deployment project in VS2005 Pin
kapardhi31-Jul-08 21:37
kapardhi31-Jul-08 21:37 
GeneralRe: set up and deployment project in VS2005 Pin
kapardhi3-Aug-08 19:34
kapardhi3-Aug-08 19:34 
QuestionSetWindowsHookEx function fails in VISTA Pin
ShilpiP31-Jul-08 21:35
ShilpiP31-Jul-08 21:35 
AnswerRe: SetWindowsHookEx function fails in VISTA Pin
CPallini31-Jul-08 21:51
mveCPallini31-Jul-08 21:51 
AnswerRe: SetWindowsHookEx function fails in VISTA Pin
Xing Chen31-Jul-08 21:58
Xing Chen31-Jul-08 21:58 
GeneralRe: SetWindowsHookEx function fails in VISTA Pin
ShilpiP2-Aug-08 1:26
ShilpiP2-Aug-08 1:26 
QuestionFreeLibrary problem [modified] Pin
Rahul Vaishnav31-Jul-08 20:51
Rahul Vaishnav31-Jul-08 20:51 
Hi all,

Please help me...

I am have written below function in which I am calling repeated as per my requirement..

typedef HRESULT (*PROCHICON)(HICON*); 
typedef CString (*PROCCSTRNAME)(); 
typedef CString (*PROCCSTRCONT)(CString); 

LoadButtonPluginDLL(CString DLLPath,CString &ButtonText,HICON &ImageHandle,CString &ButtonContent)
{
PROCHICON ProcButtonHicon;
PROCCSTRNAME ProcButtonName;
PROCCSTRCONT ProcButtonContent;
HINSTANCE hLib = ::LoadLibrary(DLLPath); //load the plugin libarary dll//    
if(hLib==NULL)
{
 MessageBox(_T("Fails To Load Dll"));
return;
}

ProcButtonHicon =(PROCHICON)::GetProcAddress(hLib,"GetButtonImage"); 
if(ProcButtonHicon == NULL) //if dll is not loaded
{
  ::FreeLibrary(hLib);
  CoUninitialize();
 return;
} 
ProcButtonName =(PROCCSTRNAME)::GetProcAddress(hLib,"GetButtonText");  
if(ProcButtonName == NULL) 
{
 ::FreeLibrary(hLib);
 CoUninitialize();
 return;
}  
ProcButtonContent= (PROCCSTRCONT)::GetProcAddress(hLib,"GetPluginContent");
if(ProcButtonContent == NULL) //if dll is not loaded
{
::FreeLibrary(hLib);
CoUninitialize();
return;
}            
 ((PROCHICON)ProcButtonHicon)(&ImageHandle);
ButtonText =((PROCCSTRNAME)ProcButtonName)();  
ButtonContent =((PROCCSTRCONT)ProcButtonContent)("1");  

if(hLib)
 FreeLibrary(hLib); //free the libaray    
}

When I callabove function first time it works fine I get proper values in ImageHandle,ButtonText,ButtonContent from dll. but when I call this function second time and after calling FreeLibrary(hLib);variables ButtonText & ButtonContent become BadPtr and I can't use these values out side the function.

Frown | :(

modified on Friday, August 1, 2008 4:47 AM

QuestionRe: FreeLibrary problem Pin
CPallini31-Jul-08 21:26
mveCPallini31-Jul-08 21:26 
AnswerRe: FreeLibrary problem Pin
Rahul Vaishnav31-Jul-08 22:01
Rahul Vaishnav31-Jul-08 22:01 
QuestionRe: FreeLibrary problem Pin
CPallini31-Jul-08 22:08
mveCPallini31-Jul-08 22:08 
AnswerRe: FreeLibrary problem Pin
Rahul Vaishnav31-Jul-08 23:02
Rahul Vaishnav31-Jul-08 23:02 
GeneralRe: FreeLibrary problem Pin
CPallini31-Jul-08 23:08
mveCPallini31-Jul-08 23:08 
GeneralRe: FreeLibrary problem Pin
Rahul Vaishnav1-Aug-08 0:17
Rahul Vaishnav1-Aug-08 0:17 
QuestionRe: FreeLibrary problem Pin
David Crow1-Aug-08 3:35
David Crow1-Aug-08 3:35 
AnswerRe: FreeLibrary problem caused by different heaps of the dll and exe Pin
Hartwin Stuewe10-Aug-08 2:49
Hartwin Stuewe10-Aug-08 2:49 
GeneralRe: FreeLibrary problem caused by different heaps of the dll and exe Pin
Rahul Vaishnav24-Aug-08 18:14
Rahul Vaishnav24-Aug-08 18:14 
QuestionError specify the lpszIcon in the MSGBOXPARAM using ::LoadIcon Pin
fantasy121531-Jul-08 20:15
fantasy121531-Jul-08 20:15 
AnswerRe: Error specify the lpszIcon in the MSGBOXPARAM using ::LoadIcon Pin
Cedric Moonen31-Jul-08 20:43
Cedric Moonen31-Jul-08 20:43 
GeneralRe: Error specify the lpszIcon in the MSGBOXPARAM using ::LoadIcon Pin
fantasy121531-Jul-08 21:23
fantasy121531-Jul-08 21:23 
AnswerRe: Error specify the lpszIcon in the MSGBOXPARAM using ::LoadIcon [modified] Pin
CPallini31-Jul-08 21:20
mveCPallini31-Jul-08 21:20 
AnswerRe: Error specify the lpszIcon in the MSGBOXPARAM using ::LoadIcon Pin
Xing Chen31-Jul-08 21:33
Xing Chen31-Jul-08 21:33 
QuestionCreating a toolbar in a console application Pin
FloatingMarc31-Jul-08 20:00
FloatingMarc31-Jul-08 20:00 
AnswerRe: Creating a toolbar in a console application Pin
Mark Salsbery1-Aug-08 8:29
Mark Salsbery1-Aug-08 8:29 
QuestionTrack the amount of data transferred while I am on net, both sent and recieved. Pin
vicky0000031-Jul-08 19:12
vicky0000031-Jul-08 19:12 

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.