vincas
01-27-2005, 03:10 AM
Hi,
I am writing ActiveX Control in C++ 6.
I am newbie to C++, and I work like with VB.
But specific problem allow to create ActiveX Control only with C++.
This ActiveX Control is for IE 6, using MFC, connect to IHTMLDocument2 Interface and do HTML parsing .
What I do:
In IE6 is loading html document (x.htm), from JavaScript j1() function with looping is calling ActiveX Control (a() function) read value from global variable (int d) (or read from file) and do ather actions, then call to load next html document (y.htm) and from him JavaScript j2() function is calling same ActiveX Control but another function (b() function) do some calculations and change value of same global variable (int d1) (or write to same file)and return control to first html document j1() function for next looping........I do some specific actions , that can't to do with DHTML.
I do tracking of program with messagebox (for JavaScript alert(), for C++ AfxMessageBox() or MessageBox()) and can monitor my values of variables.
All is working, I think I finish to implement my idea to program, but there is one big bug.
This program is windowless and for user MessageBox is not needed.
I simple disable with comment // my MessageBox() code lines
and what you think --------> my program STOP WORKING!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Ok program is working but it begin do bad calculations (logical error)
Problem is NEXT:
I write above that a() function has global variable (int d=0), then function b() change this variable to (d=1).
Function a() not see this change (d=0) and my program do logical errors.
here is a() function code:
extern int d;
d=0;
a()
{
//MessageBox("some text")
switch (d)
case 0;
do first .....................
break;
case 1;
do second .................
break;
}
here is b() function code:
b()
{
..............
d=1
...............
}
How you see first time a() read predefined global variable d=0 ,then b() change to d=1, but a() think d=0
and switch statement do bad results.
When I remove comenting characters // for MessageBox().... ALL WORKING PERFECT!!!!
a() function now see that d=1
What you think ? Strange behavior!
Help Me
I need remove this messageboxes for users.
I understood that this variable is like hidden, but not understand how messagebox change his behavior, and what to do how repair this bug?
It is like messagebox got focus to function, or maybe there are many processes , threads, or maybe this is MFC bug.
Program is complex, I send parameters from JavaScript to C++ and I don't know how to track my variables in another way.
What I need to do ?
Maybe write my own Messagebox function(DialogBox) that show only 0.00001ms and users can't see this one and my program work OK.
I am writing ActiveX Control in C++ 6.
I am newbie to C++, and I work like with VB.
But specific problem allow to create ActiveX Control only with C++.
This ActiveX Control is for IE 6, using MFC, connect to IHTMLDocument2 Interface and do HTML parsing .
What I do:
In IE6 is loading html document (x.htm), from JavaScript j1() function with looping is calling ActiveX Control (a() function) read value from global variable (int d) (or read from file) and do ather actions, then call to load next html document (y.htm) and from him JavaScript j2() function is calling same ActiveX Control but another function (b() function) do some calculations and change value of same global variable (int d1) (or write to same file)and return control to first html document j1() function for next looping........I do some specific actions , that can't to do with DHTML.
I do tracking of program with messagebox (for JavaScript alert(), for C++ AfxMessageBox() or MessageBox()) and can monitor my values of variables.
All is working, I think I finish to implement my idea to program, but there is one big bug.
This program is windowless and for user MessageBox is not needed.
I simple disable with comment // my MessageBox() code lines
and what you think --------> my program STOP WORKING!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Ok program is working but it begin do bad calculations (logical error)
Problem is NEXT:
I write above that a() function has global variable (int d=0), then function b() change this variable to (d=1).
Function a() not see this change (d=0) and my program do logical errors.
here is a() function code:
extern int d;
d=0;
a()
{
//MessageBox("some text")
switch (d)
case 0;
do first .....................
break;
case 1;
do second .................
break;
}
here is b() function code:
b()
{
..............
d=1
...............
}
How you see first time a() read predefined global variable d=0 ,then b() change to d=1, but a() think d=0
and switch statement do bad results.
When I remove comenting characters // for MessageBox().... ALL WORKING PERFECT!!!!
a() function now see that d=1
What you think ? Strange behavior!
Help Me
I need remove this messageboxes for users.
I understood that this variable is like hidden, but not understand how messagebox change his behavior, and what to do how repair this bug?
It is like messagebox got focus to function, or maybe there are many processes , threads, or maybe this is MFC bug.
Program is complex, I send parameters from JavaScript to C++ and I don't know how to track my variables in another way.
What I need to do ?
Maybe write my own Messagebox function(DialogBox) that show only 0.00001ms and users can't see this one and my program work OK.