Click here to Skip to main content
15,843,031 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 23:49
mveRichard MacCutchan29-May-11 23:49 
Questionproblem releasing .exe to vs2008 users Pin
UdiOshi28-May-11 5:49
UdiOshi28-May-11 5:49 
AnswerRe: problem releasing .exe to vs2008 users Pin
barneyman28-May-11 6:17
barneyman28-May-11 6:17 
GeneralRe: problem releasing .exe to vs2008 users Pin
UdiOshi28-May-11 6:20
UdiOshi28-May-11 6:20 
AnswerRe: problem releasing .exe to vs2008 users Pin
«_Superman_»28-May-11 18:31
professional«_Superman_»28-May-11 18:31 
QuestionDoes VS resource compiler support PNG file Pin
Cold_Fearing_Bird28-May-11 3:36
Cold_Fearing_Bird28-May-11 3:36 
AnswerRe: Does VS resource compiler support PNG file Pin
Alain Rist28-May-11 4:36
Alain Rist28-May-11 4:36 
QuestionPointers to member functions which return pointers to themselves Pin
Ray Hagstrom27-May-11 12:08
Ray Hagstrom27-May-11 12: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 4:01
mveCPallini28-May-11 4:01 
AnswerRe: Pointers to member functions which return pointers to themselves Pin
Ray Hagstrom31-May-11 13:40
Ray Hagstrom31-May-11 13:40 
GeneralRe: Pointers to member functions which return pointers to themselves Pin
CPallini31-May-11 22:08
mveCPallini31-May-11 22:08 
AnswerRe: Pointers to member functions which return pointers to themselves Pin
Stefan_Lang30-May-11 5:50
Stefan_Lang30-May-11 5:50 
GeneralRe: Pointers to member functions which return pointers to themselves Pin
Ray Hagstrom31-May-11 13:46
Ray Hagstrom31-May-11 13:46 
GeneralRe: Pointers to member functions which return pointers to themselves Pin
Stefan_Lang31-May-11 22:15
Stefan_Lang31-May-11 22:15 
AnswerRe: Pointers to member functions which return pointers to themselves Pin
saephoed8-Jan-14 12:22
saephoed8-Jan-14 12:22 
QuestionAlphaBlend doesn't work properly Pin
Cold_Fearing_Bird27-May-11 10:06
Cold_Fearing_Bird27-May-11 10:06 
QuestionRe: AlphaBlend doesn't work properly Pin
Mark Salsbery27-May-11 16:17
Mark Salsbery27-May-11 16:17 
AnswerRe: AlphaBlend doesn't work properly Pin
Cold_Fearing_Bird27-May-11 19:50
Cold_Fearing_Bird27-May-11 19:50 
Questionchange selection background color of a CRichEditCtrl Pin
includeh1027-May-11 9:14
includeh1027-May-11 9:14 
Questionadd WM_SETFONT message handle in MFC Pin
includeh1027-May-11 6:37
includeh1027-May-11 6:37 
QuestionRe: add WM_SETFONT message handle in MFC Pin
David Crow27-May-11 7:06
David Crow27-May-11 7:06 
AnswerRe: add WM_SETFONT message handle in MFC Pin
వేంకటనారాయణ(venkatmakam)27-May-11 7:12
వేంకటనారాయణ(venkatmakam)27-May-11 7:12 
QuestionRe: add WM_SETFONT message handle in MFC Pin
David Crow27-May-11 7:14
David Crow27-May-11 7:14 
AnswerRe: add WM_SETFONT message handle in MFC Pin
Luc Pattyn27-May-11 7:53
sitebuilderLuc Pattyn27-May-11 7:53 
GeneralRe: add WM_SETFONT message handle in MFC Pin
David Crow27-May-11 8:05
David Crow27-May-11 8: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.