--
Chris Hanscom - Microsoft MVP (VB)
Veign's Resource Center
http://www.veign.com/vrc_main.asp
--
"Kathy" <kha...@yahoo.com.nospam> wrote in message
news:OoNhoUY9...@tk2msftngp13.phx.gbl...
"Kathy" <kha...@yahoo.com.nospam> wrote in message
news:OoNhoUY9...@tk2msftngp13.phx.gbl...
--
Chris Hanscom - Microsoft MVP (VB)
Veign's Resource Center
http://www.veign.com/vrc_main.asp
--
"CajunCoiler (http://tesla.msbdatasystems.com)"
<cajun...@totallyspamless.msbdatasystems.com> wrote in message
news:gMXDd.46921$F25.6030@okepread07...
Bryan
____________________________________________________________
New Vision Software "When the going gets weird,"
Bryan Stafford "the weird turn pro."
alpine_don'tsen...@mvps.org Hunter S. Thompson -
Microsoft MVP-Visual Basic Fear and Loathing in LasVegas
On Sat, 8 Jan 2005 16:03:24 -0500, "Veign" <NOSPAM...@veign.com>
wrote:
--
Chris Hanscom - Microsoft MVP (VB)
Veign's Resource Center
http://www.veign.com/vrc_main.asp
--
"alpine" <alpine_don'tsen...@mvps.org> wrote in message
news:kbl0u0hh089gq0i3q...@4ax.com...
SetWindowPos( _
Me.hWnd, _
HWND_TOPMOST, _
0, _
0, _
0, _
0, _
SWP_NOSIZE Or SWP_NOMOVE _
)
in the form_load of the dialog. I don't believe anyone mentioned
this, so I suppose we can consider this as a new way, certainly
easier, and less hacking than the poke in the threads method of
enforcefor
Any comments?
> Why add a dependency for what is very simple to do through code?
I believe I asked the same question of this person in the past.
It's not a "new way" but more of a "hack" method to attempt to
accomplish what you said you wanted to do. I say hack because it
doesn't set focus on your application. If you app is so all-fire
important that the user MUST interact with it when you want them to,
you should be shifting focus to it rather than just annoying them with
a topmost window that may or may not obscure what they were working
on. By failing to set focus to your app, you force the user to
undergo an extra step of first bringing focus to the app and only then
can they interact with your annoying window thus annoying them doubly.
(any app that was *that* annoying wouldn't last long on my system.
;-) )
HTH,
Well now dig this....
You add a dependency for the very simple reason
that doing it through code is NOT simple to these
newcomers. If it were was simple as you guys seem
to believe it is, they wouldn't be coming in here and
asking for help.
Now get off your high-horses, and let people talk,
without try to pick apart every word they say.
"Jeff Johnson [MVP: VB]" <i....@enough.spam> wrote in message
news:uHg4zgd9...@TK2MSFTNGP09.phx.gbl...
Public Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal
hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long,
ByVal cy As Long, ByVal wFlags As Long) As Long
Public Const HWND_TOPMOST = -1
Public Const HWND_NOTOPMOST = -2
Public Const SWP_NOMOVE = &H2
Public Const SWP_NOSIZE = &H1
Public Const FLAG = SWP_NOMOVE Or SWP_NOSIZE
Sub setWindowOnTop(ByVal handle As Long, _
Optional ontop As Boolean = True)
If ontop Then
Call SetWindowPos(handle, HWND_TOPMOST, 0, 0, 0, 0, FLAG)
Else
Call SetWindowPos(handle, HWND_NOTOPMOST, 0, 0, 0, 0, FLAG)
End If
End Sub
--> Happy coding!
--
_______________________________________________________________________
"CajunCoiler (http://tesla.msbdatasystems.com)"
<cajun...@totallyspamless.msbdatasystems.com> wrote in message
news:LkcEd.47265$F25.10109@okepread07...
'This should be only in one line...
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long,
ByVal
hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long,
ByVal cy As Long, ByVal wFlags As Long) As Long
Private Const HWND_TOPMOST = -1
Private Const HWND_NOTOPMOST = -2
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOSIZE = &H1
Private Const FLAG = SWP_NOMOVE Or SWP_NOSIZE
Sub setWindowOnTop(ByVal handle As Long, _
Optional ontop As Boolean = True)
If ontop Then
Call SetWindowPos(handle, HWND_TOPMOST, 0, 0, 0, 0, FLAG)
Else
Call SetWindowPos(handle, HWND_NOTOPMOST, 0, 0, 0, 0, FLAG)
End If
End Sub
--> Happy coding!
--
_______________________________________________________________________
"CajunCoiler (http://tesla.msbdatasystems.com)"
<cajun...@totallyspamless.msbdatasystems.com> wrote in message
news:LkcEd.47265$F25.10109@okepread07...
Teaching someone to add a reference and drop a control on their form to
solve the problem is not teaching them anything. Giving them the code and
showing them how to use it teaches and gives them insight for future
situations that may arise.
A person should not get in the habit of adding 3rd party controls or DLL's.
This only add unnecessary references to a project and will only cause
problems in the future.
What advantage does adding a control over adding 20lines of code give
someone?
--
Chris Hanscom - Microsoft MVP (VB)
Veign's Resource Center
http://www.veign.com/vrc_main.asp
--
"CajunCoiler (http://tesla.msbdatasystems.com)"
<cajun...@totallyspamless.msbdatasystems.com> wrote in message
news:LkcEd.47265$F25.10109@okepread07...
Just because something is simple to do doesn't mean everyone
automatically knows how to do it. That's why people come to the
newsgroups... to learn what they don't know (or are having trouble
figuring out how to make something work). If you look at the code Chris
(Veign) refers the OP to, it is one of the more light-duty API functions
around (and even has a nice self-describing name of SetWindowOrder). If
the OP is inspired to learn a little bit about API functions, this gives
him a starting point. On the other hand, if the OP simply copies and
uses the code directly, well that would be no different than
incorporating your ActiveX control into his project. Actually, there
would be one difference... the OP wouldn't have to carry around an extra
dependency with Chris' approach.
By the way, I took a quick look at your website. In particular, I looked
at your StringStuff code (String manipulation is sort of a hobby with
me<g>) and I have a couple of comments for you. In your IsDigits
function, if the programmer specifies True for your optional AlwDec
argument, the function will return True for inputted string values
containing multiple decimal points. You might consider putting in a
check for that. Your GetExtension function assumes all file extensions
are 3 characters long... that is not always the case. You might consider
looking for the last period in the string and assume anything after that
is an extension (however, that is not guaranteed since a file does not
have to have an extension and file names can contains periods; but it is
probably a reasonable rule to follow). While it is not a giant time
saver by any means, in your DeriveName function, you might consider
looping backwards through the string (Step -1, reverse loop limits) in
order to find the last backslash character. That way, as soon as you
find it, you can stop the loop (instead of traveling the string from
left to right and storing/replacing each previous backslash character
until you hit the end of the string).
Rick - MVP
: (Veign) refers the OP to, it is one of the more light-duty API functions
: around (and even has a nice self-describing name of SetWindowOrder). If
The API is SetWindowPos; the wrapper is SetWindowOrder. :-)
--
Randy
If there is any "clique" involved here, it is the clique of those who
have experienced DLL hell first hand and want to help others avoid it.
So, it is the opinion of many who have been around awhile that it is
far better to teach someone how to do what they want to do using the
Windows API instead of steering them toward the potential of creating
DLL hell problems for their applications.
HTH,
Bryan
____________________________________________________________
New Vision Software "When the going gets weird,"
Bryan Stafford "the weird turn pro."
alpine_don'tsen...@mvps.org Hunter S. Thompson -
Microsoft MVP-Visual Basic Fear and Loathing in LasVegas
On Sun, 9 Jan 2005 09:46:56 -0600, "CajunCoiler
\(http://tesla.msbdatasystems.com\)"
Oops! Too fast with the Copy/Paste.
Rick
' ontop api '
Private Declare Function SetWindowPos Lib "user32" (ByVal hWnd As Long,
ByVal hWndInsertAfter As Long, ByVal x As Long, y, ByVal cx As Long, ByVal cy
As Long, ByVal wFlags As Long) As Long
Const HWND_TOPMOST = -1
Const SWP_NOMOVE = &H2
Const SWP_NOSIZE = &H1
Const TOPMOST_FLAGS = SWP_NOMOVE Or SWP_NOSIZE
' make a form topmost '
Public Sub MakeTopMost(hWnd As Long)
SetWindowPos hWnd, HWND_TOPMOST, 0, 0, 0, 0, TOPMOST_FLAGS
End Sub
write the following the form load event
ontop.MakeTopMost hWnd
--
Gaurav Creations
>I'm getting a little fed up with the attitude you guys are taking
>around here. Every time someone outside of your "clique"
>answers a question, it's automatically wrong, or nonsense.
Any advice that tells people to add a third party OCX or AX DLL is bad
advice