I created a SDL2 Window. How can I make it so that you can't close it with pressing the 'X'?
Probably with some flags, but which?
Just handle the close event by polling for it, and then you can just say that whenever somebody tries to close the window that the program should do nothing...that's really it.
OK, I found it. You only have to let the QUIT-query away.
Now another question: How to Close a uncloseable Window?
Related
This seems like a simple thing to do but I cannot find anything in the documentation about this, does anyone know how I can force a mini-program to close and return back to the super app?
Sadly there's no way to programmatically close a Mini Program. The user will have to manually close the Mini Program using the close button on the title bar to get back to the Super App.
I'm a new Mac programmer writing my first mac app, actually porting an existing iOS app to MAC.
The app does a lot of remote communication, so when the user kicks off an operation, I want to display a busy window (or message box, or NSAlert maybe), until the operation is completed, then dismiss it programmatically, or the user can click cancel to stop it.
The busy window prevents the user from doing anything until that operation is completed.
The busy window should have a progress spinner, some text, and a cancel button.
Its such a simple thing yet I'm having problems with it because I dont really know MAC programming, getting myself frustrated.
Can anybody offer suggestions, or already written code for it. I hope some code for this already exists because I cant believe I'm the only person in the world who needs things kind of busy window.
Thanks for any help.
You mean something like this:
http://www.developers-life.com/example-nspanel-with-nsprogressindicator.html
???
Source code is available, too (link at the end of the article).
You can just modify the NSPanel in Xcode and add a "Cancel" button that you connect to your cancel action.
I am working on a program built in MFC.
I have this weird situation when I shake my CFormView. The first time everything is minimised correctly, but when I shake it the second time while all of the windows are restored, one of my CDialog's inside the CFormView are going to the back, but it should be on front.
How can I catch the event of the second shake? What message does it send to my CDialog?
Is it something I can declare on my message map?
I couldn't find anything about it in the internet.
i have found my solution.
i didn't find any message that i could put my finger on, but on my function of "MoveDialog"
I used:
SetWindowPos(&wndNoTopMost,x,y,cx,cy,SWP_NOSIZE|SWP_SHOWWINDOW);
The &wndNoTopMost by MSDN is:
wndNoTopMost Repositions the window to the top of all non-topmost windows (that is, behind all topmost windows). This flag has no effect if the window is already a non-topmost window.
and this is how i have solved my problem!
Thank you!
How does WinTabber work? It can take the main window of another application and display it as a WinTabber child window. What system calls do this?
You have to use SetParent(). And probably MoveWindow() to force the app to fit its main window in your tab. And you'll have to do something reasonable when the process opens other toplevel windows, a WH_SHELL hook is probably needed. And probably a bunch of hacks to whack popular programs into shape that don't like you messing with their main window.
I don't really know where to begin. Let's start with the stupid questions:
What language should I use for this? What is suited for the task at hand?
Next, the real ones:
Is there a way to stop the screensaver from starting, short of changing the cursor position? If not, will changing the cursor position even work?
SetThreadExecutionState will prevent the screensaver from coming on or the machine from automatically going to sleep if you pass the ES_CONTINUOUS and ES_DISPLAY_REQUIRED flags.
I wrote an app awhile ago that does exactly what you are asking for. It runs as an icon in the System Tray, not the Taskbar, and uses a global message hook to disable the WM_SYSCOMMAND/SC_SCREENSAVE notification from reaching any applications. If that notification does not reach the DefWindowProc() function, the screen saver will never run.
Your program does not need to be visible in the task bar at all.
You don't even need a program at all, if you can disable the screensaver in the registry.
What you want to do can perhaps be achieved by sending a MOUSE_MOVE event to the desktop window. If you want to use C# (the only language I am current with right now), you can look at this article, but maybe a simple C program using the WinAPI is better suited for this task.
.NET will easily allow you to put an application in the system tray (checkout the NotifyIcon object in System.Windows.Forms.Controls).
I believe you can use the SetCursorPos (http://msdn.microsoft.com/en-us/library/ms648394(VS.85).aspx) API call to prevent the screen saver, just make sure you set them to the current location so you don't actually move the mouse.