GET an activeX ENUM by name

GET an activeX ENUM by name

Postby toninhofwi » Fri Jun 28, 2024 12:04 pm

Hi friends,

Is there a way to get an active enum value by its name:

For example: I need get "xtpCalendarDayThursday" value to use in activeX object:

type
CalendarWeekDay = TOleEnum;
const
xtpCalendarDaySunday = 1;
xtpCalendarDayMonday = 2;
xtpCalendarDayTuesday = 4;
xtpCalendarDayWednesday = 8;
xtpCalendarDayThursday = 16;
xtpCalendarDayFriday = 32;
xtpCalendarDaySaturday = 64;
xtpCalendarDayAllWeek = 127;
xtpCalendarDaySaSu = 65;
xtpCalendarDayMo_Fr = 62;


Thanks and best regards.
toninhofwi
 
Posts: 172
Joined: Tue Oct 18, 2005 10:01 am

Re: GET an activeX ENUM by name

Postby Antonio Linares » Fri Jun 28, 2024 2:15 pm

Dear Toninho,

You may use defines for each value, in example:

#define xtpCalendarDayThursday 16
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42111
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: GET an activeX ENUM by name

Postby toninhofwi » Fri Jun 28, 2024 4:50 pm

Antonio Linares wrote:Dear Toninho,
You may use defines for each value, in example:
#define xtpCalendarDayThursday 16


Hi Antonio, Thanks for the answer.

I'm doing this, but it would be easier to get the value directly from the object.

BTW thank you :D

Regards.
toninhofwi
 
Posts: 172
Joined: Tue Oct 18, 2005 10:01 am

Re: GET an activeX ENUM by name

Postby Jimmy » Fri Jun 28, 2024 8:13 pm

toninhofwi wrote:Is there a way to get an active enum value by its name:
For example: I need get "xtpCalendarDayThursday" value to use in activeX object:
type
CalendarWeekDay = TOleEnum;

you need to compare Result from Enum with Calendar define Constant
Code: Select all  Expand view  RUN
Result_Value := TOleEnum;
Do CASE
   CASE xtpCalendarDaySunday = Result_Value
? "Sunday"
   CASE xtpCalendarDayMonday = Result_Value
? "Monday"
   CASE xtpCalendarDayTuesday = Result_Value
? "Tuesday"
   CASE xtpCalendarDayWednesday = Result_Value
? "Wednesday"
   CASE xtpCalendarDayThursday = Result_Value
? "Thursday"
   CASE xtpCalendarDayFriday = Result_Value
? "Friday"
   CASE xtpCalendarDaySaturday = Result_Value
? "Saturday"
   CASE xtpCalendarDayAllWeek = Result_Value
? "AllWeek"
   CASE xtpCalendarDaySaSu = Result_Value
? "SaSu"
   CASE xtpCalendarDayMo_Fr = Result_Value
? "Mo_Fr"
ENDCASE
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: GET an activeX ENUM by name

Postby Lailton » Mon Jul 08, 2024 7:26 pm

Hi my friend toninhofwi,

It is something that I had in mind to verify too.
I will be checking about it and if I discover something I will share here.

:D
Regards,
Lailton Fernando Mariano
User avatar
Lailton
 
Posts: 154
Joined: Fri Jul 20, 2012 1:49 am
Location: Brazil

Re: GET an activeX ENUM by name

Postby Antonio Linares » Tue Jul 09, 2024 6:13 am

Just do a binary search inside the ActiveX DLL for xtpCalendarDayThursday and check if it is there
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42111
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Natter, Silvio.Falconi and 86 guests