Quick Search for:  in language:    
OLE,response,yesterdays,submission,timer,SetR
   Code/Articles » |  Newest/Best » |  Community » |  Jobs » |  Other » |  Goto » | 
CategoriesSearch Newest CodeCoding ContestCode of the DayAsk A ProJobsUpload
Visual Basic Stats

 Code: 3,149,602. lines
 Jobs: 144. postings

 How to support the site

 
Sponsored by:

 

You are in:

 
 
PDC 2003: Make the connection
Login



Latest Code Ticker for Visual Basic.
Click here to see a screenshot of this code!HistoryWriter Add-In V.1
By Zvonko Kostovski on 9/3

(Screen Shot)

Click here to see a screenshot of this code!Control Winamp
By Dennis Wollentin on 9/3

(Screen Shot)

Fake Virus Version 1.0
By C.J. Laing on 9/3


][String Encoder
By Andron Smth on 9/3


Font Catalog
By Bill Adams on 9/3


professional search
By Ziad Said on 9/3


Click here to see a screenshot of this code!Drew's Meta Tag Generator
By Drew Phillips on 9/3

(Screen Shot)

Fast BruteForce Class
By §e7eN on 9/3


Click here to see a screenshot of this code!Lotus Domino Exploit Scanner
By §e7eN on 9/3

(Screen Shot)

Click here to put this ticker on your site!


Add this ticker to your desktop!


Daily Code Email
To join the 'Code of the Day' Mailing List click here!





Affiliate Sites



 
 
   

Hyperlink Sample (one API function used:-)

Print
Email
 
winzip icon
Submitted on: 2/7/2002 6:10:05 AM
By: Vlad Vissoultchev 
Level: Intermediate
User Rating: By 99 Users
Compatibility:VB 6.0

Users have accessed this code 8529 times.
 

(About the author)
 
     This is in response to a yesterday's submission. No timer. No Set/Release capture (almost). The trick is that windowless controls ARE capturing mouse events upon mousedown BY DESIGN. So every label, image, or custom windowless control has the capture ability build-in. Thank you VB, I just figured out how to use this. Purely as an excercise you can encapsulate this code in a windowless usercontrol. Anyway, this implementation has at least two flaws. Can you find them? :-)) UPDATED: By popular demand now supports right click context menu, OLE drag&drop; (good enough), "hand" mouse cursor (with shadow on win2k!), WM_CANCELMODE (pretty decently). More API's used but still under 160 lines of code. 10x for the votes

 

Windows API/Global Declarations:

Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!

'**************************************
'Windows API/Global Declarations for :Hy
'     perlink Sample (one API function used:-)
'     
'**************************************

Private Declare Sub mouse_event Lib "user32"( _
    ByVal dwFlags As Long, ByVal dx As Long, _
    ByVal dy As Long, ByVal cButtons As Long, _
    ByVal dwExtraInfo As Long)
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzipto decompress it.

Virus note:All files are scanned once-a-day by Planet Source Code for viruses,but new viruses come out every day, so no prevention program can catch 100% of them.

FOR YOUR OWN SAFETY, PLEASE:
1)Re-scan downloaded files using your personal virus checker before using it.
2)NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
3)Scan the source code with Minnow's Project Scanner

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
1) You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.   
2) You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
3) You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
4) You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.


Other 9 submission(s) by this author

 

 
Report Bad Submission
Use this form to notify us if this entry should be deleted (i.e contains no code, is a virus, etc.).
Reason:
 
Your Vote!

What do you think of this code(in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor See Voting Log
 
Other User Comments
2/7/2002 9:02:25 AM:Niknak!!
There's me sitting there wondering how 
you got 4 excellent votes for this, the 
link only does one thing doesnt it 
hmm??  maybe you want to change it from 
"http://www.planet-source-code.com" to 
vote for my code!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/7/2002 5:35:27 PM:Vlad Vissoultchev
:-))) yeah, you are right. "users can't 
read! -- joel spolsky"... sure, you 
don't think this will get to be the 
code of the month!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/8/2002 10:07:34 AM:LCensoni
Alright, i'm giving up... what are the 
flaws? :)
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/11/2002 1:27:02 PM:Gary Choma
Actually, I found 3 flaws:
1. Mouse 
cursor should change to a hand when 
cursor is over the link.
2. 
Right-clicking on the link should not 
activate it.
3. On mouse-down, hold 
it and drag off the link, underline 
goes away, but link stays red until you 
let the mouse button up.
I have a 
cursor (.cur) file that I can send to 
anyone interested in fixing problem #1. 
 You just set the MouseIcon property of 
the label control to that file.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/11/2002 1:45:26 PM:Gary Choma
Replace similar call in project with 
this one to fix problem 
#3:
Label1.ForeColor = 
IIf(m_bPressed And m_bOver, vbRed, 
IIf(m_bOver, vbBlue, vbButtonText))
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/11/2002 1:46:52 PM:Gary Choma
Here's 2 modified procedures to fix 
problem #2:
Private Sub 
Label1_MouseDown(Button As Integer, 
Shift As Integer, X As Single, Y As 
Single)
    If Button = 1 Then
 If m_bEatMouseEvent Then
m_bEatMouseEvent = False
Exit Sub
        End If
        '--- 
press the link
        ChangeLinkState 
m_bOver, True
    End If
End 
Sub
Private Sub 
Label1_MouseUp(Button As Integer, Shift 
As Integer, X As Single, Y As Single)
   '--- eat mouse event if signalled
  If m_bEatMouseEvent Then
m_bEatMouseEvent = False
        Exit 
Sub
    End If
    '--- fire click if 
mouse released over the link
    If 
Button = 1 Then
        If m_bOver 
Then
            FireClick
End If
        '--- change link 
color
        ChangeLinkState False, 
False
    End If
End Sub
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/11/2002 1:47:02 PM:Vlad Vissoultchev
1. Well i have this .cur file too. 
(Though it does not have shadow on 
win2k, what about yours?:-))
2. 
Yeah, probably. Should change a line to 
fix this :-)) Line 81 should be "If 
Button = vbLeftButton Then 
FireClick"
3. I thought that this 
would be more interesting. So this is 
BY DESIGN (i.e. i meant it to be like 
this). If you want the behaviour your 
describe change Line 31 to 
"Label1.ForeColor = IIf(m_bOver, 
IIf(m_bPressed, vbRed, vbBlue), 
vbButtonText)"
HTH,
</wqw>
p.s. 
What i meant as flaws was:
1. 
WM_CANCELMODE is not handled. Demo: 
press and hold the link. Press 
Ctrl+Esc. Move out ot the link. It 
stays "pressed" (red)
2. It depends 
ot mouse clicks to function. Demo: Open 
Form1. Start Notepad (restored state). 
Focus Notepad. Move mouse pointer over 
the hyperlink (so a part of it should 
be visible below the Notepad). Voilla: 
Form1 has the focus. This is because 
it's sending an extra mouse click to 
windows mouse queue :-)) this is a 
"design flaw" :-))
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/11/2002 1:51:08 PM:Gary Choma
After my enhancements, I'd give this 
code 5 globes ;)
And if you really 
want to get picky, there's no support 
for drag-and-drop of the link (like if 
you wanted to drag the link to your 
desktop as a shortcut).
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/12/2002 11:13:34 AM:Vlad Vissoultchev
check out the new updated version
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
6/22/2002 1:50:57 PM:vbmaster
sorry, I think this doesn't deserve to 
be code of the month :[
If code 
verification thanks to PSC for add vote 
verification :)
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
7/14/2002 5:52:43 PM:Vlad Vissoultchev
vbmaster: relax, it wasn't! though the 
code has certain virtues it was clearly 
an experiment with users ability to 
discern latin letters and as a result 
to read message boxes 
:-))
</wqw>
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/31/2003 12:10:47 PM:A1Programmer
Not bad at all!!! But you could also 
use the Form_MouseMove to handle ALL 
your elements MouseOut Events. 
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
6/13/2003 2:16:30 PM:John Weir
Thank you as was looking for this 
little pice of code. Well done 
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
8/7/2003 9:08:42 PM:
I have been looking for something like 
this for days! THANK YOU! 
1. I did 
away with the msgbox "please vote etc" 
:-) and so clicking on the link calls 
ShellExecute immediately. But the IE 
window doesn't have focus. The title 
bar is dark blue indicating that it has 
focus, but when you scroll over any 
link on the page, nothing happens, just 
as if it did not have focus. You have 
to first click on the IE window 
someplace, and then all the links work 
normally when you mouse over them. But 
then the IE title bar is light blue, as 
if it were not in focus!! (But it is). 
2. If I slowly move the cursor up 
to the link from under the link, the 
underline is displayed slightly before 
the cursor changes. (This is a nit that 
I am completely not bothered about, but 
just interesting…)
3. I notice that 
the ShellExecute nShowCmd is set to 5 
and normally I use 1 (SW_SHOWNORMAL). 
Changing it doesn't seem to do anything 
- is there a difference?
PS-I gave 
you 5 globes!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
Add Your Feedback!
Note:Not only will your feedback be posted, but an email will be sent to the code's author in your name.

NOTICE: The author of this code has been kind enough to share it with you.  If you have a criticism, please state it politely or it will be deleted.

For feedback not related to this particular code, please click here.
 
Name:
Comment:

 

Categories | Articles and Tutorials | Advanced Search | Recommended Reading | Upload | Newest Code | Code of the Month | Code of the Day | All Time Hall of Fame | Coding Contest | Search for a job | Post a Job | Ask a Pro Discussion Forum | Live Chat | Feedback | Customize | Visual Basic Home | Site Home | Other Sites | About the Site | Feedback | Link to the Site | Awards | Advertising | Privacy

Copyright© 1997 by Exhedra Solutions, Inc. All Rights Reserved.  By using this site you agree to its Terms and Conditions.  Planet Source Code (tm) and the phrase "Dream It. Code It" (tm) are trademarks of Exhedra Solutions, Inc.