Well, that's it, i'm trying to compile a dialog box:

case WM_COMMAND:

    switch(LOWORD(wParam))
{

 case ID_HELP_ABOUT:            

               {
            int ret = DialogBox(GetModuleHandle(NULL), 
                MAKEINTRESOURCE(IDD_ABOUT), hwnd, AboutDlgProc);
            if(ret == IDOK){
                MessageBox(hwnd, "Dialog exited with IDOK.", "Notice",
                    MB_OK | MB_ICONINFORMATION);
            }
            else if(ret == IDCANCEL){
                MessageBox(hwnd, "Dialog exited with IDCANCEL.", "Notice",
                    MB_OK | MB_ICONINFORMATION);
            }
            else if(ret == -1){
                MessageBox(hwnd, "Dialog failed!", "Error",
                    MB_OK | MB_ICONINFORMATION);

And i get this error:

C:\\my\\pc\\programmain.cpp   'AboutDlgProc' was not declared in this scope

I'm using wxDevC++ does anyone knows the reason i get this error??

( My headers are: #include <windows.h>
#include "resource.h" , do i need an other one? )

Recommended Answers

All 6 Replies

AboutDlgProc is the dialog procedure (a function) that will handle displaying your About dialog box. The compiler has not seen the AboutDlgProc() function at the point where the error occurs.

Do you have that function in that .cpp file?

AboutDlgProc is the dialog procedure (a function) that will handle displaying your About dialog box. The compiler has not seen the AboutDlgProc() function at the point where the error occurs.

Do you have that function in that .cpp file?

You were right

When you told me to check it, y noticed there were missing some values.

So i declared them and !thada! the program works, but know it gives me an other error:

[Linker Error] undefined reference to `AboutDlgProc(HWND__*, unsigned int, unsigned int, long)@16' 
ld returned 1 exit status

This is what i have at the "top" of the main.cpp

BOOL CALLBACK AboutDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam);

Sincerely i don't know what this values mean, i just thought they were pre-defined, like "MF_STRING" or "MF_POPUP"

So i'd love if you could explain a little of this to me.

undefined reference to `AboutDlgProc(HWND__*, unsigned int, unsigned int, long)@16'
ld returned 1 exit status

This is what i have at the "top" of the main.cpp

BOOL CALLBACK AboutDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam);

Now that you have declared the function, the next step is to implement it too, that is, you have to write the code for the AboutDlgProc() function (most likely in the main.cpp file).

I'm assuming that you are compiling some example project?

commented: Thanks, man you helped me alot +0

FORGET IT!! finally got it working jeje ^^

But if someone could still explain me what this is, it would be great!

BOOL CALLBACK AboutDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)

I know what a bool type is, it means that in case the dialog box, dosn't work, it returns false, and displays the error message.

Then; AboutDlgProc it's just a variable? i mean could i use:

BOOL CALLBACK blablabla(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)

and it'll still working? ( As long as i replace all the AboutDl... for blablabla's ) Tested it! and yes1 it does still works, i replaced the AboutD.. for "popo" and it worked jeje, but it's better to leave it as it was jeje

Anyway, thanks for all those whom take the time to read my, bad-English, messages. jeje. Sorry, and again thanks

Now that you have declared the function, the next step is to implement it too, that is, you have to write the code for the AboutDlgProc() function (most likely in the main.cpp file).

I'm assuming that you are compiling some example project?

Yes, it's just an example project, but as i said, it's solved jeje.

Thanks anyway, I've already added you some reputation, jeje, i mean, you we're the only one that replayed my messages.

SEE YA

BOOL CALLBACK AboutDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)

I know what a bool type is, it means that in case the dialog box, dosn't work, it returns false, and displays the error message.

See DialogProc Function

Seems that you already figured the rest out by yourself - good.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.