Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Can we decide of the starting position of the message boxes ?

 

In fact my soft runs on a dual screen configuration and so all my messagebox are shown at the center of the screen resolution that is to say between my two screens... a little bit annoying...

 

So is there a way to ask a Message Box to pop up centered in a parent window or giving it a special position ?

 

(Of course it is possible to reimplement it with the forms, but I would prefer to avoid that...)

 

Thanks,

Jarod
Posted
Constructors 7 to 12 of the MessageBox class have the first parameter being the windows form for which the message box will be displayed in front of
My website
Posted

Yes but these constructers are only used to construct an owned dialog box (so minimize and maximize with its parent, no specific task icon, ...)

But the dialog box still appears at the center of the screen

Jarod
  • *Experts*
Posted

Search for "SetWindowsHookEx MessageBox" in Google, you'll find lots of answers. But overriding the position of the MessageBox is not simple as it involves windows hooks. Most of the articles you'll find will give good sample code though, so you don't have to worry too much.

 

-nerseus

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Posted

Ok one question however !

SetWindowsHookEx ask for a procedure address

In an exemple I found :

lgHook = SetWindowsHookEx(WH_CBT, AddressOf WinProc, lgInst, lgId)

But this doesn't work, seems to be VB code and not VB.NET

In my Case, I have a cast error

So how can we "translate" the address of a procedure into a long ?

Jarod

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...