Click here to Skip to main content
15,905,427 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionIs it possible to have an array of types ? Pin
Defenestration8-Dec-08 22:20
Defenestration8-Dec-08 22:20 
AnswerRe: Is it possible to have an array of types ? Pin
Code-o-mat8-Dec-08 23:38
Code-o-mat8-Dec-08 23:38 
AnswerRe: Is it possible to have an array of types ? Pin
Defenestration8-Dec-08 23:43
Defenestration8-Dec-08 23:43 
GeneralRe: Is it possible to have an array of types ? Pin
Code-o-mat9-Dec-08 0:01
Code-o-mat9-Dec-08 0:01 
AnswerRe: Is it possible to have an array of types ? Pin
Defenestration9-Dec-08 0:12
Defenestration9-Dec-08 0:12 
GeneralRe: Is it possible to have an array of types ? Pin
Code-o-mat9-Dec-08 0:36
Code-o-mat9-Dec-08 0:36 
GeneralRe: Is it possible to have an array of types ? Pin
Defenestration9-Dec-08 0:48
Defenestration9-Dec-08 0:48 
GeneralRe: Is it possible to have an array of types ? Pin
Code-o-mat9-Dec-08 1:19
Code-o-mat9-Dec-08 1:19 
How about a different aproach, use a template class, something like this:

class CConverterBase
{
public:
  virtual operator void =(const FARPROC ptr) = 0;
};

template<typename tfuncptr="">
class CConverter: public CConverterBase
{
  TFuncPtr &fFuncPtrPtr;
public:
  CConverter(TFuncPtr &ptr):fFuncPtrPtr(ptr) {}

  operator void =(const FARPROC ptr)
  {
    fFuncPtrPtr = (TFuncPtr)ptr;
    return fFuncPtrPtr;
  }
}
</typename>


And then something like:

class Func
{
  TCHAR *pszName;
  CConverterBase *ptr;
};
...
Func FuncArr[] = {{_T"DLLFunc1", new CConverter(m_DLLFunc1)}, {_T"DLLFunc2", new CConverter(m_DLLFunc2)}, ...};
...
(*FuncAtt[I].ptr) = GetProcAddress(dllhandle, FuncAtt[I].pszName);
...


And of course don't forget to free up the objects you instantiated.

> The problem with computers is that they do what you tell them to do and not what you want them to do. <

GeneralRe: Is it possible to have an array of types ? Pin
Defenestration9-Dec-08 1:27
Defenestration9-Dec-08 1:27 
QuestionRe: Is it possible to have an array of types ? Pin
David Crow9-Dec-08 3:14
David Crow9-Dec-08 3:14 
AnswerRe: Is it possible to have an array of types ? Pin
Michael Dunn9-Dec-08 13:52
sitebuilderMichael Dunn9-Dec-08 13:52 
QuestionHow to unblock pipe write operation? Pin
sashoalm8-Dec-08 21:39
sashoalm8-Dec-08 21:39 
QuestionNeed some Bits/Bytes and Types information Pin
gabbana8-Dec-08 21:24
gabbana8-Dec-08 21:24 
AnswerRe: Need some Bits/Bytes and Types information Pin
CPallini8-Dec-08 22:16
mveCPallini8-Dec-08 22:16 
AnswerRe: Need some Bits/Bytes and Types information Pin
Code-o-mat8-Dec-08 22:22
Code-o-mat8-Dec-08 22:22 
AnswerRe: Need some Bits/Bytes and Types information Pin
gabbana8-Dec-08 22:32
gabbana8-Dec-08 22:32 
GeneralRe: Need some Bits/Bytes and Types information Pin
gabbana8-Dec-08 22:35
gabbana8-Dec-08 22:35 
GeneralRe: Need some Bits/Bytes and Types information Pin
Code-o-mat8-Dec-08 23:00
Code-o-mat8-Dec-08 23:00 
GeneralRe: Need some Bits/Bytes and Types information Pin
gabbana9-Dec-08 0:51
gabbana9-Dec-08 0:51 
Questiondifference between CreateThread & AfxBeginThread Pin
Nikesh Jagtap8-Dec-08 21:17
Nikesh Jagtap8-Dec-08 21:17 
AnswerRe: difference between CreateThread & AfxBeginThread Pin
Roger Stoltz8-Dec-08 21:27
Roger Stoltz8-Dec-08 21:27 
AnswerRe: difference between CreateThread & AfxBeginThread [modified] Pin
Defenestration8-Dec-08 22:32
Defenestration8-Dec-08 22:32 
AnswerRe: difference between CreateThread & AfxBeginThread Pin
Roger Stoltz8-Dec-08 22:42
Roger Stoltz8-Dec-08 22:42 
GeneralRe: difference between CreateThread & AfxBeginThread Pin
Defenestration8-Dec-08 22:51
Defenestration8-Dec-08 22:51 
QuestionHow to write string values in .csv file Pin
MsmVc8-Dec-08 20:40
MsmVc8-Dec-08 20:40 

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.