Solved

Create Right Click Event on Listview 's Column Header?

Posted on 2001-08-06
11
364 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 50

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
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
LVL 50

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
 
LVL 50

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 50

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 50

Author Comment

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

Thanks a lot Ark :)
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
ms access #TYPE! error on report when no data 4 75
DIR issue 7 54
VBS file using code from 2nd file (txt or vbs) 4 36
Access 2013 combo box not working 3 43
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

785 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