Click here to Skip to main content
16,006,065 members
Home / Discussions / C#
   

C#

 
AnswerRe: DateTimePicker Pin
alexey N4-May-06 0:09
alexey N4-May-06 0:09 
GeneralRe: DateTimePicker Pin
V.4-May-06 0:14
professionalV.4-May-06 0:14 
AnswerRe: DateTimePicker Pin
microsoc4-May-06 20:16
microsoc4-May-06 20:16 
GeneralRe: DateTimePicker Pin
V.4-May-06 20:30
professionalV.4-May-06 20:30 
GeneralRe: DateTimePicker Pin
microsoc4-May-06 20:51
microsoc4-May-06 20:51 
GeneralRe: DateTimePicker Pin
V.4-May-06 21:15
professionalV.4-May-06 21:15 
QuestionGet Lan Computers Name Pin
freshonlineMax3-May-06 23:19
freshonlineMax3-May-06 23:19 
QuestionGetForegroundWindow() not working as expected Pin
g00fyman3-May-06 23:14
g00fyman3-May-06 23:14 
hi all,

i am trying to get the active window asw a bitmap, an earlier post directed me to the GetForegroundWindow() function in user32.dll

this however (with the code below) is returning both my desktops as the bitmap not the active window.

can any please help?

internal static Bitmap GetForegroundWindowBitmap()
{
  IntPtr handle = GetForegroundWindow();

  //Get a device context from the desktop window
  IntPtr windowDC = GetWindowDC(handle);

  Bitmap windowImage = GetBitmap(windowDC);

  ReleaseDC(windowDC);

  return windowImage;
}


internal static Bitmap GetBitmap(IntPtr imagePtr)
{
  //Get a GDI handle to the image
  IntPtr hwnd = GetCurrentObject(imagePtr, 7);

  Bitmap desktopImage = Image.FromHbitmap(hwnd);

  return desktopImage;
}


the above code (GetBitmap) works fine to get 'a' desktop or all desktops if i pass in GetDC(GetDesktopWindow())

kind regards,
g00fy
QuestionManagementObjectSearcher.Get Generic Failure Pin
vinu_p3-May-06 23:00
vinu_p3-May-06 23:00 
QuestionEvent Pin
AnhTin3-May-06 22:24
AnhTin3-May-06 22:24 
AnswerRe: Event Pin
freshonlineMax3-May-06 23:33
freshonlineMax3-May-06 23:33 
GeneralRe: Event Pin
J4amieC3-May-06 23:55
J4amieC3-May-06 23:55 
GeneralRe: Event Pin
AnhTin4-May-06 16:15
AnhTin4-May-06 16:15 
GeneralRe: Event Pin
microsoc4-May-06 20:35
microsoc4-May-06 20:35 
GeneralRe: Event Pin
AnhTin7-May-06 17:27
AnhTin7-May-06 17:27 
GeneralRe: Event Pin
microsoc7-May-06 17:29
microsoc7-May-06 17:29 
QuestionHow to get system info for every visitior Pin
papa19803-May-06 21:19
papa19803-May-06 21:19 
AnswerRe: How to get system info for every visitior Pin
sathish s3-May-06 21:24
sathish s3-May-06 21:24 
GeneralRe: How to get system info for every visitior Pin
papa19803-May-06 21:58
papa19803-May-06 21:58 
QuestionHow to use access db With Password ? Pin
hdv2123-May-06 21:15
hdv2123-May-06 21:15 
AnswerRe: How to use access db With Password ? Pin
Christian Graus3-May-06 21:36
protectorChristian Graus3-May-06 21:36 
Questionhow to export data of datagrid in WINFORM Pin
Aayush Singh3-May-06 21:02
Aayush Singh3-May-06 21:02 
AnswerRe: how to export data of datagrid in WINFORM Pin
sathish s3-May-06 21:39
sathish s3-May-06 21:39 
QuestionPopulating a asp:Listbox and setting the selected items Pin
Brendan Vogt3-May-06 20:35
Brendan Vogt3-May-06 20:35 
QuestionWeb Browerd in C# Pin
AnhTin3-May-06 19:58
AnhTin3-May-06 19:58 

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.