Click here to Skip to main content
15,888,521 members
Home / Discussions / C#
   

C#

 
GeneralRe: Lostfocus Pin
Assaf824-Sep-07 9:24
Assaf824-Sep-07 9:24 
GeneralRe: Lostfocus Pin
Urs Enzler4-Sep-07 21:31
Urs Enzler4-Sep-07 21:31 
Questionpassing a collection of objects Pin
jon-804-Sep-07 8:35
professionaljon-804-Sep-07 8:35 
AnswerRe: passing a collection of objects Pin
Christian Graus4-Sep-07 8:50
protectorChristian Graus4-Sep-07 8:50 
GeneralRe: passing a collection of objects Pin
jon-804-Sep-07 12:49
professionaljon-804-Sep-07 12:49 
Questiondraw on transparent form Pin
greekius4-Sep-07 8:06
greekius4-Sep-07 8:06 
AnswerRe: draw on transparent form Pin
Spacix One4-Sep-07 8:55
Spacix One4-Sep-07 8:55 
QuestionCapturing every minimize and restore Pin
Spacix One4-Sep-07 6:37
Spacix One4-Sep-07 6:37 
I'm working on an application where I need to capture minimize and restore (all of them) and I ran into a problem with my current method...

At the moment I have an override in winproc to look for "size_minimize" and then it'll prompt me. I also look for the system command "SC_RESTORE" to reset it, but I have an issue, if you open the application minimize and then use tasksmanager's "switch to" it doesn't send the "SC_RESTORE" and this will cause a horrible problem! The app will stop working till they minimize and restore it normally...

I HAVE to shutdown my background workers when the app is minimized, and restore them when the user restores the app...

Here is my current winproc
protected override void WndProc(ref System.Windows.Forms.Message m)
{
    bool bwincmd = false;
    switch (m.Msg)
    {
        case 0x112: //WM_SYSCOMMAND
            switch (m.WParam.ToInt32() & 0xFFF0)
            {
                //redundant but prevents Maximize command (CreateParams has it grayed out)
                case 0xF030: //SC_MAXIMIZE
                    bwincmd = true; //allow do nothing else
                    break;
                case 0xF010: //SC_MOVE
                    setprogramedmove(); //move and click the mouse to move the application
                    bwincmd = true; //allow do nothing
                    break;
                case 0xF120: //SC_RESTORE (this is the only way to restore? doesn't look like it)
                    bMinimized = false; //flag workers to start again
                    break;
            }
            break;
        case 0x0005: //WM_SIZE
            switch (m.WParam.ToInt32())
            {
                case 0x1: //SIZE_MINIMIZED
                    if (this.OnMinimize != null)
                    {
                        //call captured minimize event
                        this.OnMinimize(this, EventArgs.Empty);
                    }
                    break;
            }
            break;
    }
    if (bwincmd)
    {
        //do nothing and stop real WndProc from seeing message.
        return;
    }
    else
    {
        // send control to base message handler (real WndProc)
        base.WndProc(ref m);
    }
}

I have no idea how taskmanager is restoring the app without sending SC_RESTORE


-Spacix
All your skynet questions[^] belong to solved
AnswerRe: Capturing every minimize and restore Pin
Giorgi Dalakishvili4-Sep-07 7:25
mentorGiorgi Dalakishvili4-Sep-07 7:25 
GeneralRe: Capturing every minimize and restore [modified] Pin
Spacix One4-Sep-07 7:48
Spacix One4-Sep-07 7:48 
GeneralRe: Capturing every minimize and restore Pin
Skippums4-Sep-07 12:05
Skippums4-Sep-07 12:05 
GeneralRe: Capturing every minimize and restore Pin
Spacix One4-Sep-07 14:19
Spacix One4-Sep-07 14:19 
AnswerRe: Capturing every minimize and restore Pin
Spacix One6-Sep-07 5:14
Spacix One6-Sep-07 5:14 
GeneralRe: Capturing every minimize and restore Pin
Giorgi Dalakishvili6-Sep-07 5:36
mentorGiorgi Dalakishvili6-Sep-07 5:36 
GeneralRe: Capturing every minimize and restore Pin
Spacix One6-Sep-07 6:52
Spacix One6-Sep-07 6:52 
QuestionFailed to import C++ COM DLL in to C# in .NET 2005 Pin
Jack Rong4-Sep-07 5:48
Jack Rong4-Sep-07 5:48 
QuestionPassing IP from client across servers Pin
Gump6194-Sep-07 5:38
Gump6194-Sep-07 5:38 
Questionhow to get a list of all avilable controls in a namespace Pin
Amar Chaudhary4-Sep-07 5:21
Amar Chaudhary4-Sep-07 5:21 
AnswerRe: how to get a list of all avilable controls in a namespace Pin
led mike4-Sep-07 5:39
led mike4-Sep-07 5:39 
QuestionRe: how to get a list of all avilable controls in a namespace Pin
Amar Chaudhary4-Sep-07 6:55
Amar Chaudhary4-Sep-07 6:55 
AnswerRe: how to get a list of all avilable controls in a namespace Pin
Amar Chaudhary4-Sep-07 7:00
Amar Chaudhary4-Sep-07 7:00 
GeneralRe: how to get a list of all avilable controls in a namespace Pin
Giorgi Dalakishvili4-Sep-07 7:18
mentorGiorgi Dalakishvili4-Sep-07 7:18 
GeneralRe: how to get a list of all avilable controls in a namespace Pin
led mike4-Sep-07 7:28
led mike4-Sep-07 7:28 
GeneralRe: how to get a list of all avilable controls in a namespace Pin
Amar Chaudhary4-Sep-07 19:44
Amar Chaudhary4-Sep-07 19:44 
QuestionRegEx help for a RegEx Newb Pin
flipdoubt4-Sep-07 5:04
flipdoubt4-Sep-07 5:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.