473,513 Members | 2,290 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using PtInRect in VB.NET with little success

Hi
I have the following code (in VB.NET) but I can not get this to return true.
Declare Function PtInRect Lib "user32" (ByRef lpRect As Rectangle, ByVal pt
As Point) As Integer
-----------------------------------------------------
Dim tmpPnt As New Point(50, 50)
Dim tmpRect As New Rectangle(40, 40, 20, 20)
If PtInRect(tmpRect, tmpPnt) Then
Debug.WriteLine("TRUE")
Else
Debug.WriteLine("FALSE")
End If
Could anyone suggest where I am going wrong?
Regards, Carl Gilbert
Nov 20 '05 #1
7 3492
Hi,

Use the rectangle classes contains method instead

Dim rCheck As New Rectangle(40, 40, 20, 20)

Dim pt As New Point(50, 50)

Trace.WriteLine(rCheck.Contains(pt))

Ken

----------------------------

"Carl Gilbert" <wj*****@hotmail.com> wrote in message
news:OO**************@TK2MSFTNGP09.phx.gbl...
Hi
I have the following code (in VB.NET) but I can not get this to return true.
Declare Function PtInRect Lib "user32" (ByRef lpRect As Rectangle, ByVal pt
As Point) As Integer
-----------------------------------------------------
Dim tmpPnt As New Point(50, 50)
Dim tmpRect As New Rectangle(40, 40, 20, 20)
If PtInRect(tmpRect, tmpPnt) Then
Debug.WriteLine("TRUE")
Else
Debug.WriteLine("FALSE")
End If
Could anyone suggest where I am going wrong?
Regards, Carl Gilbert

Nov 20 '05 #2
Ah, the simplicity of it all.

Cheers Ken

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:uE**************@TK2MSFTNGP10.phx.gbl...
Hi,

Use the rectangle classes contains method instead

Dim rCheck As New Rectangle(40, 40, 20, 20)

Dim pt As New Point(50, 50)

Trace.WriteLine(rCheck.Contains(pt))

Ken

----------------------------

"Carl Gilbert" <wj*****@hotmail.com> wrote in message
news:OO**************@TK2MSFTNGP09.phx.gbl...
Hi
I have the following code (in VB.NET) but I can not get this to return true.

Declare Function PtInRect Lib "user32" (ByRef lpRect As Rectangle, ByVal pt As Point) As Integer
-----------------------------------------------------
Dim tmpPnt As New Point(50, 50)
Dim tmpRect As New Rectangle(40, 40, 20, 20)
If PtInRect(tmpRect, tmpPnt) Then
Debug.WriteLine("TRUE")
Else
Debug.WriteLine("FALSE")
End If
Could anyone suggest where I am going wrong?
Regards, Carl Gilbert

Nov 20 '05 #3
"Carl Gilbert" <wj*****@hotmail.com> wrote in message
news:OO**************@TK2MSFTNGP09.phx.gbl
Hi
I have the following code (in VB.NET) but I can not get this to
return true. <cut> Could anyone suggest where I am going wrong?


Apart from using VB.Net in the first place, no...
--
<response type="generic" language="VB.Net">
This newsgroup is for users of Visual Basic and whatever
VB.Net is, Visual Basic it isn't. Solutions appropriate to
one will be meaningless in the other and you are more likely
to get the answers you need in newsgroups that are
frequented by others using the dotnet platform rather than
here where the focus is on VB "classic" . Look for
newsgroups with the words "dotnet" or "vsnet" in their name.

For the msnews.microsoft.com news server, try these:

microsoft.public.dotnet.general
microsoft.public.dotnet.languages.vb

</response>
Nov 20 '05 #4
It sounds like you lead an interesting life Bob.

"Bob Butler" <ti*******@nospam.com> wrote in message
news:O1**************@TK2MSFTNGP10.phx.gbl...
"Carl Gilbert" <wj*****@hotmail.com> wrote in message
news:OO**************@TK2MSFTNGP09.phx.gbl
Hi
I have the following code (in VB.NET) but I can not get this to
return true.

<cut>
Could anyone suggest where I am going wrong?


Apart from using VB.Net in the first place, no...
--
<response type="generic" language="VB.Net">
This newsgroup is for users of Visual Basic and whatever
VB.Net is, Visual Basic it isn't. Solutions appropriate to
one will be meaningless in the other and you are more likely
to get the answers you need in newsgroups that are
frequented by others using the dotnet platform rather than
here where the focus is on VB "classic" . Look for
newsgroups with the words "dotnet" or "vsnet" in their name.

For the msnews.microsoft.com news server, try these:

microsoft.public.dotnet.general
microsoft.public.dotnet.languages.vb

</response>

Nov 20 '05 #5
"Carl Gilbert" <wj*****@hotmail.com> wrote in message
news:Od**************@TK2MSFTNGP11.phx.gbl
It sounds like you lead an interesting life Bob.


Sorry, I did not notice the cross-post between the Visual Fred and VB groups
Nov 20 '05 #6
Bob Butler wrote:
"Carl Gilbert" <wj*****@hotmail.com> wrote in message
news:Od**************@TK2MSFTNGP11.phx.gbl
It sounds like you lead an interesting life Bob.

Sorry, I did not notice the cross-post between the Visual Fred and VB groups


OE (thunderbird here) needs more powerful filters so we can just ignore
the .Net questions all together. It's obvious that people just don't
know (or care) that there's a difference, also obvious that MS likes it
that way... sad.

--
Ken Halter - MS-MVP-VB - http://www.vbsight.com
Please keep all discussions in the groups..
Nov 20 '05 #7
heh, might have something to do with the fact that there are something like
2,500+ newsgroups available. just navigating the NG's requires some skill and
experience. very possible that newcomers are completely overwhelmed and pick the
first .vb they recognize. but FWIW to all ya VB Classic programmers, many of us
over here in VB.Net agree it should be named something different. the same
animal they are not.

"Ken Halter" <Ken_Halter@Use_Sparingly_Hotmail.com> wrote in message
news:e0**************@TK2MSFTNGP11.phx.gbl...
Bob Butler wrote:
"Carl Gilbert" <wj*****@hotmail.com> wrote in message
news:Od**************@TK2MSFTNGP11.phx.gbl
It sounds like you lead an interesting life Bob.

Sorry, I did not notice the cross-post between the Visual Fred and VB groups


OE (thunderbird here) needs more powerful filters so we can just ignore
the .Net questions all together. It's obvious that people just don't
know (or care) that there's a difference, also obvious that MS likes it
that way... sad.

--
Ken Halter - MS-MVP-VB - http://www.vbsight.com
Please keep all discussions in the groups..

Nov 21 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3539
by: Saeed Amrollahi | last post by:
Dear All C++ Programmers Hello I am Saeed Amrollahi. I am a software engineer in Tehran Sewerage Company. I try to use std::map and map::find member function. I use Visual Studio .NET. my...
19
4066
by: James Fortune | last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't understand why people who know how to write code to completely replace a front end do not write something that will automate...
37
2998
by: hasadh | last post by:
Hello, probably this may be a simple qn to u all but I need an answer plz. In my software i used macros like OK,TRUE,FALSE,FAILURE . A friend who included this code as a library into his module...
3
1521
by: Norm via DotNetMonster.com | last post by:
I have an onchange event which fires when the content of an HTML textbox changes. My problem is that when I try to compare the content of this textbox with another HTML textbox using an if...
2
1932
by: jay | last post by:
I am attempting to impersonate an account in ASPNET. I am using aspnet_setreg to store the username and passwords. I have given the ASPNET account permisision to read the registry values. However,...
1
2369
by: Anonieko | last post by:
Understanding and Using Exceptions (this is a really long post...only read it if you (a) don't know what try/catch is OR (b) actually write catch(Exception ex) or catch{ }) The first thing I...
89
5950
by: Cuthbert | last post by:
After compiling the source code with gcc v.4.1.1, I got a warning message: "/tmp/ccixzSIL.o: In function 'main';ex.c: (.text+0x9a): warning: the 'gets' function is dangerous and should not be...
221
366987
Atli
by: Atli | last post by:
You may be wondering why you would want to put your files “into” the database, rather than just onto the file-system. Well, most of the time, you wouldn’t. In situations where your PHP application...
11
9686
by: O.B. | last post by:
Does C# support anything like PHP's break command that optionally accepts a parameter specifying how many loops to break out of?
0
7269
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7177
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7559
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7542
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4756
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3248
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3237
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
811
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
470
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.