Click here to Skip to main content
15,920,836 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Which USB port? Pin
Adam Roderick J20-Jul-09 23:48
Adam Roderick J20-Jul-09 23:48 
AnswerRe: Which USB port? Pin
«_Superman_»21-Jul-09 0:29
professional«_Superman_»21-Jul-09 0:29 
Questionsend scsi command to usb device using DeviceIoControl method Pin
Anil Veeraghattapu 420-Jul-09 23:11
Anil Veeraghattapu 420-Jul-09 23:11 
AnswerRe: send scsi command to usb device using DeviceIoControl method Pin
Randor 21-Jul-09 0:29
professional Randor 21-Jul-09 0:29 
QuestionHow to auto generate the registry key value in MFC Pin
DevelopmentNoob20-Jul-09 20:31
DevelopmentNoob20-Jul-09 20:31 
AnswerRe: How to auto generate the registry key value in MFC Pin
«_Superman_»20-Jul-09 20:37
professional«_Superman_»20-Jul-09 20:37 
AnswerRe: How to auto generate the registry key value in MFC Pin
Adam Roderick J20-Jul-09 21:09
Adam Roderick J20-Jul-09 21:09 
QuestionCallback to a Non static Member function in C++ need to be called from a DLL Pin
San20-Jul-09 19:53
San20-Jul-09 19:53 
Hi All,

I need to implment a callback to a Nonstatic member function of a class.
Which will be invoked through a DLL.DLL is an independent library.No dependency with the class.
I Implemented with a static function. I need to know how it will be for a non static member function.

My code is as follows for static implementation. I need to change it for a non static .Please help.

class CCallbackTester
{
public:
static int __stdcall CompareInts(const byte* velem1, const byte* velem2);
};

int __stdcall CCallbackTester::CompareInts(const byte* velem1, const byte* velem2)
{
int elem1 = *(int*)velem1;
int elem2 = *(int*)velem2;

if(elem1 < elem2)
return -1;
if(elem1 > elem2)
return 1;

return 0;
}

int main(int argc, char* argv[])
{
int i;
int array[] = {22, 1, 3210, 2109, 1098};


Bubblesort((byte*)array, 5, sizeof(array[0]),
&CCallbackTester::CompareInts);

cout << "After the sorting\n";
for(i=0; i<5; i++)
cout << array[i] << '\n';
getch();
}

in DLL Bubblesort is as follows.
void DLLDIR CALLBACK Bubblesort(byte* array, int size, int elem_size, CompareFunction cmpFunc)
{
for(int i=0; i<size; i++)
{
for(int j=0; j<size-1; j++)
{
if(1 == (*cmpFunc)(array+j*elem_size, array+(j+1)*elem_size))
{
byte* temp = new byte[elem_size];
memcpy(temp, array+j*elem_size, elem_size);
memcpy(array+j*elem_size, array+(j+1)*elem_size, elem_size);
memcpy(array+(j+1)*elem_size, temp, elem_size);
delete [] temp;
}
}
}
}


Thanks
San
AnswerRe: Callback to a Non static Member function in C++ need to be called from a DLL Pin
«_Superman_»20-Jul-09 20:31
professional«_Superman_»20-Jul-09 20:31 
AnswerRe: Callback to a Non static Member function in C++ need to be called from a DLL Pin
Rick York21-Jul-09 6:54
mveRick York21-Jul-09 6:54 
QuestionHow Do I Change StillCap Resolution Pin
Tom Hubin20-Jul-09 19:49
Tom Hubin20-Jul-09 19:49 
QuestionFont Pin
kumar sanghvi20-Jul-09 17:40
kumar sanghvi20-Jul-09 17:40 
QuestionRe: Font Pin
Randor 20-Jul-09 18:00
professional Randor 20-Jul-09 18:00 
Questionfile share problem Pin
york52820-Jul-09 16:55
york52820-Jul-09 16:55 
QuestionRe: file share problem Pin
«_Superman_»20-Jul-09 18:10
professional«_Superman_»20-Jul-09 18:10 
AnswerRe: file share problem Pin
york52820-Jul-09 18:41
york52820-Jul-09 18:41 
GeneralRe: file share problem Pin
«_Superman_»20-Jul-09 18:44
professional«_Superman_»20-Jul-09 18:44 
GeneralRe: file share problem Pin
york52820-Jul-09 18:54
york52820-Jul-09 18:54 
GeneralRe: file share problem Pin
«_Superman_»20-Jul-09 19:48
professional«_Superman_»20-Jul-09 19:48 
GeneralRe: file share problem Pin
york52820-Jul-09 22:03
york52820-Jul-09 22:03 
AnswerRe: file share problem Pin
Randor 20-Jul-09 18:43
professional Randor 20-Jul-09 18:43 
GeneralRe: file share problem Pin
york52820-Jul-09 18:59
york52820-Jul-09 18:59 
GeneralRe: file share problem Pin
Randor 20-Jul-09 19:17
professional Randor 20-Jul-09 19:17 
GeneralRe: file share problem Pin
york52820-Jul-09 19:43
york52820-Jul-09 19:43 
GeneralRe: file share problem Pin
Stuart Dootson20-Jul-09 23:30
professionalStuart Dootson20-Jul-09 23:30 

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.