[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.axapta.programming

WinAPI : remove close button

Kenny

12/16/2005 8:56:00 AM

I have to remove the close button from a window or at least disable it.
I habe done this before but now it won't work.

I use the GetSystemMenu apiFunction to get the handle to the current
window's menu and this return the correct handle.
Then I use the RemoveMenu apiFunction to get rid of the close menu.
I call this method like this.
winAPI::RemoveMenu(element.hwnd(),5,#MF_BYPOSITION);
but this returns and nothing happened.

Does anyone know what I am doing wrong here.

Greets,

2 Answers

H. Jaeger

12/16/2005 12:58:00 PM

0

Kenny,

I'm not sure precisely what you're trying to do - e.g. if there is a
particular reason why you want to use the winAPI function.

If you just want to prevent a screen from being closed by clicking the "Red
X" close button or by Ctrl+F4 you could take a look at the form
JmgSignInTerm. This form cannot be closed by clicking the close button or by
Ctrl+F4. As I remember it is done by overriding the "canClose" method on the
form.

Regards,

H. Jaeger
Edenbrook Ltd

"Kenny" wrote:

> I have to remove the close button from a window or at least disable it.
> I habe done this before but now it won't work.
>
> I use the GetSystemMenu apiFunction to get the handle to the current
> window's menu and this return the correct handle.
> Then I use the RemoveMenu apiFunction to get rid of the close menu.
> I call this method like this.
> winAPI::RemoveMenu(element.hwnd(),5,#MF_BYPOSITION);
> but this returns and nothing happened.
>
> Does anyone know what I am doing wrong here.
>
> Greets,
>

Kenny

12/16/2005 2:31:00 PM

0

I just found out what was wrong, i forgot to tell what the api function
returns.

function.returns(...)

"H. Jaeger" wrote:

> Kenny,
>
> I'm not sure precisely what you're trying to do - e.g. if there is a
> particular reason why you want to use the winAPI function.
>
> If you just want to prevent a screen from being closed by clicking the "Red
> X" close button or by Ctrl+F4 you could take a look at the form
> JmgSignInTerm. This form cannot be closed by clicking the close button or by
> Ctrl+F4. As I remember it is done by overriding the "canClose" method on the
> form.
>
> Regards,
>
> H. Jaeger
> Edenbrook Ltd
>
> "Kenny" wrote:
>
> > I have to remove the close button from a window or at least disable it.
> > I habe done this before but now it won't work.
> >
> > I use the GetSystemMenu apiFunction to get the handle to the current
> > window's menu and this return the correct handle.
> > Then I use the RemoveMenu apiFunction to get rid of the close menu.
> > I call this method like this.
> > winAPI::RemoveMenu(element.hwnd(),5,#MF_BYPOSITION);
> > but this returns and nothing happened.
> >
> > Does anyone know what I am doing wrong here.
> >
> > Greets,
> >