how to disable or remove the form close button

i have small doubt that how to disable close button of the form(X).i have removed the maximize and minimize button of the form using form properties.but i wouldn’t remove the close button.is there possible to do this?if means pls give solution for this Vitaliy.

I’m Not sure what you’re trying to do but you could do something like this.

OnQueryCloseForm()

IF NOT CONFIRM(‘Do you really want to close?’) THEN EXIT(FALSE);

Maybe set it for SUPER users only?

OOoops - this the Axapta forum?

Hi there,

U can use property Frame of form as “None”.

It will show your form without frame ie without maximise, minimise and close button.

I hope , that’s you all needed.

Bye

hi,

override the can close method and return fasle;

Create a new method on WinAPI class:

static int setWindowLong(HWND _HWND, int _nIndex, int _dwNewLong)
{
    DLL         DLL;
    DLLFunction DLLFunction;
    ;

    DLL = new DLL(#UserDLL);
    DLLFunction = new DLLFunction(DLL,'SetWindowLongA');
    DLLFunction.arg(ExtTypes::DWord, ExtTypes::DWord, ExtTypes::DWord);
    DLLFunction.returns(ExtTypes::DWord);

    return DLLFunction.call(_HWND, _nIndex, _dwNewLong);
}

Define the following macros before using the following method:

#define.GWL_STYLE (0xFFFFFFF0)
#define.WS_SYSMENU(0x00080000)

Here is the code itself:

style = winapi::getWindowLong(dialog.dialogForm().formRun().hWnd(), #GWL_STYLE);
style = style & ~(#WS_SYSMENU);
winapi::setWindowLong(dialog.dialogForm().formRun().hWnd(), #GWL_STYLE, style);

This does not remove the hotkeys, like Ctrl+F4.

Let me know if it works

hi

bro code works jst fine but it also removes minmise and maximise button where as i want only want delete button to be removed.

As far as I understand, removing the SYSMENU removes the MINIMIZEBOX and MAXIMIZEBOX as well

WS_SYSMENU: 0x00080000
WS_THICKFRAME: 0x00040000
WS_MINIMIZEBOX: 0x00020000
WS_MAXIMIZEBOX: 0x00010000

Hi Kashperuk Ivan,

Could you explain this code…?

In AX 2012, you just neet to change window type to “Workspace”

Set "Status Bar Style " property as None to the Design node.

Hi,

U can use property Frame of form as “None”.

It will show your form without frame ie without maximise, minimise and close button.

I hope , that’s you all needed.

Bye