Click here to Skip to main content
15,886,362 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Debug Vs Release Pin
Stephen Hewitt9-Jan-06 2:23
Stephen Hewitt9-Jan-06 2:23 
QuestionUsing a DLL having its own DialogProcedure Pin
torbeli4-Jan-06 21:34
torbeli4-Jan-06 21:34 
AnswerRe: Using a DLL having its own DialogProcedure Pin
Prakash Nadar4-Jan-06 21:55
Prakash Nadar4-Jan-06 21:55 
GeneralRe: Using a DLL having its own DialogProcedure Pin
torbeli4-Jan-06 22:51
torbeli4-Jan-06 22:51 
GeneralRe: Using a DLL having its own DialogProcedure Pin
Prakash Nadar4-Jan-06 23:21
Prakash Nadar4-Jan-06 23:21 
QuestionCan i type cast a function ? Pin
vikas amin4-Jan-06 21:33
vikas amin4-Jan-06 21:33 
AnswerRe: Can i type cast a function ? Pin
Prakash Nadar4-Jan-06 22:00
Prakash Nadar4-Jan-06 22:00 
AnswerRe: Can i type cast a function ? Pin
Owner drawn4-Jan-06 22:13
Owner drawn4-Jan-06 22:13 
The sample code below illustrates how to use function pointers to call functions that take different parameters than those with which the pointer was declared. The function is cast to the type of the function pointer during the first assignment, then the function pointer is cast to the type of the function to be called. Using typedefs generally makes it easier than casting the pointer directly.

#include <stdio.h>

typedef int  (*myintchartype) (char *, char *);
typedef void (*myvoidtype) (void);
typedef int  (*myintvoidtype) (void);

int func1(char *, char *);
void func2(void);

void main(void)
{
   myintvoidtype ptr;

   ptr = (myintvoidtype) func1;
   ((myintchartype) ptr)("one", "two");

   ptr = (myintvoidtype) func2;
   ((myvoidtype) ptr)();
}

int func1(char *a, char *b)
{
   return printf("func1 took two parameters: %s and %s\n", a, b);
}

void func2(void)
{
   printf("func2 did not take any parameters\n");
}


You can type cast functions.

Love Forgives--Love Gives--Jesus is Love Smile | :)
<marquee direction="up" height="50" scrolldelay="1" step="1" scrollamount="1" style="background-color:'#44ccff'">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord


GeneralRe: Can i type cast a function ? Pin
Prakash Nadar4-Jan-06 22:44
Prakash Nadar4-Jan-06 22:44 
GeneralRe: Can i type cast a function ? Pin
Eytukan4-Jan-06 22:47
Eytukan4-Jan-06 22:47 
GeneralRe: Can i type cast a function ? Pin
Owner drawn4-Jan-06 23:09
Owner drawn4-Jan-06 23:09 
GeneralCorrected . Pin
Eytukan4-Jan-06 23:31
Eytukan4-Jan-06 23:31 
GeneralRe: Corrected . Pin
Owner drawn4-Jan-06 23:34
Owner drawn4-Jan-06 23:34 
GeneralRe: Corrected . Pin
Eytukan5-Jan-06 0:56
Eytukan5-Jan-06 0:56 
GeneralRe: Corrected . Pin
Owner drawn5-Jan-06 0:59
Owner drawn5-Jan-06 0:59 
GeneralRe: Corrected . Pin
vikas amin5-Jan-06 0:59
vikas amin5-Jan-06 0:59 
AnswerRe: Can i type cast a function ? Pin
S. Senthil Kumar5-Jan-06 3:40
S. Senthil Kumar5-Jan-06 3:40 
Questionresizing frame to fit view? Pin
LeeeNN4-Jan-06 20:13
LeeeNN4-Jan-06 20:13 
AnswerRe: resizing frame to fit view? Pin
Owner drawn4-Jan-06 20:17
Owner drawn4-Jan-06 20:17 
QuestionShould not allow copy, cut, paste and delete in the edit boxes using VC++ Pin
K. narasimharao4-Jan-06 19:50
K. narasimharao4-Jan-06 19:50 
AnswerRe: Should not allow copy, cut, paste and delete in the edit boxes using VC++ Pin
Owner drawn4-Jan-06 20:20
Owner drawn4-Jan-06 20:20 
QuestionDisplay multi line colors in Rich edit control using VC++ Pin
K. narasimharao4-Jan-06 19:38
K. narasimharao4-Jan-06 19:38 
AnswerRe: Display multi line colors in Rich edit control using VC++ Pin
Anilkumar K V4-Jan-06 20:48
Anilkumar K V4-Jan-06 20:48 
GeneralRe: Display multi line colors in Rich edit control using VC++ Pin
Owner drawn4-Jan-06 23:15
Owner drawn4-Jan-06 23:15 
GeneralRe: Display multi line colors in Rich edit control using VC++ Pin
Anilkumar K V5-Jan-06 0:35
Anilkumar K V5-Jan-06 0:35 

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.