Unveiling a Boolean value to JavaScript through an ActiveX control in ATL

Currently, I am in the process of creating an ActiveX control using ATL and am facing a challenge when trying to expose a property that takes a Boolean value. Below is my implementation:

STDMETHOD(get_Visible)(VARIANT_BOOL *pVal);
STDMETHOD(put_Visible)(VARIANT_BOOL newVal);

Within my JavaScript function, I attempt to call this using the following code:

MyAxCtl.Visible = true;
//MyAxCtl.Visible = "true";
//MyAxCtl.Visible = "TRUE";
//MyAxCtl.Visible = "VARIANT_TRUE";
//MyAxCtl.Visible = -1;
//MyAxCtl.Visible = "-1";

Unfortunately, none of these methods seem to work for me. Therefore, I am seeking advice on how to effectively expose a Boolean value from an ATL ActiveX control to JavaScript.

Additionally, if anyone can direct me towards documentation regarding communication between ATL types and JavaScript types, it would be greatly appreciated. I am specifically interested in finding a comprehensive list of ATL types that can be successfully exposed to JavaScript.

Thank you in advance, Shupining

Answer №1

Your code contains the correct STDMETHOD's and the proper JavaScript call for a Boolean is to set it to true.

There doesn't appear to be a case issue with the code you provided, but make sure to use "Visible" instead of "visisble".

When you are debugging, are you seeing the ActiveX call being executed?

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

JavaScript's forEach function is utilized for handling button events

Just getting started with JavaScript and I've run into a problem. Can anyone help me spot where I went wrong below? The button doesn't seem to be functioning as expected. <!DOCTYPE html> <html> <body> <button onclick =" ...

Node.js is encountering an error with the post method where req.body is returning an empty

When utilizing cURL or Postman, the operations perform as anticipated curl -d 'username=Johny Sample&title=My First Post&description=We need some assistance cleaning up after the hurricane&postID=Johny Sample_1' http://localhost: ...

Unable to store a customized class object in Parse database

I have been attempting to create a Customer class object that is linked one-to-one with the User class. However, despite my efforts, the object does not save and no error message appears. Here is the code I am working with: Parse.Cloud.afterSave(Parse.Us ...

Designing Angular2 application structure for various platforms (web, mobile, native)

Imagine an ng2 application that caters to multiple platforms such as web, mobile-web, and mobile-native. Due to the presence of shared files like action creators, reducers, services, and common components across these platforms, it's feasible to have ...

Transferring information between components using TypeScript and ReactJS via API calls

I am currently in the process of learning TS and I'm attempting to develop an application that retrieves data from an API, displays the results, and opens a modal with additional details when an item is clicked. However, I am facing an issue where my ...

JQuery loader & amazing animations

I have implemented the wow.js plugin along with a jQuery preload tutorial from here. Although the preloader works fine, I am facing an issue where the animation by wow.js starts before all the elements on the page are preloaded. I am looking to modify my ...

Getting a class to display its array properties using cout

I am completely new to C++ (I typically work in Python). After doing some research, I discovered how to print an array from this source. Additionally, I learned from here how to have a class object output to cout with one of its properties. Lastly, I foun ...

Contrast between v-for arrangements

Would anyone be able to clarify the distinction between these two v-for structures? <li v-for="item in items" :key="item"> </li> and <li v-for="(item, i) in items" :key="i"> </li> ...

Tips for returning an element to its starting position following animation

Hey there, I’m fairly new to the world of HTML and CSS. Recently, I was working on creating a YouTube clone website and I’ve run into an issue with the navigation. On the official YouTube website, when you click on the hamburger menu icon, the naviga ...

What causes the interference of one Import statement with another?

In the JavaScript file I'm working with, I have added two import statements at the beginning: import { FbxLoader } from "./ThreeJs/examples/jsm/loaders/FBXLoader.js"; import * as Three from "./ThreeJs/src/Three.js"; However, when ...

What steps should I take to incorporate Bootstrap's JavaScript into Vue (Gridsome)?

Check out my website: The site is built with Gridsome, a static site generator for Vue. If you navigate to the mobile version and try to open the Bootstrap Hamburger menu, it doesn't work as expected. I've followed the instructions in Gridsome ...

What's the best way to detect the onclose (onbeforeunload) event of a child window in a Vue.js application?

I'm facing an issue while working with Vue.js. I have been trying to create a function that opens a new window in Chrome and captures the onclose or onbeforeunload event of that window from the same Vue component where it was opened. Here is how I tri ...

The issue of React UseEffect not functioning properly in conjunction with firepad and firebase has been identified

When attempting to utilize the username fetched from Firebase to create a user in the FirepadUserList, the code resembles the following: import { useRef, useEffect, useState } from 'react'; import 'codemirror/lib/codemirror.css' impo ...

Leveraging Arrays with AJAX Promises

I am currently working on making multiple AJAX calls using promises. I want to combine the two responses, analyze them collectively, and then generate a final response. Here is my current approach: var responseData = []; for (var i=0; i<letsSayTwo; i++ ...

What is the proper way for AJAX to function in WordPress when there is no output function available?

I am looking to incorporate AJAX functionality into my WordPress site to make a call to a third-party API. The goal is to update the state of some checkboxes based on the response received. While I have experience with AJAX, my previous implementations in ...

Having difficulty retrieving an item from a knockout observable array

When fetching data from a web API and pushing it into an observable array, I wanted to make the items in the array observable as well. Unfortunately, I found that I couldn't access the object if I made it observable. function UpdateViewModel() { ...

What is the best way to eliminate all spaces in the Zod application?

After reading the Zod documentation, I found that trim only removes whitespace characters at the beginning and end. However, I am in need of a solution to remove all whitespace characters entirely. Here is an excerpt from my current setup (irrelevant code ...

Three.js - implementing a billboard effect that preserves orientation through camera pans

My situation involves a plane geometry that always faces the camera using the following line of code in the update loop: plane.lookAt(camera.position); While I am utilizing OrbitControls to manipulate the camera, the plane successfully maintains its orie ...

Is there a way to dynamically pass values to a form in React?

Learning React on my own has been challenging, especially when trying to accomplish what I thought would be a simple task. To put it briefly, I have a menu with several items. I aim to select a menu item and have a form open next to it. The form shoul ...

What is the process for eliminating multiple occurrences in a vector by using the "unique" function?

I need help with removing duplicates from a vector using the "unique" function. I am new to using iterators and it does not seem to be working correctly. Can someone please advise me on what I'm doing wrong? Thank you in advance! Edit: I tried sort ...