How to assign GUID to Info->PluginMenu.Guids

A place where plug-in developers can share their knowledge and experience.
Post Reply
jonib
Posts: 72
Joined: Wed 16 Apr, 2008 19:55
Has thanked: 1 time

How to assign GUID to Info->PluginMenu.Guids

Post by jonib » Wed 21 Oct, 2015 16:29

Working with the HelloWorld plugin as basis still

in the function:

Code: Select all

void WINAPI GetPluginInfoW(struct PluginInfo *Info)
I'm trying to assing a GUID to:

Code: Select all

Info->PluginMenu.Guids
Problem is I can't figure out anything that works.

I declare a new GUID like this:

Code: Select all

GUID MenuId;
And add in the correct values, but can't figure out what to do? I replaced MenuGuid from the code:

Code: Select all

Info->PluginMenu.Guids=&MenuId;
But I don't get the correct GUID showing in FAR plugins info.

Should I post these kinds of questions in separate topics or in my main plugin topic?

jonib
Last edited by jonib on Thu 22 Oct, 2015 18:14, edited 3 times in total.

User avatar
HaRT
Moderator
Posts: 7982
Joined: Tue 30 Aug, 2005 17:21
Location: Санкт-Петербург
Has thanked: 66 times
Been thanked: 97 times

How to assign GUID to Info->PluginMenu.Guids

Post by HaRT » Wed 21 Oct, 2015 16:41

jonib wrote: Should I post these kinds of questions in separate topics or in my main plugin topic?
Separate, especially considering this:
jonib wrote: please no more unrelated to Python suggestions
Фар есть инструмент, а не нянька. © 2009 DrKnS

jonib
Posts: 72
Joined: Wed 16 Apr, 2008 19:55
Has thanked: 1 time

How to assign GUID to Info->PluginMenu.Guids

Post by jonib » Wed 21 Oct, 2015 17:13

HaRT wrote:Separate,
OK
especially considering this:
jonib wrote: please no more unrelated to Python suggestions
As I'm doing the plugin in C++ I only meant I wasn't interested in doing plugins in other languages unless they helped me support Python. I could have probably worded it differently but frustration and having English as my third language that's what came out. :bojan:

jonib

jonib
Posts: 72
Joined: Wed 16 Apr, 2008 19:55
Has thanked: 1 time

How to assign GUID to Info->PluginMenu.Guids

Post by jonib » Wed 21 Oct, 2015 19:18

Checking the FAR API manual (after translation) it says "Info->PluginMenu.Guids" wants an "address of an array of GUIDs" unfortunately it didn't help me figure out how I need to define the variable. So still would like some hints.

jonib

jonib
Posts: 72
Joined: Wed 16 Apr, 2008 19:55
Has thanked: 1 time

How to assign GUID to Info->PluginMenu.Guids

Post by jonib » Thu 22 Oct, 2015 01:30

So finally this crisis is over. :Yahoo!:

When trying to define the GUID as an array I used this:

Code: Select all

GUID MenuId[1];
But it didn't work.

But using this below:

Code: Select all

GUID *MenuId = new GUID[1];
This works. I assumed they would have more or less the same effect but what do I know.

I'm convinced that the designer of C/C++ is a sadist. Designed to make me waste time on stooped stuff. :evil:

jonib

User avatar
DrKnS
Posts: 4535
Joined: Thu 04 Aug, 2005 06:44
Location: Kyiv
Has thanked: 2 times
Been thanked: 113 times
Contact:

How to assign GUID to Info->PluginMenu.Guids

Post by DrKnS » Thu 22 Oct, 2015 07:02

jonib wrote:When trying to define the GUID as an array I used this:

Code: Select all

GUID MenuId[1];
But it didn't work.
Sure it didn't, if you returned address of a local variable.
As mentioned in PluginMenuItem description, all pointers passed through this structure must be valid after returning from GetPluginInfoW, so you can't use local variables. Use static or global ones.
But using this below:

Code: Select all

GUID *MenuId = new GUID[1];
This works. I assumed they would have more or less the same effect but what do I know.
Now you have a memory leak.

HelloWorld plugin has a working example of how to do it. MenuGuid is a global variable defined in a separate header, guid.hpp, all you had to do is replace numbers there.

jonib
Posts: 72
Joined: Wed 16 Apr, 2008 19:55
Has thanked: 1 time

[Solved]How to assign GUID to Info->PluginMenu.Guids

Post by jonib » Thu 22 Oct, 2015 14:39

DrKnS wrote:Sure it didn't, if you returned address of a local variable.
As mentioned in PluginMenuItem description, all pointers passed through this structure must be valid after returning from GetPluginInfoW, so you can't use local variables. Use static or global ones.
I think I'm starting to understand, thanks.
Now you have a memory leak.
But it works, trallalalla :oops:
HelloWorld plugin has a working example of how to do it. MenuGuid is a global variable defined in a separate header, guid.hpp, all you had to do is replace numbers there.
As I'm defining the GUID in Python, and sending it via a function to C++ I can't change and use the defined MenuGuid, right?

So would this work then?

Code: Select all

static GUID *MenuId = new GUID[1];
Or would that be too optimistic?

Code: Select all

linking final.32W.gcc/PythonFAR.dll
d:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../..\libmingw32.a(tlsthrd.o):(.text+0x10): undefined reference to `EnterCriticalSection@4'
d:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../..\libmingw32.a(tlsthrd.o):(.text+0x54): undefined reference to `LeaveCriticalSection@4'
d:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../..\libmingw32.a(tlsthrd.o):(.text+0xbd): undefined reference to `EnterCriticalSection@4'
d:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../..\libmingw32.a(tlsthrd.o):(.text+0xda): undefined reference to `LeaveCriticalSection@4'
d:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../..\libmingw32.a(tlsthrd.o):(.text+0x128): undefined reference to `EnterCriticalSection@4'
d:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../..\libmingw32.a(tlsthrd.o):(.text+0x158): undefined reference to `LeaveCriticalSection@4'
d:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../..\libmingw32.a(tlsthrd.o):(.text+0x17c): undefined reference to `LeaveCriticalSection@4'
d:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../..\libmingw32.a(tlsthrd.o):(.text+0x1ea): undefined reference to `DeleteCriticalSection@4'
d:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../..\libmingw32.a(tlsthrd.o):(.text+0x218): undefined reference to `InitializeCriticalSection@4'
ertr000001.o:(.rdata+0x0): undefined reference to `_pei386_runtime_relocator'
collect2.exe: error: ld returned 1 exit status
../makefile_gcc_target_inc:35: recipe for target 'final.32W.gcc/PythonFAR.dll' failed
mingw32-make.EXE: *** [final.32W.gcc/PythonFAR.dll] Error 1
So that didn't work too well. :o

So how do I declare a variable that is acceptable? I don't want to waste another day trying to figure this out.

jonib

2useven10
Posts: 2954
Joined: Mon 07 Sep, 2009 10:40
Has thanked: 2 times
Been thanked: 77 times

[Solved]How to assign GUID to Info->PluginMenu.Guids

Post by 2useven10 » Thu 22 Oct, 2015 14:56

jonib wrote:I don't want to waste another day trying to figure this out.
All your project is wasting time. If you will not try to figure out what you do.

jonib
Posts: 72
Joined: Wed 16 Apr, 2008 19:55
Has thanked: 1 time

[Solved]How to assign GUID to Info->PluginMenu.Guids

Post by jonib » Thu 22 Oct, 2015 15:27

2useven10 wrote:All your project is wasting time. If you will not try to figure out what you do.
What?!, is this supposed to be some kind of encouragement. Where did I write that I wouldn't try to figure out what to do? I'm just trying to minimize wasting of limited resourses (My patience, motivation and my sanity)

jonib

2useven10
Posts: 2954
Joined: Mon 07 Sep, 2009 10:40
Has thanked: 2 times
Been thanked: 77 times

How to assign GUID to Info->PluginMenu.Guids

Post by 2useven10 » Fri 23 Oct, 2015 10:34

jonib wrote: So I am tired to wait for someone to add Python support for Far manager, so I'll try myself.

I did some basic courses in C/C++ about 20 years ago and I really never liked to code in it. So I'm rusty/have no idea what I'm doing.
Do not waste your time. You have not enough skills for that task.

Post Reply

Return to “Plug-In Developers”

Who is online

Users browsing this forum: No registered users and 1 guest