Link to home
Start Free TrialLog in
Avatar of Ryan Chong
Ryan ChongFlag for Singapore

asked on

Create Right Click Event on Listview 's Column Header?

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.
ASKER CERTIFIED SOLUTION
Avatar of Ark
Ark
Flag of Russian Federation image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Ryan Chong

ASKER

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.
Avatar of JonFish85
JonFish85

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)...
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. : )
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
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.
"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
"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
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
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
Find the error, fixed it and finally it works!

Thanks a lot Ark :)