Click here to Skip to main content
15,914,111 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
Generaldatagrid, calendar and databinding games... Pin
guim723-Feb-04 4:17
guim723-Feb-04 4:17 
GeneralRe: datagrid, calendar and databinding games... Pin
guim726-Feb-04 21:35
guim726-Feb-04 21:35 
GeneralCOM Interop Pin
jamie__smith23-Feb-04 0:57
jamie__smith23-Feb-04 0:57 
GeneralRe: COM Interop Pin
Matt Philmon23-Feb-04 4:01
Matt Philmon23-Feb-04 4:01 
GeneralRe: COM Interop Pin
Ernst Kuschke4-Mar-04 5:09
Ernst Kuschke4-Mar-04 5:09 
QuestionNMake ?? Pin
Maharishi Bhatia22-Feb-04 17:58
Maharishi Bhatia22-Feb-04 17:58 
AnswerRe: NMake ?? Pin
ian mariano26-Feb-04 1:32
ian mariano26-Feb-04 1:32 
GeneralWindow Location, Multiple Monitor Pin
Matt Philmon20-Feb-04 19:46
Matt Philmon20-Feb-04 19:46 
I'm writing a plug-in in VB.NET to a an application called DesktopSidebar for Windows. Right clicking my plug-in's "panel" shows among other things a Properties Dialog. All I need to do is pop up the dialog in the proper place and on the same monitor in a multiple monitor environment. My plug-in doesn't appear at this point to have the Window handle of the calling application. After quite a bit of trial and
error I came up with this:

Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Int32,
ByRef lpRect As RECT) As Int32

Public Structure RECT
Dim Left As Int32
Dim Top As Int32
Dim Right As Int32
Dim Bottom As Int32
End Structure

Dim colProcess() As System.Diagnostics.Process
Dim oProcess As Diagnostics.Process
colProcess = Diagnostics.Process.GetProcessesByName("sidebar")
If colProcess.Length > 0 Then
oProcess = colProcess(0)
Dim handle As System.IntPtr = oProcess.MainWindowHandle
Dim loc As RECT
If GetWindowRect(handle.ToInt32, loc) > 0 Then
'Where are we docked?
If loc.Left = 0 Then
Me.Location = New Drawing.Point(loc.Right,(loc.Bottom -
loc.Top)/2)
Else
Me.Location = New Drawing.Point(loc.Left - Me.Width,
(loc.Bottom - loc.Top)/2)
End If
End If
End If

This works great as long as you have a single monitor, whether DesktopSideBar is docked to the Left or the Right. However, I run in a
multi-monitor environment. In my particular setup my primary display is my laptop and my secondary display actually hovers ABOVE my primary display (it's a 19 inch monitor) and I have my desktop extended onto it. The code above, only targets the primary display, even though I dock DesktopSideBar on my secondary monitor. My screen coordinates are still good... just not on the right monitor.

Could anyone offer up some suggestions on how to not only determine the monitor my panel is on, but also how to set the location of my dialog to a specific place on the proper monitor?
GeneralRe: Window Location, Multiple Monitor Pin
apferreira26-Feb-04 7:47
apferreira26-Feb-04 7:47 
Questionhow to access web service with SSL from windows application (C#)? Pin
zhyluopro20-Feb-04 13:14
zhyluopro20-Feb-04 13:14 
GeneralTypecast a control Pin
john4620-Feb-04 5:27
john4620-Feb-04 5:27 
GeneralRe: Typecast a control Pin
Judah Gabriel Himango20-Feb-04 6:11
sponsorJudah Gabriel Himango20-Feb-04 6:11 
GeneralRe: Typecast a control Pin
Judah Gabriel Himango20-Feb-04 7:17
sponsorJudah Gabriel Himango20-Feb-04 7:17 
GeneralRe: Typecast a control Pin
john4620-Feb-04 9:29
john4620-Feb-04 9:29 
GeneralRe: Typecast a control Pin
Charlie Williams20-Feb-04 6:54
Charlie Williams20-Feb-04 6:54 
GeneralRe: Typecast a control Pin
Charlie Williams20-Feb-04 7:29
Charlie Williams20-Feb-04 7:29 
GeneralRe: Typecast a control Pin
john4622-Feb-04 6:16
john4622-Feb-04 6:16 
QuestionWhy is System.Web.Mail.SmtpMail.Send so slow? Pin
Anonymous19-Feb-04 8:37
Anonymous19-Feb-04 8:37 
AnswerRe: Why is System.Web.Mail.SmtpMail.Send so slow? Pin
Giles19-Feb-04 9:04
Giles19-Feb-04 9:04 
General.NET and DLL callbacks Pin
Michael Breier19-Feb-04 5:54
Michael Breier19-Feb-04 5:54 
GeneralRe: .NET and DLL callbacks Pin
Matt Philmon20-Feb-04 19:41
Matt Philmon20-Feb-04 19:41 
GeneralRe: .NET and DLL callbacks Pin
Michael Breier22-Feb-04 22:00
Michael Breier22-Feb-04 22:00 
GeneralRe: .NET and DLL callbacks Pin
Michael Breier22-Feb-04 22:17
Michael Breier22-Feb-04 22:17 
GeneralRe: .NET and DLL callbacks Pin
David Moody26-Feb-04 4:36
David Moody26-Feb-04 4:36 
GeneralRe: .NET and DLL callbacks Pin
Michael Breier10-Mar-04 6:46
Michael Breier10-Mar-04 6:46 

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.