|
use:
GetWindow(..) with child and nex params.
IsWindowVisible(...)
and
EnableWindow(...)
|
|
|
|
|
Thank you for your reply.
I tried it, but somehow I cannot loop through the elements (GetWindow never returns NULL with the GW_HWNDNEXT parameter).
I however managed to get it right by using the EnumChildWindows function.
|
|
|
|
|
I'm baffled. I know where the problem line is. I just don't understand the problem except to add that it likely relates to either pointer or reference or both. Hopefully, all code needed is included. Thanks in advance. Sorry for the code dump, but I think it may all be needed....(since I don't really know what the problem is....
Unhandled exception at 0x5dd97b3f (msvcp90d.dll) in Parser6.exe: 0xC0000005: Access violation writing location 0xcdcdcdcd.
FROM OUTPUT...
First-chance exception at 0x5dd97b3f (msvcp90d.dll) in Parser6.exe: 0xC0000005: Access violation writing location 0xcdcdcdcd.
Unhandled exception at 0x5dd97b3f (msvcp90d.dll) in Parser6.exe: 0xC0000005: Access violation writing location 0xcdcdcdcd.
Here is the line from some internal file that is getting pointed at by the compiler. FileName = xutility. Bad line is labeled.
inline void __CLR_OR_THIS_CALL _Container_base_secure::_Orphan_all() const
{
_Lockit _Lock(_LOCK_DEBUG);
if (_Myfirstiter != _IGNORE_MYITERLIST)
{
for (_Iterator_base **_Pnext = (_Iterator_base **)&_Myfirstiter;
*_Pnext != 0; *_Pnext = (*_Pnext)->_Mynextiter)
BAD LINE HERE --> (*_Pnext)->_Mycont = 0;
*(_Iterator_base **)&_Myfirstiter = 0;
}
}
Here is the Collector constructor with the problem code labeled near the end.
Note that the constructor is taking in a reference. This may be related to error.
#include "Collector.h"
#include "Token_stream.h"
#include "Multiplier.h"
#include <vector>
#include <iostream>
using namespace std;
Collector::Collector(Multiplier& myMultiBox, int MaxSNM): myMultiplier(myMultiBox)
{
cin.clear();
cin.ignore(1000, '\n');
BaseIP = GetOctets2( MaxSNM);
NetworkBits = ConvertToNetworkBits( BaseIP);
vector<SimpleBox*> Boxes;
vector<int> test(31,9);
for (int i = 0; i < (myMultiplier.GetTheBoxSet()).size(); i++)
{
Boxes = (myMultiplier.GetABoxMaker(i))->GetMyBoxes();
for (int z = 0; z < Boxes.size(); z++)
{
THIS DOESN'T WORK-> Boxes[z]->SetMyNetworkBits(test);
THIS DOESN'T WORK-> Boxes[z]->SetMyBaseIP(BaseIP);
THIS WILL RUN ALONE-> Boxes[z]->PRINT_NETWORK();
}
}
}
Here is main
#include "AllHeaders.h"
using namespace std;
int main()
try{
StartMeUp KickStart;
Multiplier MultiBox(KickStart.GetMyHosts());
BoxMaker* temp = MultiBox.GetABoxMaker(0);
BoxMaker* temp1 = MultiBox.GetABoxMaker(1);
BoxMaker* temp2 = MultiBox.GetABoxMaker(2);
BoxMaker* temp3 = MultiBox.GetABoxMaker(3);
PureStack FirstT(temp );
StackSmallHigh SecondT(temp1);
PureReserve ThirdT(temp2);
ReserveSmall FourthT(temp3);
cout << endl;
int MaxSNM = temp->GetMyVLSM();
Collector TheCollector(MultiBox, MaxSNM);
system("PAUSE");
return 0;
}
catch (exception& e)
{
cerr << e.what() << endl;
keep_window_open ("~1");
return 1;
}
catch (...)
{
cerr << "exception \n";
keep_window_open ("~2");
return 2;
}
all headers:
#include <iostream>
#include <vector>
#include "StartMeUp.h"
#include "Multiplier.h"
#include "Stroustrup.h"
#include "MakeSmall.h"
#include "BoxMaker.h"
#include "PureStack.h"
#include "StackSmallHigh.h"
#include "PureReserve.h"
#include "ReserveSmall.h"
#include "Collector.h"
Here are the .h files
Collector
#ifndef Collector_h
#define Collector_h
#include "Multiplier.h"
#include "Token_stream.h"
#include <vector>
using std::vector;
class Collector
{
public:
Collector(Multiplier&, int );
int GetMyBaseIP();
vector<int> GetMyNetworkBits() ;
private:
int MaximumMask;
vector<Token> BaseIP;
vector<int> NetworkBits;
vector<Token> GetNumber(bool, vector<Token>, int, char SNM = '*', int MaxSNM = 30);
vector<Token> GetNumberAndDot(bool broken, vector<Token> Octets, int limit);
vector<Token> GetOctets2( int );
vector<int> ConvertToNetworkBits(vector<Token>);
Multiplier myMultiplier;
};
#endif
Multiplier
#ifndef Multiplier_h
#define Multiplier_h
#include "Token_stream.h"
#include "BoxMaker.h"
#include <vector>
using std::vector;
class Multiplier
{
public:
Multiplier(vector<Token> hosts_in);
vector<BoxMaker*> GetTheBoxSet();
BoxMaker* GetABoxMaker(int i);
int GetMyVLSM( int BM);
private:
vector<Token> hosts;
vector<BoxMaker*> BoxSet;
};
#endif
SimpleBox
#ifndef SimpleBox_h
#define SimpleBox_h
#include "Token_stream.h"
#include <vector>
using std::vector;
class SimpleBox
{
public:
SimpleBox (vector<Token> hosts);
void ResetStatics();
void SetMyNetworkBits(vector<int>);
void SetMyBaseIP(vector<Token> );
void SetNetwork(int network );
void SetVLSM(int SNM);
void PrintBoxValue();
void SetMyHostsTest();
int GetMyBlockSize();
int GetMyNetwork();
int GetMyVLSM();
void PRINT_NETWORK();
private:
vector<Token> myHostsVector;
vector<int> myHostBits;
int myBlockSize;
int myHosts;
int myNetwork;
int myHostElement;
int myVLSM;
void FigureBlockSize();
int myBroadCast;
vector<int> myNetworkBits;
vector<Token> BaseIP;
int MaxSNM;
static int s_network;
static int s_globalcounter;
};
#endif
BoxMaker
#ifndef BoxMaker_h
#define BoxMaker_h
#include "SimpleBox.h"
#include "Token_stream.h"
#include <vector>
class BoxMaker
{
public:
BoxMaker (vector<Token> Hosts_in, int i);
void PRINT_TEST();
vector<SimpleBox*> GetMyBoxes();
void SetMyNetwork(int network, int number );
void SetMyVLSM(int network, int VLSM);
int GetMyVLSM();
private:
vector<Token> theHosts;
vector<SimpleBox*> myBoxes;
};
#endif
SetmyNetworkBits
#include "SimpleBox.h"
#include <vector>
void SimpleBox::SetMyNetworkBits (vector<int> theNetworkBits)
{
myNetworkBits = theNetworkBits;
}
SetmyBaseIP
#include "SimpleBox.h"
#include <vector>
void SimpleBox::SetMyBaseIP (vector<Token> theBaseIP)
{
BaseIP = theBaseIP;
}
|
|
|
|
|
When the crash occurs, take a look at the call stack to see where is the line in error in your code. This will already give you some clues. If you are still stuck, tell us where the code occurs exactly in your code.
|
|
|
|
|
Thanks for taking a look at my post. Sadly, (oddly) I get up this morning and my code runs without the error. This is unexplainable as I am quite sure it was not working last night. the only thing that could have changes was the inputs I dumped in when I was testing it....but the given inputs should not be relevant anyways. Anyway, this is disappointing because now i have not learned what was causing the error and so next time I will be equally lost. That being said, this is all too good to be true in a sense and I am confident it will blow up again. Thanks again for the look. I am sure I will be back on this forum soon enough.
mw
|
|
|
|
|
Hello
I am working on Visual Studio 2003 with WIN32 API's.
I want to use a Non-Win API inside my project. It's not a complex API and i already have the libraries linked into my project.
Below is the description of the API,
-------------------------------------------------------------------------
Function:
Void GetImageVersion(TCHAR *imageVersion, DWORD *size);
Parameters:
imageVersion -
[out] Pointer to an array in which the image version string is returned.
size -
[in/out] Pointer to a variable that specifies the size, in TCHAR, of the array pointed to by the BIOSVersion parameter. If BIOSVersion is given as NULL, when the function returns, the variable will contain the array size required for the BIOS version.
Remarks:
Call the function twice, first by giving imageVersion as NULL to get the array size required for the string. Then allocate a TCHAR array with the size required and give the array with its size as parameters to get the image version.
-------------------------------------------------------------------------
I am having little bit difficulty in understanding the implementation of this function. Especially with declaring a TCHAR and then calling this function twice, as described in "remarks" section.
Can anyone write a sample peiece of code and explain how to use this API function?
Thanks in advance.
|
|
|
|
|
Since you don't know in advance the length of string required for storing the image version, the API requires you to first determine the length using:
DWORD length;
GetImageVersion(NULL, &length);
Then you can allocate the buffer required for storing the image version,
TCHAR* imageVersion = new TCHAR[length];
GetImageVersion(imageVersion, &length);
-Saurabh
|
|
|
|
|
|
You are welcome.
-Saurabh
|
|
|
|
|
I tried out this code. The problem is that for example I input "Book" to the file so it displays 4characters of the ASCII '1'.
If I enter a three letter word it displays that character three times?
Here is the code.
#include<stdio.h>
#include<conio.h>
#include<windows.h>
char d;
main()
{
{
FILE *ft;
ft=fopen("test.txt","w");
char ch;
while(ch=getche())
{
if (ch=='\r')
break;
putc(ch,ft);}
fclose(ft);
}
system("cls");
printf("Read?");
d=getch();
system("cls");
if(d=='y')
goto read;
read:{
FILE *fp;
fp=fopen("test.txt","r+");
char chr;
while(chr=fgetc(fp)!=EOF)
printf("%d",chr);
fclose(fp);
}
}
|
|
|
|
|
Razanust wrote: char d;
Why make this global?
Razanust wrote: main()
{
{
Why the extra open/close braces?
Razanust wrote: char ch;
while(ch=getche())
Do you know that getche() returns an int ?
Razanust wrote: if(d=='y')
goto read;
read:{
And if d is not equal to 'y' , control still goes to the read label.
Razanust wrote: fp=fopen("test.txt","r+");
No need to open the file for writing.
Razanust wrote: while(chr=fgetc(fp)!=EOF)
While it's syntactically correct, you are missing an important pair of parenthesis.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
beside html file, what other files IE can display if without extra software (not inclued in default windows installation) support?
for example, IE can display php file, but it needs php software supports.
|
|
|
|
|
hta, xml, ico, png(kinda), gif, jpg, svg, txt(based files), vrml (i forget)
And many others I don't recall this minute.
|
|
|
|
|
What do you mean it can display php file? PHP files are text files and IE can dispaly *any* text file.
-Saurabh
|
|
|
|
|
PHP, like ASP and JS, usually runs on a web server. It takes special files/filters to translate the script to HTML to send back to the client's browser. In essence, IE is not displaying PHP files.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Yes I know that and that is why I asked OP what he means by IE can display PHP files.
-Saurabh
|
|
|
|
|
I remember someone said "do not ask why when people ask for why".
Now I tell you why, when I upload html to UNIX server, file size of html file is changed, so I want to use a similar html file, whose size will not be changed in upload/download process.
Is it interested for you?
Do you have more why to ask?
.
|
|
|
|
|
You didnt answered my question. My question was what do you mean by IE can display PHP files. Check again its not why but what. Because PHP is just a text file and IE can display any text file.
What file formats are supported in IE has nothing to do with change in file during upload and download. If file size if changing during upload and download then it is most likely because you are sending files in ASCII mode. You need to use binary mode for data transfer. Just like I said in other thread.
-Saurabh
|
|
|
|
|
This post is C++ related .
I am trying auto-update software, it is a harder job than C++ itself.
One info I used for detecting file changes is file-size.
Unfortunately, when I upload/download files between Windows and UNIX, file size has been changed by ftp tool (FileZilla) or flatforms - not sure who did it.
So far, file-size-changes only happened on html files, file-size-differences may be up to 2 bytes.
I am wondering why file-size has been changed? if - only if - the file is an exe, it may not work again after upload/download.
Can you explain why?
Thanks
|
|
|
|
|
includeh10 wrote: So far, file-size-changes only happened on html files, file-size-differences may be up to 2 bytes.
Have you used a file-comparer tool to see what those differences are?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
both ftp tool and windows file-manager show the difference.
|
|
|
|
|
When exchanging files between Windows & Linux , for instance, FTP should be in binary mode, since in text mode, newlines are translated according to the platform.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi CPallini,
I redo the test, you are correct, the more \r\n the file has, the more size is reduced.
I did the test by a txt file, if I change file extension of the txt file to any others, i.e. kbc, file-size is not changed.
wonderful.
|
|
|
|
|
You should not rely on file extension. Instead use binary mode to transfer files.
-Saurabh
|
|
|
|
|
Needed that Visual studio pause the application and tells me a message when an infinite number or a NAN is generated so I can debug and remove the causes.
Any flag available on the solution's properties?
Thanks
Russell
|
|
|
|