Another Question about FWH and Word

Another Question about FWH and Word

Postby driessen » Sun Jul 30, 2023 4:59 pm

Hello,

How do I disconnect an Add-on in Word by my FWH-applicqation which is active at the moment?

Thanks.
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Another Question about FWH and Word

Postby Antonio Linares » Mon Jul 31, 2023 4:53 am

Dear Michel,

What addon is it ?
regards, saludos

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

Re: Another Question about FWH and Word

Postby driessen » Mon Jul 31, 2023 5:34 am

An add-on containing macros. It is called macjuda.dot.
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Another Question about FWH and Word

Postby Antonio Linares » Mon Jul 31, 2023 5:56 am

Dear Michel,

According to google Bard it can be done this way:
Code: Select all  Expand view  RUN
#include <windows.h>

int main() {
  // Get the handle of the Word application.
  HWND word_app = FindWindow(L"Word.Application", NULL);

  // Get the handle of the macjuda.dot file.
  HMODULE macjuda_dot = LoadLibrary(L"macjuda.dot");

  // Disconnect the macjuda.dot file from Word.
  DisconnectObject(word_app, macjuda_dot);

  return 0;
}
regards, saludos

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

Re: Another Question about FWH and Word

Postby driessen » Thu Aug 10, 2023 3:11 pm

Antonio,

Unfortunately, I wasn't able to use your suggestion because I got a lot of errors.

But maybe I can solve it is you can help me to transate this VBA-sentence into FWH :
Code: Select all  Expand view  RUN
AddIns("C:\Users\Michel\AppData\Roaming\Microsoft\Word\STARTUP\MacJuda.dotm").Installed = False
Any idea?

Thanks a lot in advance.
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Another Question about FWH and Word

Postby Antonio Linares » Fri Aug 11, 2023 4:35 am

Dear Michel,

chatgpt proposes this code, not sure if it will work as expected. You can easily port it to FWH
Code: Select all  Expand view  RUN
#include <stdio.h>
#include <windows.h>

int main() {
    HKEY hKey;
    const char *regPath = "Software\\Microsoft\\Office\\Word\\Addins\\MacJuda.dotm";
   
    if (RegOpenKeyEx(HKEY_CURRENT_USER, regPath, 0, KEY_WRITE, &hKey) == ERROR_SUCCESS) {
        DWORD value = 0;
        if (RegSetValueEx(hKey, "Installed", 0, REG_DWORD, (const BYTE*)&value, sizeof(DWORD)) == ERROR_SUCCESS) {
            printf("Value 'Installed' set to False.\n");
        } else {
            printf("Error setting value.\n");
        }
        RegCloseKey(hKey);
    } else {
        printf("Error opening registry key.\n");
    }
   
    return 0;
}
 
regards, saludos

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

Re: Another Question about FWH and Word

Postby driessen » Fri Aug 11, 2023 9:04 am

Atonio,

Thank you for your efforts.

Unfortunately, this isn't working.
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 87 guests