Click here to Skip to main content
15,914,066 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow to check wheter a specified path is a dir? Pin
Member 1219625211-Mar-05 12:32
Member 1219625211-Mar-05 12:32 
AnswerRe: How to check wheter a specified path is a dir? Pin
PJ Arends11-Mar-05 12:41
professionalPJ Arends11-Mar-05 12:41 
AnswerRe: How to check wheter a specified path is a dir? Pin
Ravi Bhavnani11-Mar-05 14:42
professionalRavi Bhavnani11-Mar-05 14:42 
AnswerRe: How to check wheter a specified path is a dir? Pin
Michael Dunn11-Mar-05 15:15
sitebuilderMichael Dunn11-Mar-05 15:15 
GeneralGetting rights for OpenSCManager Pin
bepperso11-Mar-05 11:02
bepperso11-Mar-05 11:02 
Generaldisplay a html page which is in memory Pin
includeh1011-Mar-05 10:31
includeh1011-Mar-05 10:31 
GeneralRe: display a html page which is in memory Pin
Ravi Bhavnani11-Mar-05 10:55
professionalRavi Bhavnani11-Mar-05 10:55 
Generalmemory allocation in dll Pin
NMiceli11-Mar-05 8:59
NMiceli11-Mar-05 8:59 
Hello.

my problem is that i'm loading a dll to extract some data but it gets lost when i unload the library, i have the following struct
<br />
struct tagPLUGIN{<br />
	PCHAR	Name;<br />
	PCHAR	FileName;<br />
	UINT	Category;<br />
	UINT	Vital;<br />
	ULONG	Id;<br />
	UINT	isUI;		<br />
};

and from my main exe i just load the library, get the proccess address and call a dll function to fill the structure
<br />
// CODE IN DLL<br />
extern "C" __declspec(dllexport) void GetPlugInfo (tagPLUGIN *plugin)<br />
{<br />
	<br />
	AFX_MANAGE_STATE(AfxGetStaticModuleState());<br />
        //plugin.FileName=""<br />
	plugin->Category=TOOL;<br />
	plugin->Id=0;<br />
	plugin->isUI=TRUE;<br />
	plugin->Name=new char[25];<br />
	strcpy(plugin->Name,"Configuración de Sistema\0");<br />
	plugin->Vital=FALSE;<br />
}<br />

loading the dll
<br />
	tagPLUGIN plugin;<br />
	typedef void (*GetPlugInfo)(tagPLUGIN *info);<br />
	HMODULE dll=LoadLibrary(tmp_string);<br />
	GetPlugInfo getPlugInfo = (GetPlugInfo)GetProcAddress(dll,"GetPlugInfo");<br />
	(getPlugInfo)(&plugin);<br />
	plugin.Id=ID++;<br />
	plugin.FileName=new char[tmp_string.GetLength()+1];<br />
	strcpy(plugin.FileName,tmp_string.GetBuffer());<br />
	FreeLibrary(dll);<br />


but right after FreeLibrary(dll) my two PCHAR values are corrupt, i know the problem is in the new char[size], so how can i pass a PCHAR to a dll function and allocate and assign a string without loosing it after freelibrary?
GeneralRe: memory allocation in dll Pin
Chris Losinger11-Mar-05 9:43
professionalChris Losinger11-Mar-05 9:43 
GeneralRe: memory allocation in dll Pin
NMiceli11-Mar-05 10:30
NMiceli11-Mar-05 10:30 
GeneralRe: memory allocation in dll Pin
cmk11-Mar-05 15:56
cmk11-Mar-05 15:56 
GeneralRe: memory allocation in dll Pin
Anonymous11-Mar-05 16:10
Anonymous11-Mar-05 16:10 
GeneralRe: memory allocation in dll Pin
cmk11-Mar-05 17:13
cmk11-Mar-05 17:13 
QuestionIs there a easy to move focus among controls using arrow key? Pin
transoft11-Mar-05 7:51
transoft11-Mar-05 7:51 
AnswerRe: Is there a easy to move focus among controls using arrow key? Pin
Michael Dunn11-Mar-05 9:23
sitebuilderMichael Dunn11-Mar-05 9:23 
GeneralRe: Is there a easy to move focus among controls using arrow key? Pin
transoft11-Mar-05 10:21
transoft11-Mar-05 10:21 
GeneralRe: Is there a easy to move focus among controls using arrow key? Pin
Branislav11-Mar-05 19:37
Branislav11-Mar-05 19:37 
GeneralNeed help on writing a library book keeping software Pin
Member 179669511-Mar-05 7:49
Member 179669511-Mar-05 7:49 
GeneralRe: Need help on writing a library book keeping software Pin
Zero_divide_111-Mar-05 20:35
Zero_divide_111-Mar-05 20:35 
GeneralCSocket crashes program inside thread Pin
MisterHim11-Mar-05 7:36
MisterHim11-Mar-05 7:36 
GeneralRe: CSocket crashes program inside thread Pin
Ravi Bhavnani11-Mar-05 10:57
professionalRavi Bhavnani11-Mar-05 10:57 
GeneralRe: CSocket crashes program inside thread Pin
MisterHim11-Mar-05 17:11
MisterHim11-Mar-05 17:11 
Generalcredit card transaction Pin
includeh1011-Mar-05 6:23
includeh1011-Mar-05 6:23 
GeneralRe: credit card transaction Pin
ThatsAlok12-Mar-05 1:59
ThatsAlok12-Mar-05 1:59 
Generalvolatile. Pin
developer_boy11-Mar-05 6:12
developer_boy11-Mar-05 6: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.