Page 1 of 1
Another Question about FWH and Word
Posted:
Sun Jul 30, 2023 4:59 pm
by driessen
Hello,
How do I disconnect an Add-on in Word by my FWH-applicqation which is active at the moment?
Thanks.
Re: Another Question about FWH and Word
Posted:
Mon Jul 31, 2023 4:53 am
by Antonio Linares
Dear Michel,
What addon is it ?
Re: Another Question about FWH and Word
Posted:
Mon Jul 31, 2023 5:34 am
by driessen
An add-on containing macros. It is called macjuda.dot.
Re: Another Question about FWH and Word
Posted:
Mon Jul 31, 2023 5:56 am
by Antonio Linares
Dear Michel,
According to google Bard it can be done this way:
- Code: Select all Expand view
#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;
}
Re: Another Question about FWH and Word
Posted:
Thu Aug 10, 2023 3:11 pm
by driessen
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
AddIns("C:\Users\Michel\AppData\Roaming\Microsoft\Word\STARTUP\MacJuda.dotm").Installed = False
Any idea?
Thanks a lot in advance.
Re: Another Question about FWH and Word
Posted:
Fri Aug 11, 2023 4:35 am
by Antonio Linares
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
#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;
}
Re: Another Question about FWH and Word
Posted:
Fri Aug 11, 2023 9:04 am
by driessen
Atonio,
Thank you for your efforts.
Unfortunately, this isn't working.