Solved

Create Right Click Event on Listview 's Column Header?

Posted on 2001-08-06
11
358 Views
Last Modified: 2007-12-19
Hi experts,

Can i Create Right Click Event on Listview Column Header?

How do i know if my Listview Column Header are Clicked using mouse's right click?

'Thanks.
0
Comment
Question by:Ryan Chong
  • 5
  • 5
11 Comments
 
LVL 27

Accepted Solution

by:
Ark earned 80 total points
ID: 6358275
0
 
LVL 49

Author Comment

by:Ryan Chong
ID: 6358399
Hi Ark,

I tried the code on link provided, but i crash my VB. It got error on Kernel.dll as:

_______________________________________________________

VB6 caused an exception c0000026H in module KERNEL32.DLL at 017f:bff88539.
Registers:
EAX=ffffffff CS=017f EIP=bff88539 EFLGS=00000213
EBX=ffffffff SS=0187 ESP=007ff948 EBP=007ffacc
ECX=ffffffff DS=0187 ESI=007ffa20 FS=0e77
EDX=bff7687a ES=0187 EDI=817c8680 GS=0000
Bytes at CS:EIP:
5f 5e 5b 8b e5 5d c2 10 00 8b 4c 24 04 56 0f b7
Stack dump:
0fc0d000 00000000 0541d864 0001001f 00000000 00000000 00000000 00000000 00000000 00000000 ffff137f ffff0000 ffffffff 00000000 00000000 00000000

______________________________________________________

So how can i overcome the problems?

Or any alternative links or codes? Comments?

Thanks.
0
 
LVL 6

Expert Comment

by:JonFish85
ID: 6358414
did you close the App via the Stop button in the VB IDE? When subclassing a window, you have to close it via the "X" button, or some other coded way... Otherwise, the Unload() code never executes, leaving windows unsure of where to send messages etc (I think, lemme know if im wrong)...
0
 
LVL 49

Author Comment

by:Ryan Chong
ID: 6379066
Hi JonFish85,

Sorry i'm not quite understand on what is your comment.

> did you close the App via the Stop button in the VB IDE?
So what method should i use to "Close" the window?

But before that my VB crashed before the code is successfully executed.

Any comments? Any useful links/ articles?

Thanks A Lot to ALL. : )
0
 
LVL 27

Expert Comment

by:Ark
ID: 6379177
Hi
When using subclassing, you should close program in IDE ONLY with main form [x] button. There won't be a prb when compiled.

Cheers
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 49

Author Comment

by:Ryan Chong
ID: 6760125
Hi Ark,

This question has been opened for a long time now (sorry about that), as got some free time to research recently i go back to this question.

As testing the code form the link you provided (VBNet) i still get the error. This time is:

"Invalid use of AddressOf" in HookWindow. I think this is a typical error. How can i figure it out?

Win2k, VB6 development environment.

Thanks a lot.
0
 
LVL 27

Expert Comment

by:Ark
ID: 6760205
"Invalid use of AddressOf" - this often occure when you place CallBack function at form/class module.
Function which you use in AddressOf operator MUST BE IN A BAS MODULE ONLY and be Public

Cheers
0
 
LVL 27

Expert Comment

by:Ark
ID: 6760207
"Invalid use of AddressOf" - this often occure when you place CallBack function at form/class module.
Function which you use in AddressOf operator MUST BE IN A BAS MODULE ONLY and be Public

Cheers
0
 
LVL 49

Author Comment

by:Ryan Chong
ID: 6760242
Hi Ark,

Although "Invalid use of AddressOf" error had been removed, but the whole running project disappear (corrupted?) from my desktop within seconds. So ..?? What may cause this happen?

Thanks
0
 
LVL 27

Expert Comment

by:Ark
ID: 6760275
Seems it's corrupted. This is subclassing behavior - when you subclass window/control, all messages come to your callback function first. But if you have an error inside function, VB try to interrupt process, while messages continue redirecting to missing(interrupting) function. This cause GPF. Check all code. Follow all instructions from VBNet (i.e. place everything they say "bas module" in bas module, "form code" - into form, name all controls same as in their code).

Cheers
0
 
LVL 49

Author Comment

by:Ryan Chong
ID: 6762904
Find the error, fixed it and finally it works!

Thanks a lot Ark :)
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now