Click here to Skip to main content
16,005,473 members
Home / Discussions / C#
   

C#

 
GeneralConsole Application problem...! Pin
QzRz7-Dec-04 8:09
QzRz7-Dec-04 8:09 
GeneralRe: Console Application problem...! Pin
Daniel Turini7-Dec-04 8:14
Daniel Turini7-Dec-04 8:14 
GeneralRe: Console Application problem...! Pin
QzRz7-Dec-04 8:16
QzRz7-Dec-04 8:16 
GeneralI can't get my codebehind to work Pin
bigtone787-Dec-04 6:44
bigtone787-Dec-04 6:44 
GeneralRe: I can't get my codebehind to work Pin
Dave Kreskowiak7-Dec-04 7:19
mveDave Kreskowiak7-Dec-04 7:19 
GeneralRe: I can't get my codebehind to work Pin
bigtone787-Dec-04 7:30
bigtone787-Dec-04 7:30 
GeneralRe: I can't get my codebehind to work Pin
Colin Angus Mackay7-Dec-04 12:01
Colin Angus Mackay7-Dec-04 12:01 
Generalicon not repainted on minimize of an overlaying window Pin
stefan houtz7-Dec-04 5:41
stefan houtz7-Dec-04 5:41 
Hi,

I use the code below to react on wm_erasebkgnd in a window of an external application. If I move an overlaying window with the mouse, PaintExtras() is executed succesfully. But if I minimize an overlaying window, PaintExtras() is executed and the messagebox gives for example 984521/1/1/1 indicating as far as I know that all apicalls have been executed succesfully, but my image has disappeared. What am I missing (in my code I mean Wink | ;-) ?

using System;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace WindowsApplication1
{
///
/// Summary description for Form1.
///

///


[ClassInterface(ClassInterfaceType.AutoDual)]
public class GenericWindow : NativeWindow
{
///
/// Required designer variable.
///



public const int WM_ERASEBKGND = 0x14;


#region Imported DLL functions

[DllImport("user32.dll", CharSet=CharSet.Auto)]
static public extern int GetDC(int hWnd);
[DllImport("user32.dll", CharSet=CharSet.Auto)]
public static extern int ReleaseDC(int hWnd,int hDc);
[DllImport("User32.dll")]
private static extern int DestroyIcon(int hIcon);
[DllImport("user32.dll")]
public static extern int DrawIcon(int hdc, int x, int y, int hIcon);
[DllImport("shell32.dll", CharSet=CharSet.Auto)]
public static extern int ExtractIcon(int hInst, string lpszExeFileName, int nIconIndex);
#endregion
public GenericWindow()
{

}

public void NotifyWindow(int windowHandle)
{
this.AssignHandle((IntPtr)windowHandle);
PaintExtras();
}


///
/// Clean up any resources being used.
///



protected override void WndProc(ref Message messg)
{

if (WM_ERASEBKGND == messg.Msg)
{
PaintExtras();
}
// Call base WndProc for default handling
base.WndProc(ref messg);
}

public void PaintExtras()
{
int hdc = GetDC(this.Handle.ToInt32());

if (hdc != 0)
{
int hIcon = ExtractIcon(this.Handle.ToInt32(),"C:\\progress10\\wrk\\experim\\down.ico",0);
int ret = DrawIcon (hdc, 1, 1, hIcon);
int ret2 = DestroyIcon (hIcon);
int ret3 = ReleaseDC(this.Handle.ToInt32(),hdc);
MessageBox.Show(hIcon.ToString() + "/" + ret.ToString() + "/" + ret2.ToString() + "/" + ret3.ToString());
}
}
}
}

regards,

Stefan.
GeneralRe: icon not repainted on minimize of an overlaying window Pin
Dave Kreskowiak7-Dec-04 7:14
mveDave Kreskowiak7-Dec-04 7:14 
GeneralRe: icon not repainted on minimize of an overlaying window Pin
stefan houtz7-Dec-04 23:12
stefan houtz7-Dec-04 23:12 
Generalsatellite software Pin
SESCO LIBYA7-Dec-04 4:19
SESCO LIBYA7-Dec-04 4:19 
GeneralRe: satellite software Pin
Daniel Turini7-Dec-04 4:33
Daniel Turini7-Dec-04 4:33 
GeneralRe: satellite software Pin
Dave Kreskowiak7-Dec-04 5:34
mveDave Kreskowiak7-Dec-04 5:34 
GeneralRe: satellite software Pin
SESCO Libya18-Dec-04 5:47
sussSESCO Libya18-Dec-04 5:47 
GeneralRe: satellite software Pin
Dave Kreskowiak8-Dec-04 15:02
mveDave Kreskowiak8-Dec-04 15:02 
GeneralRe: satellite software Pin
leppie27-Dec-04 10:51
leppie27-Dec-04 10:51 
GeneralRe: satellite software Pin
Dave Kreskowiak27-Dec-04 15:56
mveDave Kreskowiak27-Dec-04 15:56 
GeneralRe: satellite software Pin
John M. Drescher27-Dec-04 6:36
John M. Drescher27-Dec-04 6:36 
GeneralRe: satellite software Pin
Jesse Squire7-Dec-04 6:09
Jesse Squire7-Dec-04 6:09 
GeneralRe: satellite software Pin
Judah Gabriel Himango7-Dec-04 7:02
sponsorJudah Gabriel Himango7-Dec-04 7:02 
GeneralRe: satellite software Pin
Alex Korchemniy7-Dec-04 10:43
Alex Korchemniy7-Dec-04 10:43 
GeneralRe: satellite software Pin
leppie8-Dec-04 2:54
leppie8-Dec-04 2:54 
GeneralRe: satellite software Pin
J. Dunlap27-Dec-04 9:50
J. Dunlap27-Dec-04 9:50 
Generaldrop-down menu in .net cf Pin
wfettich7-Dec-04 4:00
wfettich7-Dec-04 4:00 
GeneralRe: drop-down menu in .net cf Pin
Dave Kreskowiak7-Dec-04 5:31
mveDave Kreskowiak7-Dec-04 5:31 

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.