Replace context menus - WeOnlyDo Discussion board

Replace context menus (General questions)

by Sascha, Friday, October 29, 2004, 15:40 (7121 days ago)

Hi,
I tried to change the context menus within the activex component and it did not work.
As I found out the provided visual basic sample doesn't work either.
It always shows the same (background-)context menu whereever i do the right click.

Someone a solution to this? Maybe a problem with Visual Studio .NET?

Re: Replace context menus

by wodSupport, Friday, October 29, 2004, 16:14 (7121 days ago) @ Sascha

Sasha,

can you paste some related code?

Kreso

Re: Replace context menus

by Sascha, Friday, October 29, 2004, 16:51 (7121 days ago) @ wodSupport

No Problem [:smile:] (and thanks for the quick response)

I've found the following in your VB ActiveX Sample 2 after automatic conversion from Visual Studio .NET:

[code]
Dim m As Integer

m = GetMenu(Me.Handle.ToInt32)
m = GetSubMenu(m, 0)
eventArgs.Menu = m
eventArgs.HWND = Me.Handle.ToInt32
[/code]

All I get is a 'Hello from menu' which is exactly what is defined for the Background_menu.

Re: Replace context menus

by wodSupport, Friday, October 29, 2004, 21:45 (7120 days ago) @ Sascha

Change that code a bit :) Here's VB6 code, I'm sure you'll easy convert it to VB.NET:
[code]Private Sub wodFtpDLX1_ShowContextMenu(ByVal Item As wodFtpDLXLibCtl.IDirItem, Menu As Long, HWND As Long)
Dim m As Long

m = GetMenu(Me.HWND)
If Item Is Nothing Then
m = GetSubMenu(m, 0)
Else
If Item.Type = typeDirectory Then
m = GetSubMenu(m, 2)
Else
m = GetSubMenu(m, 1)
End If
End If
Menu = m
HWND = Me.HWND
End Sub
[/code]

basically, before you return menu handle to HWND param, choose appropriate menu (0=background, 1=file, 2=directory) with GetSubMenu API.

Re: Replace context menus

by Sascha, Tuesday, November 02, 2004, 09:59 (7117 days ago) @ wodSupport

That's what I was looking for [:smile:]
It works now; even in C# which I do at the moment. [:wink:]

Many thanks for the quick answer.

Sascha