Calling a dialog from menu selection

Started by rags, December 31, 2006, 03:38:40 AM

Previous topic - Next topic

rags

I want to call a dialog I created from a main window of a visual project, when the "about" item is selected from the menu.
Here is the code I am using:

         .ElseIf uMsg == WM_COMMAND
LoWord wParam
.If Ax == IDM_TESTPROJ_ABOUT
       Invoke Create, szDlgNameAbt, hWnd, ecModal, NULL
                .EndIf
         .EndIf

I am getting access violations occurring in the invoke create line.
When I change that line to:

        Invoke MessageBox, App.Main, Addr szDlgNameAbt, Addr szDlgNameAbt, MB_OK

everything works fine and the messagebox appears. I have'nt been programming in awhile and I am a bit rusty.
Btw, the dialog I created doesn't do anything except has two static labels and a button on it.I created it just for learning/testing purposes.
Regards and Happy New Year,
     Rags
God made Man, but the monkey applied the glue -DEVO

Ehtyar

I think you're gonna need to give us a bit more than that rags.

Ehtyar.

zooba

Missing the ADDR on szDlgNameAbt?

If not, we'll need more info.

Cheers,

Zooba :U

rags

Quote from: zooba on January 01, 2007, 07:14:17 AM
Missing the ADDR on szDlgNameAbt?
That was it zooba, I guess I was too tired to notice the obvious! Thank you very much.
Rags
God made Man, but the monkey applied the glue -DEVO

Ramon Sala

Hi all and happy new year!

Rabs, zooba got the solution. I personally get this error often as the Addr operator is easy to forget and Masm does not take that into account (I think it could throw a warning).

Thank you both for using Easy Code,

Ramon
Greetings from Catalonia