Click here to Skip to main content
15,914,795 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRuntime linking problem between 2 .dll Pin
yarp10-Oct-01 8:22
yarp10-Oct-01 8:22 
GeneralRe: Runtime linking problem between 2 .dll Pin
Paolo Messina10-Oct-01 9:32
professionalPaolo Messina10-Oct-01 9:32 
GeneralRe: Runtime linking problem between 2 .dll Pin
yarp10-Oct-01 18:53
yarp10-Oct-01 18:53 
GeneralDebugging under Windows 98 Pin
James Spibey10-Oct-01 7:00
James Spibey10-Oct-01 7:00 
GeneralRe: Debugging under Windows 98 Pin
James Spibey10-Oct-01 7:14
James Spibey10-Oct-01 7:14 
GeneralWNDPROC function types. Pin
Mike Doner10-Oct-01 6:12
Mike Doner10-Oct-01 6:12 
GeneralRe: WNDPROC function types. Pin
Joaquín M López Muñoz10-Oct-01 7:09
Joaquín M López Muñoz10-Oct-01 7:09 
GeneralRe: WNDPROC function types. Pin
Tim Deveaux10-Oct-01 8:18
Tim Deveaux10-Oct-01 8:18 
Joaquín is right. If you declare the dialog members as static to change them from __thiscall to __cdecl, then something like this will work:

#include <iostream>
#include <windows.h>
 
using namespace std;
 
typedef BOOL (*POPULATEPROC) ( char* pbuffer, USHORT data );
 
class CIWishIWasADialog {
public:
    CIWishIWasADialog();
    ~CIWishIWasADialog();
 
    static BOOL Populate_Devicename( char* pbuffer, USHORT data ) {
        cout << "We're in Populate_Devicename - " << pbuffer << endl;
        return TRUE;
    }
    static BOOL Populate_Modelname( char* pbuffer, USHORT data ) {
        cout << "We're in Populate_Modelname - " << pbuffer << endl;
        return TRUE;
    }
};
 
struct FIELD_DATA
{
    CHAR name[40];
    USHORT width; 
    POPULATEPROC popproc; // Function called to initialize this field
};
 
 
FIELD_DATA My_Data[] = {{"Device Name", 20, CIWishIWasADialog::Populate_Devicename},
                        {"Model Name", 25, CIWishIWasADialog::Populate_Modelname }};
                    
                    
int main(int argc, char* argv[])
{
 
    My_Data[0].popproc("Honda",0);  
    My_Data[1].popproc("Accord",0); 
    
    { // pause
        int x;
        cin >> x;
    }
    
    return 0;
}


But now you have a bit of a problem in that the static members don't have access to other members (i.e. don't have an implicit this pointer).

Hmmm... what if you had a series of windows messages defined - like UWM_POPULATE_MODELNAME - then you could post a message to the dialog instead of calling a member directly. You could then just use the message IDs in your structs as well, and wouldn't have to worry about the dialog::function name.
GeneralRe: WNDPROC function types. Pin
Mike Doner10-Oct-01 9:36
Mike Doner10-Oct-01 9:36 
GeneralMissing ShFolder.h and ShFolder.lib Pin
The Arabundi10-Oct-01 6:01
The Arabundi10-Oct-01 6:01 
GeneralRe: Missing ShFolder.h and ShFolder.lib Pin
Masaaki Onishi10-Oct-01 6:33
Masaaki Onishi10-Oct-01 6:33 
GeneralRe: Missing ShFolder.h and ShFolder.lib Pin
The Arabundi10-Oct-01 7:24
The Arabundi10-Oct-01 7:24 
GeneralCharacters conversions on ReadFile and WriteFile Pin
MAXS72U10-Oct-01 5:50
MAXS72U10-Oct-01 5:50 
GeneralRe: Characters conversions on ReadFile and WriteFile Pin
Erik G. Poel10-Oct-01 6:02
Erik G. Poel10-Oct-01 6:02 
GeneralRe: Characters conversions on ReadFile and WriteFile Pin
MAXS72U10-Oct-01 20:27
MAXS72U10-Oct-01 20:27 
GeneralRe: Characters conversions on ReadFile and WriteFile Pin
MAXS72U10-Oct-01 21:32
MAXS72U10-Oct-01 21:32 
GeneralWinCE/eMbedded Visual C++ Pin
Erik G. Poel10-Oct-01 5:12
Erik G. Poel10-Oct-01 5:12 
GeneralLNK2001 Error when creating a Multithreaded Debug DLL Pin
Stacie Bartley10-Oct-01 4:48
Stacie Bartley10-Oct-01 4:48 
GeneralRe: LNK2001 Error when creating a Multithreaded Debug DLL Pin
James Spibey16-Dec-01 0:38
James Spibey16-Dec-01 0:38 
GeneralEject CD by DeviceIoControl Pin
Masaaki Onishi10-Oct-01 4:17
Masaaki Onishi10-Oct-01 4:17 
GeneralCProperty Sheet Pin
10-Oct-01 4:14
suss10-Oct-01 4:14 
GeneralRe: CProperty Sheet Pin
Erik G. Poel10-Oct-01 4:33
Erik G. Poel10-Oct-01 4:33 
QuestionCreating a COM object in another thread? Pin
NormDroid10-Oct-01 2:49
professionalNormDroid10-Oct-01 2:49 
AnswerRe: Creating a COM object in another thread? Pin
10-Oct-01 3:12
suss10-Oct-01 3:12 
GeneralRe: Creating a COM object in another thread? Pin
NormDroid10-Oct-01 3:42
professionalNormDroid10-Oct-01 3:42 

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.