Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > Visual C++
Visual C++ Questions specific to Microsoft's Visual C++. For questions not specific to this Microsoft version, use the C++ Programming forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual C++ section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old January 27th, 2005, 05:04 AM
Registered User
Join Date: Jan 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default MessageBox change visibility of global variables??

I am writing ActiveX Control.
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;
//MessageBox("some text")
switch (d)
case 0;
        do first .....................
case 1;
        do second .................

here is b() function code:
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.

Similar Threads
Thread Thread Starter Forum Replies Last Post
MessageBox Font change vgsgowrisankar C# 2005 5 April 8th, 2008 04:10 AM
change MessageBox angelboy C# 2005 0 January 17th, 2007 02:58 PM
Global Variables in C# su C# 2 December 11th, 2006 06:18 PM
Global variables zarol Beginning PHP 3 May 10th, 2005 06:17 AM
Global variables ps124 ASP.NET 1.0 and 1.1 Basics 6 April 6th, 2004 02:48 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.