Visual C++ :: Message Processing With JavaScript Or JQuery?
Jul 23, 2014Is there a way I can do message processing between a Win32 application and Javascript using some Windows CallBack function or using Send or Post message?
View 6 RepliesIs there a way I can do message processing between a Win32 application and Javascript using some Windows CallBack function or using Send or Post message?
View 6 RepliesI am writing an MFC app in Visual Studio 2012 that will open a JPG file as binary and read all the contents to a CString.
I am able to read it to a std::Vector, but that doesn't work much as i need to pass all the binary content as a MFC CString to another function.
More Update:
Let me explain the problem a little more deeper.
I am trying to call a JavaScript (JS) function in a HTML page and then want to pass the binary date. The C++ function that calls the JS is given below.
bool CallJavaScript(const CString strFunc,CComVariant* pVarResult);
The 1st argument is the JS Function Name and 2nd is the one to pass the Binary Data. 1st argument works fine as i am able to call the JS fucntion called "LoadImage" without any problem. Problem is with 2nd argument that's supposed to take the Binary data of the JPG file.
If i try to pass a std::Vector or std::string then it will give me an error.
But it's happy if i pass CString. But then with CString there's a problem with NULL characters.
Actually my plan is to pass the binary of a JPG to a JS function and let it display the JPG in the HTML page.
Can i typecast a Vector or std::string to a CComVariant*?
The error ive been getting with this code is after i go to the check out option, enter the data then click (ctrl + z). Then program glitches back and forth from the menu to the check out option continuously and im not entirely sure why.
Heres my code:
Code:
#include <iostream>
#include <windows.h>
#include <iomanip>
#include <fstream>
using namespace std;
void checkOut(){
cout << setw(10) << "Ministry of Health Hospital System
[code]....
In my project I'm using PVOID pointer to store real time data. After getting this data I will convert the data into byte array, like below
Code:
byte *bPoint = NULL;
PVOID pvData;
byte TempArr[1024];
bPoint = (byte*) pvData;
for(int i=0;i<1024;i++)
TempArr[i] = (byte) (*bPoint + i);
Processing time for the above code takes 9500 to 9900 microseconds (Used QueryPerformanceCounter).
Code:
TempArr[0] = ((BYTE*) pvData) [0];
This code takes 1100 to 1200 microseconds. My doubt is, The processing time of PVOID data into byte array conversion takes time like above? Or any other easy way(PVOID data into byte array conversion) to reduce the processing time?
I am trying to figure out how can I get my SQlite database made in C language to Javascript? I know this is possible but do not know where to start?
View 5 Replies View RelatedI have a simple dialog based app that performs some time consuming file manipulations. The activating method contains the customary
Code:
CWaitCursor wait;
The hour glass initially appears, than after a few seconds, the dialog title bar indicates 'not responding'.
This is misleading to users as it suggests the application has ceased to function when, in fact, it's working just fine. I would like very much to eliminate this 'not responding' message but havn't a clue how to do it. Have any of you dealt with this problem, if so, how?
The problem is that the data table doesn't show at all. Here is the code:
<%@ Page Title="" Language="C#" MasterPageFile="~/LB/MasterPage.master" AutoEventWireup="true" CodeFile="InsertedInfo.aspx.cs" Inherits="LB_InsertedInfo" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
[Code]....
Is it possible to edit the message map at startup instead of just having it set at compile time?
I'm reading some values from an XML file at startup. The menu options will be determined from what I find in there. But I need to assign those menu options to the message map.
is it possible to take integer or char data type on message box to V C++?
View 2 Replies View RelatedYou place a breakpoint at one of locations within the message loop. But I want the breakpoint to trigger when I click on the application window, for example. But I can't, it went so fast so long as I switch from VS to the application program, the breakpoint is hitted again, then the application is frozen again. I don't know how to setup a conditional breakpoint.
View 3 Replies View RelatedI'm looking for a resource (possibly CPP) for which I could do the following on a windows and linux machine:
1) type a string message into a GUI control (or some other input that can be accessed by the resource).
2) run a resource script that puts the message through a hash function (or a custom hash function) and outputs the hash string.
3) have a reverse function available in order to decrypt the message in an input fashion just like step #1.
what open-source resource might be the best for this? Right now I am imagining typing a message into a text file, saving the file to a hard drive location, running a script on it replacing the old file with a new file that just has a hash string in it, then using that hash string for the encoded message.
I'm currently making a math program in c++ windows form application. I'm trying to make it so where the user presses the number button I such as 1 button to display a 1 in my textbox.
Code:
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
}
Is there a way an ASPX page can send a notification message to my IE Plugin which is developed in VC++?
View 3 Replies View RelatedI want to send messege to click select check box. I can click button but I don't know how to select check box with VC.
View 2 Replies View RelatedI have a problem in a c++ project. I have created a .dll file and hooked to an .exe
I want this .dll to make a ping or to send a message like hello somewhere, and IF ping or message doesn't receive an answer that's means the user has suspended-terminated this dll from the exe then the exe will close. How can i do that?
I have a DLL developed using pure VC++ (all unmanaged code that doesn't use .NET framework). This DLL will be deployed in different client PCs within a network and will act like an agent.
Now I have establish a communication between this DLL and a WCF web service, that will be deployed in a server PC. The Service will first get a list of PCs either name or IP Address within a network using LDAP (Active Directory) and once, we get the PCs, I have to establish a communication between the web service and the agents that reside in these client PCs,
How can I accomplish this?
I'm trying to write a program that passes Windows messages back and forth from another program that controls a laboratory instrument. I was able to write a program that successfully passes instructions, as evidenced by the instrument doing what I tell it. However, I am having trouble getting a return status from the instrument. The manual instructs the following:
// demo code, etc.
// send message to the instrument operating software here...
SendMessage(hwnd, WM_COPYDATA, tag, (LPARAM) &cd)
Either a completion message or return data is returned. Remote commands ReturnStatus, ReturnTiming, and ReturnData return data. In either case, data is received through an asynchronous windows message inside Win32 COPYDATASTRUCT type data packet.For example, a typical OnCopyData window callback is shown below, where the string data retrieved is finally stored into a Microsoft CString object. Note the use of variable replyTag, discussed above, which is used to isolate the correct windows message returned.
BOOL CUserDlg::OnCopyData(CWnd* pWnd, COPYDATASTRUCT* cd) {
….
if (cd->dwData == replyTag) {
/* String pointing to status */
CString retStatus = (char*) cd->lpData;
}
….
}
I can't tell if my problem is in generating the replyTag, getting the HWND to my own console window, or the actual receiving part of the code.
When setting the replyTag, the manual instructs: UINT replyTag = RegisterWindowMessage(“SOFTMaxProReplyMsg”);. However, I have to put an "L" in front of the string or I get a data type error (can't convert const char* to LPCWSTR).
When setting a HWND for myself, the manual instructs: HWND MyWnd = GetSafeHwnd().
That produces an error because GetSafeHwnd is a function of the Cwnd class, and I don't have a Cwnd. I have replaced it with HWND MyWnd = GetConsoleWindow();
When listening for the reply message, the manual instructs what I quoted above. However, I again don't have a Cwnd. I therefore simply used
if (cd.dwData == replyTag) {
CString retStatus = (char*) cd.lpData;
}
The above if statement always evaluates false, and the cd.lpdata contains the message that I had sent out instead of a reply message. How to get a reply using my console application. Here is the full code of my function:
Code:
#include "stdafx.h"
#include<iostream>
#include<vector>
#include<string>
#include<afxwin.h>
using namespace std;
void SendCommand(string command) {
// Get tags to identify the receiving and sending messages
[code]....
I have a crash on a application the customer machine i couldn't reproduce it yet on my machine... all i have is the error message
The Instruction 0x0070478b referencing to the memory 0x00000000 could not be written.
And that's all i have how do i track that instruction on my program from that address? is it possible?
I've created a new dialog in my MFC dialog based application. the new dialog contains 5 control buttons. The following happens and I don't understand why?
1. click on buttonX. (result ok, OnBnClicked message is sent)
2. click on on any place of the application, but not on the dialog.(removing focus from dialog)
3. click again on buttonX (FAILED, OnBnClicked message is NOT sent). but if instead I click on any other button in the dialog (result ok, OnBnClicked message is sent).
And when I do:
1. ...
2. ...
3. click on the dialog area just to set focus on the dialog again
4. click again on buttonX. (result ok, OnBnClicked message is sent)
**I need to do step 3 only if I want to click again on the buttonX! why?? I think it related to SetFocus() but I m not sure how.
I've tried different style like, tool windows, overlapped, popup. it happens in all the cases.
Code:
class CToolsDlg : public CBDialog {
DECLARE_DYNAMIC(CToolsDlg)
public:
CToolsDlg(CWnd* pParent = NULL); // standard constructor
virtual ~CToolsDlg();
CToolTipCtrl m_ToolsTips;
[Code] .....
I have finally got around to developing C++ & MFC using Visual Studio 2012, to build a full GUI Windows application (not sure if I have made the right choice). Though admittedly in two months time I do have a dialog window at my beck and call.
Now I have discovered a flaw (suspect) partially caused by the design of this program not all following the same principles, nor written by the same people and long predates me. Let describe the situation.
I have a dialog I have created as a class which has a combo box. The list of items are populate during the OnInitDialog() function just fine, except if the file where the detail is not yet read from that combo box would not have any items other than the default. This is to be expected in the use of the program, so fine.
However, if the dialog (modeless) was already open and active, when the user went up to and selected the menu command (main window) to read that file that CPtrList data structure that held that data would not populate that Combo box on my dialog.
So what I would like when I am done reading the files contents is to detect if my dialog is opened and if so send it a message to Activate (force a call to OnActivate()). I have gone to the event list for the dialog and exposed this event handler from the resource editor just fine.
I see the syntax of OnActivate() is
void MyClass::OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimalized);
So nState is an Unsigned Int of the current state of the thread/window (not sure)?
CWnd* pWndOther is the CWnd of my other Window that wants my dialog to activate I think which is the main application since it was on the a menu that this function was called to read the file.
bMinimalized is whether my dialog is mimalized(?)
Is it possible to display a message at the bottom of a dialog box shown in the attachment? If so, how?
View 5 Replies View RelatedI am writing a program to auto login in a web site. Before making next attempt I have to wait for some time like some 10 seconds(it is configurable). But during waiting UI should not freeze. I wrote code something like this. Here event m_hEvent[1]) will be set by another thread after 10 seconds.The problem is UI still freezes some times!
while(1)
{
//m_hEvent[1] will be set by another thread after 10 seconds
dwRet = MsgWaitForMultipleObjects(1, &m_hEvent[1], FALSE, dwMilliseconds, QS_ALLINPUT);
ResetEvent(m_hEvent[1]);
[Code] ....
I need to set a timer but still have the program processing info. I have looked into using sleep but when using this all processing stops to my knowledge. I tried to use the settimer method but was having some issues since I am not using a dialog based interface.
View 1 Replies View Related[URL] ....
typedef double (*Matrix)[imax][jmax];
Matrix xboundary(){
Matrix xx;
double x[imax][jmax];
int i;
[Code] .....
All I want to do is be able to Return "x" in some way.
I've been coding for about 10 years now and it just got to my mind that I would like to learn about how I can create speech recognition software. I am mostly interested in doing this from ground 0 not because there are no other libs I can use, but it's more of an interest to me.
grasp this new and magnificent feature that's becoming more and more used nowadays.
My preference would be coding in C++ (more because of OOP that's why not C) and I don't really like Java.
I know what I'm getting involved in but I am thrilled and willing to go all the way to achieve my goal.
I have a problem with calculating the CPUtime. I am using CPLEX to solve linear programming with 3 diferent algorithms.
1-primal Simplex
2-Dual Simplex
3-Barrier Method.
When I am trying to use Barrier method, my clock does not give me a right processing time. I don't have any problem with the other two methods. The value I am getting from ticks2 is 0 when I am using Barrier solver unlike the two other methods that I am getting some small values (ticks1 is fine). Using time_t ticks1 , ticks2 and time(&ticks1) and finally difftime(ticks1,ticks2) also gives me an integer number which is not precise enough. I need a way to compute cputime with accuracy of at least 2 decimals.
clock_t ticks1,ticks2;
double solvingtime
if (solver.primopt==1){
ticks1=clock();
status=CPXprimopt(myEnv, myLP);
ticks2=clock();
[code]....