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

C / C++ / MFC

 
GeneralRe: Passing char* to a function and change the argument problem Pin
Richard MacCutchan29-May-11 22:49
mveRichard MacCutchan29-May-11 22:49 
Questionproblem releasing .exe to vs2008 users Pin
UdiOshi28-May-11 4:49
UdiOshi28-May-11 4:49 
AnswerRe: problem releasing .exe to vs2008 users Pin
barneyman28-May-11 5:17
barneyman28-May-11 5:17 
GeneralRe: problem releasing .exe to vs2008 users Pin
UdiOshi28-May-11 5:20
UdiOshi28-May-11 5:20 
AnswerRe: problem releasing .exe to vs2008 users Pin
«_Superman_»28-May-11 17:31
professional«_Superman_»28-May-11 17:31 
QuestionDoes VS resource compiler support PNG file Pin
Cold_Fearing_Bird28-May-11 2:36
Cold_Fearing_Bird28-May-11 2:36 
AnswerRe: Does VS resource compiler support PNG file Pin
Alain Rist28-May-11 3:36
Alain Rist28-May-11 3:36 
QuestionPointers to member functions which return pointers to themselves Pin
Ray Hagstrom27-May-11 11:08
Ray Hagstrom27-May-11 11:08 
#include <stdio.h>
#include <conio.h>

/**********************************************************************

    The following class F compiles, runs, and does exactly what I WANT.

    What I DON'T LIKE about F is:

        1.) Unnecessary enum
        2.) Unnecessary static array of pointers
        3.) High-maintenence coordination of the above two items

    I would LIKE to return the member function pointers directly.
    This looks rather like class G below (in which the self-referential
    nature of the necessary typedef introduces certain nervy concepts
    beyond my learning).

**********************************************************************/


typedef enum {FUNK0=0, FUNK1, FUNK2, FUNK3, FUNK4, FUNK5, FUNK_N} F_ENUM;

class F;
typedef F_ENUM(F::* F_member_fn_ptr)(void); //Simple member function pointer

class F
{
public:
    F_ENUM F0(void) {printf("class F F0\n"); return(FUNK2);};
    F_ENUM F1(void) {printf("class F F1\n"); return(FUNK3);};
    F_ENUM F2(void) {printf("class F F2\n"); return(FUNK4);};
    F_ENUM F3(void) {printf("class F F3\n"); return(FUNK5);};
    F_ENUM F4(void) {printf("class F F4\n"); return(FUNK1);};
    F_ENUM F5(void) {printf("class F F5\n"); return(FUNK_N);};

    static F_member_fn_ptr FUNK[FUNK_N];
};

F_member_fn_ptr F_FUNKS[FUNK_N]=
{&F::F0, &F::F1, &F::F2, &F::F3, &F::F4, &F::F5};

int main()
{
    F f;
    for(F_ENUM i=FUNK0; i<FUNK_N; i=(f.*F_FUNKS[i])())
        ;

    return(getch());
}


/**********************************************************************
class G;
typedef ??G::*???G_member_fn_ptr???????? //Not-so-simple member function pointer

class G
{
public:
    G_member_fn_ptr F0(void) {printf("class G F0\n"); return(&F2);};
    G_member_fn_ptr F1(void) {printf("class G F1\n"); return(&F3);};
    G_member_fn_ptr F2(void) {printf("class G F2\n"); return(&F4);};
    G_member_fn_ptr F3(void) {printf("class G F3\n"); return(&F5);};
    G_member_fn_ptr F4(void) {printf("class G F4\n"); return(&F1);};
    G_member_fn_ptr F5(void) {printf("class G F5\n"); return(NULL);};
};


int main()
{
    G g;
    for(G_member_fn_ptr ptr=&g.F0; ptr!=NULL; ptr=(g.*ptr)())
        ;

    return(getch());
}

**********************************************************************/

QuestionRe: Pointers to member functions which return pointers to themselves Pin
CPallini28-May-11 3:01
mveCPallini28-May-11 3:01 
AnswerRe: Pointers to member functions which return pointers to themselves Pin
Ray Hagstrom31-May-11 12:40
Ray Hagstrom31-May-11 12:40 
GeneralRe: Pointers to member functions which return pointers to themselves Pin
CPallini31-May-11 21:08
mveCPallini31-May-11 21:08 
AnswerRe: Pointers to member functions which return pointers to themselves Pin
Stefan_Lang30-May-11 4:50
Stefan_Lang30-May-11 4:50 
GeneralRe: Pointers to member functions which return pointers to themselves Pin
Ray Hagstrom31-May-11 12:46
Ray Hagstrom31-May-11 12:46 
GeneralRe: Pointers to member functions which return pointers to themselves Pin
Stefan_Lang31-May-11 21:15
Stefan_Lang31-May-11 21:15 
AnswerRe: Pointers to member functions which return pointers to themselves Pin
saephoed8-Jan-14 11:22
saephoed8-Jan-14 11:22 
QuestionAlphaBlend doesn't work properly Pin
Cold_Fearing_Bird27-May-11 9:06
Cold_Fearing_Bird27-May-11 9:06 
QuestionRe: AlphaBlend doesn't work properly Pin
Mark Salsbery27-May-11 15:17
Mark Salsbery27-May-11 15:17 
AnswerRe: AlphaBlend doesn't work properly Pin
Cold_Fearing_Bird27-May-11 18:50
Cold_Fearing_Bird27-May-11 18:50 
Questionchange selection background color of a CRichEditCtrl Pin
includeh1027-May-11 8:14
includeh1027-May-11 8:14 
Questionadd WM_SETFONT message handle in MFC Pin
includeh1027-May-11 5:37
includeh1027-May-11 5:37 
QuestionRe: add WM_SETFONT message handle in MFC Pin
David Crow27-May-11 6:06
David Crow27-May-11 6:06 
AnswerRe: add WM_SETFONT message handle in MFC Pin
వేంకటనారాయణ(venkatmakam)27-May-11 6:12
వేంకటనారాయణ(venkatmakam)27-May-11 6:12 
QuestionRe: add WM_SETFONT message handle in MFC Pin
David Crow27-May-11 6:14
David Crow27-May-11 6:14 
AnswerRe: add WM_SETFONT message handle in MFC Pin
Luc Pattyn27-May-11 6:53
sitebuilderLuc Pattyn27-May-11 6:53 
GeneralRe: add WM_SETFONT message handle in MFC Pin
David Crow27-May-11 7:05
David Crow27-May-11 7:05 

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.