Hello everyone, I'm playing around the examples of the masm32 package, in particular with the example1\COMCTLS directory. I was trying to add some functionality to the prog to start learning masm32. In particular I wanted to add the GetOpenFileName function to the "Open File" toolbar button. I've added the next lines after including the comdlg32.inc and comdlg32.lib : WndProc proc ..... etc . . . LOCAL of :OPENFILENAME mame dd ? szText FileDialogTitle,"Open File..." mov of.lStructSize,SIZEOF OPENFILENAME mov of.hWndOwner,hWin mov of.hInstance,0 mov of.lpstrFilter,0 mov of.lpstrCustomFilter,0 mov of.nMaxCustFilter,0 mov of.nFilterIndex,0 mov of.lpstrFile,0 mov of.nMaxFile,0 mov of.lpstrFileTitle,OFFSET mame mov of.nMaxFileTitle,0 mov of.lpstrInitialDir,0 mov of.lpstrTitle,OFFSET FileDialogTitle mov of.Flags,OFN_EXPLORER mov of.nFileOffset,0 mov of.nFileExtension,0 mov of.lpstrDefExt,0 mov of.lCustData,0 mov of.lpfnHook,0 mov of.lpTemplateName,0 . . . .elseif wParam == 51 szText tb51,"Open File" invoke SendMessage,hStatus,SB_SETTEXT,0,ADDR tb51 invoke MessageBox,hWin,ADDR tb51,ADDR tbSelect,MB_OK invoke GetOpenFileName , ADDR of problem 1 : mov of.hWndOwner,hWin not working I have to put 0 (zero) problem 2 : when I have the EXE compiled and launched It crashes. I hope I have explained all clearly. Can anyone help ? thanks !
Posted on 2001-05-17 07:28:00 by sERpICo
Problem1 is because you cannot do mem->mem transactions! You can do either of the following: push hWin pop of.hWndOwner --- OR --- mov eax, hWin mov of.hWndOwner, eax Although technically pushing is a mem->mem transaction (as is the subsequent pop), they are specail cases, and are allowed! The second option (via eax) is faster, but will destroy the value in eax, and so may be less favourable (you can also use any other general purpose register of course). Mirno
Posted on 2001-05-17 08:22:00 by Mirno
ok, I've solved the problem :)thanks !
Posted on 2001-05-18 16:35:00 by sERpICo