Page 1 of 3

Anti Minimize Window

Posted: Tue Jul 21, 2009 4:58 pm
by RASHAD

Code: Select all

Global hwnd,count

Procedure Restoresize(count)
  Delay(count)
  If GetWindowLong_(hwnd, #GWL_STYLE) & #WS_MINIMIZE 
  ShowWindow_(hwnd, #SW_RESTORE	)
  EndIf
  Goto again
EndProcedure

count=2000 
hwnd = OpenWindow(0, 0, 0, 400, 250, "Anti Minimize", #PB_Window_ScreenCentered| #PB_Window_SizeGadget | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget)
again:
Thread = CreateThread(@Restoresize(), count)
Repeat
  
    EventID.l = WaitWindowEvent()
    If EventID = #PB_Event_CloseWindow
      Quit = 1
    EndIf
  Until Quit = 1
End


Posted: Tue Jul 21, 2009 6:00 pm
by eJan

Code: Select all

; http://www.purebasic.fr/english/viewtopic.php?p=209817#209817

Procedure WinProc(hwnd, msg, wparam, lparam)
  result = #PB_ProcessPureBasicEvents
  If msg = #WM_SYSCOMMAND
    If wParam & $FFF0 = #SC_MINIMIZE Or wParam & $FFF0 = #SC_MAXIMIZE
      result = 0
    EndIf
  EndIf
  ProcedureReturn result
EndProcedure

OpenWindow(0, 0, 0, 320, 240, "", $CF0001)
SetWindowCallback(@WinProc())
Repeat : Until WaitWindowEvent() = #WM_CLOSE
Thanks to netmaestro & srod!

Posted: Tue Jul 21, 2009 6:06 pm
by RASHAD
@ejan

Thanks for your post
But it does not work with TaskBar minimize all
check it please

Thanjs again

have a good day

RASHAD

Posted: Tue Jul 21, 2009 7:08 pm
by Arctic Fox
How about this one?

Code: Select all

OpenWindow(0, 100, 100, 400, 250, "Anti Minimize", #PB_Window_ScreenCentered | #PB_Window_SizeGadget | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget)

Repeat
Event = WaitWindowEvent()

If GetWindowState(0) = #PB_Window_Minimize
Delay(2000)
SetWindowState(0, #PB_Window_Normal) 
EndIf

Until Event = #PB_Event_CloseWindow
End

Posted: Tue Jul 21, 2009 7:16 pm
by RASHAD
@Arctic Fox
Thank you for your posting
But it is the same as eJan
It does not work with Taskbar minimize all
Please check

I am waiting for sparki or srod to come with a good solution
by intercepting the taskbar call


have a good day
RASHAD

Posted: Tue Jul 21, 2009 7:22 pm
by Arctic Fox
With Taskbar minimize all, do you mean Win+D or Win+M (you're right - it will not work here :()

Posted: Tue Jul 21, 2009 9:16 pm
by cas
I would not try to change this because if there is command named "Show Desktop" and i want to use it now, i would expect that next thing that happens after i click on "Show Desktop" would be to actually show my desktop, not some application window which is hiding my wallpaper. This would be anoying to some people.

Posted: Tue Jul 21, 2009 9:19 pm
by Arctic Fox
cas wrote:I would not try to change this because if there is command named "Show Desktop" and i want to use it now, i would expect that next thing that happens after i click on "Show Desktop" would be to actually show my desktop, not some application window which is hiding my wallpaper. This would be anoying to some people.
This thread might be an answer to http://www.purebasic.fr/english/viewtopic.php?t=38240

Posted: Tue Jul 21, 2009 10:36 pm
by RASHAD
@cas
Arctic Fox already answered you
Now I too have some kind of answer to KCC about identifing if an exe file
is compiled as ascii or unicode
but i keep asking myself why and for what he need this
now guys is it Ok to answer such ques.


have a good day all of you

RASHAD

Posted: Tue Jul 21, 2009 11:06 pm
by cas
I'm just saying that you shouldn't do that...
This is like that you want in your app to detect when user click maximize button and then you actually minimize application. "Maximize" should stay "maximize" and "show desktop" should stay "show desktop".
You are breaking some rules...

And for KCC asking how to detect if exe is unicode... It is different case because that is like when you want to get file size --> both actions are fully transparent to users who use your apps and you aren't breaking anything.

That's my opinion on this topic.

Posted: Tue Jul 21, 2009 11:19 pm
by rsts
He's posting a tip. That's not breaking any rules.

Who uses it how is beyond his control.

Nice tip. Thanks for posting.

cheers

Posted: Tue Jul 21, 2009 11:20 pm
by RASHAD
@cas
I respect your point of view
But what is done is done
That should be posted to the original topic from the start ,the author must have some good reasons for that
I hope

have a good day

Posted: Tue Jul 21, 2009 11:23 pm
by RASHAD
@rsts
You are fast
thank you very much for your kind post

keep talking to me

have a good day

RASHAD

Posted: Wed Jul 22, 2009 12:06 am
by cas
rsts wrote:He's posting a tip. That's not breaking any rules.
Sorry for misunderstanding but i was not saying that posting a tip is breaking rules, i said that altering system commands is breaking some rules.

It is nice from him to post this tip but the way i see this tip is only for educational purposes to better understand how windows works under the hood because minimizing one window and minimizing all windows with "Show Desktop" are two different things because we see that code posted in previous thread is working if only main app window is minimized but fails with "Show Desktop".

I downloaded many applications from Internet and i saw many weird events when i used some of them and neither one of those weird-coded applications didn't stayed on my PC, i uninstalled it immediately and went to find another for same purpose.
Every professionally designed application should be created that way to bypass this need to always show window on desktop... Maybe use systray icon... so that way user has always access to application, even after "Show Desktop".

Posted: Wed Jul 22, 2009 12:16 am
by RASHAD
For every one
Most of the tips are breaking some rules
PureBasic compiler is breaking rules
Look at any copiled file and tell me is there any resources cat.
No
That is not MS rules,
Am I right ?
For you cas I said I am sorry
For rsts I said you are welcome

and that is enough

Good day every one