FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Another Question about FWH and Word
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Another Question about FWH and Word
Posted: Sun Jul 30, 2023 04: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. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Another Question about FWH and Word
Posted: Mon Jul 31, 2023 04:53 AM

Dear Michel,

What addon is it ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: Another Question about FWH and Word
Posted: Mon Jul 31, 2023 05:34 AM

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

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Another Question about FWH and Word
Posted: Mon Jul 31, 2023 05:56 AM
Dear Michel,

According to google Bard it can be done this way:
Code (fw): Select all Collapse
#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
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: Another Question about FWH and Word
Posted: Thu Aug 10, 2023 03: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 (fw): Select all Collapse
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. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Another Question about FWH and Word
Posted: Fri Aug 11, 2023 04:35 AM
Dear Michel,

chatgpt proposes this code, not sure if it will work as expected. You can easily port it to FWH
Code (fw): Select all Collapse
#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
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: Another Question about FWH and Word
Posted: Fri Aug 11, 2023 09: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. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Continue the discussion