|
hello friends
plz help me by sending a source code of packet sniffer using console programming in vc++, or using c++. or some help regarding sniffer.
thanx
bye
|
|
|
|
|
|
Hi everybody. I'm having a problem with a method for a bank account program. There aren't any sytax problems, it just doesn't do what I think it should do. It's part of the creation of an account and needs to check if the account number has already been assigned to another account. Unfortunatly, it doesn't seem to be checking it.
getAccountCount() returns the number of created accounts.
bool account::setAccountNumber(unsigned int inputNumber) {
for (int x = 0; x < getAccountCount(); x++) {
if (assignedAccountNumbers[x] == inputNumber) {
cout << "\t*Account " << inputNumber << " already exists!*" << endl;
return false;
}
}
this->accountNumber = inputNumber;
assignedAccountNumbers[x++] = inputNumber;
return true;
}
If anybody sees my problem, a little help would be great. Thanks in advance.
|
|
|
|
|
Just to illustrate the problem, here's the output of my program, thus far.
(note: setAccountBalance() hasn't been implimented yet. )
Create an account:
What name? <code>Smith, John</code>
What account number? <code>123</code>
What starting amount? <code>$5.00</code>
Bank account 123 was created.
Create an account:
What name? <code>Doe, John</code>
What account number? <code>123</code>
What starting amount? <code>$100.00</code>
Bank account 123 was created.
Create an account:
What name? <code>This, Sucks</code>
What account number? <code>123</code>
What starting amount? <code>$1.00</code>
Bank account 123 was created.
Listing accounts...
0: Name: Smith, John
Account Number: 123
Account Balance: $0.0
1: Name: Doe, John
Account Number: 123
Account Balance: $0.0
2: Name: This, Sucks
Account Number: 123
Account Balance: $0.0
Press any key to continue
Thanks!
|
|
|
|
|
Anonymous wrote:
assignedAccountNumbers[x]
Are you sure this array is correctly holding all the assigned account number?
Could you show me your code snippet here but beware if it more than one page code better option would be to send it by Email to me.
[Vote One Here, Complete my Survey....]
Alok Gupta visit me at http://www.thisisalok.tk
"I Think Believe this Will Help"
|
|
|
|
|
Is the value that getAccountCount() returns getting incremented correctly? I would be inclined to add a few more "debug" statements. For starters:
cout << "Count = " << getAccountCount() << endl;
for (int x = 0; x < getAccountCount(); x++)
{
cout << "Comparing " << assignedAccountNumbers[x] << " to " << inputNumber << endl;
if (assignedAccountNumbers[x] == inputNumber)
...
}
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I have the handle of a bitmap picture. How can I acess its pixels?
Any help would be appreciated.
Awasthy
Any work worth doing is worth doing well.
|
|
|
|
|
|
I'm trying to (programatically) bring a dialog window to the top of the Z-order (not "always on top", just to the top of the Z-order). Unfortunately, no combination of any of the following appears seems to work.
SetWindowPos (&CWnd::wndTop, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
BringWindowToTop();
SetForegroundWindow();
SetActiveWindow();
SetFocus();
I even tried posting a WM_NCLBUTTONDOWN , but that didn't work. A nudge in the right direction would be appreciated!
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Since I keep track of the user's "always on top" preference, I decided to simply make the window topmost by doing SetWindowPos (&CWnd::wndTopMost, ...); when I wanted to bring it to the top and lower it's Z-order (if necessary) by calling SetWindowPos (&CWnd::wndBottom, ...); .
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Beginning with 98 and 2K, there are restrictions on when an app can change the foreground window. The restrictions are spelled out in the docs for SetForegroundWindow() .
--Mike--
LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ
Strange things are afoot at the U+004B U+20DD
|
|
|
|
|
Actually, the Z-order repositioning is done (in a timer tick) by the dialog itself, so these restrictions don't apply, but they're good to know anyway. Thanks!
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
In 3ds max,I want to export XFile.
Which plug-in are better used?
I use 3ds max5's XSkinExp.dle.
The Coordinate of XSkinExp.dle is Left-Hand,But 3ds max is Right-Hand.
So.. the coordinate of picture is error.
|
|
|
|
|
Where can I download the XSkinExp Project Support 3ds max7?
Could you tell me in which web address and which version of DX update or Extra?
I Find this project for a long time.
|
|
|
|
|
Where can I download the XSkinExp Project Support 3ds max7?
Could you tell me in which web address and which version of DX update or Extra?
I Find this project for a long time.
|
|
|
|
|
Hi, I have some questions about inheritance.
For instance, I have a class A and it has
one public method metPubA,
one protected method metProA,
one private method metPriA,
one private int variable intPriA,
one protected int variable intProA,
one public int variable intPubA.
I have derived a class B from A with public kind.
In class B which methods and variables of A will be copied and can be usable?
Is that possible to change the inside of intPriA from B without a public or protected method in class A that changes inside of intPriA?
Lastly, if I create another derived class C from class B with public kind. The intPriA variables that class B, class A and class C has the same one or what? I mean if I change the intPriA from class B what will happen to class C one?
I'm confused on this subject, any help would be appriciated also any good article that has explanation on this would be very very helpful.
Kind Regards,
|
|
|
|
|
The rule for public inheritance is simple:
private data/methods are not accessible to B
protected data/methods remain protected in B
public data/methods remain public in B
So you can't change intPriA directly from B methods because intPriA is private.
--Mike--
LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ
Strange things are afoot at the U+004B U+20DD
|
|
|
|
|
Hi ALL
I have one problem need you help , I want to save a html file as below
<br />
CString filename="c://test.html";<br />
CStringarray array;<br />
CFile file; <br />
if(file.Open(filename,CFile::modeCreate|CFile::modeWrite)==0)<br />
{<br />
AfxMessageBox("Error happen from opening file",MB_OK,0);<br />
return false;<br />
}<br />
CArchive html(&file,CArchive::store);<br />
<br />
array.Add("<HTML><HEAD><TITLE>");<br />
array.Add("test.html");<br />
array.Add("Report </TITLE></HEAD>"); <br />
<br />
array.Add("<BODY BGCOLOR=Silver>");<br />
array.Add("</BODY>");<br />
<br />
for(int i=0;i<array.GetSize();i++)<br />
{<br />
if(html.IsStoring()) html << array[i];<br />
} <br />
html.Close();<br />
file.Close();<br />
When I open html file , it is as blow:
<br />
<HTML><HEAD><TITLE>test.html</TITLE></HEAD><BODY BGCOLOR=Silver>M</BODY><br />
^ ^ ^ ^<br />
It added some abnormal word that I don't want.
Coulde you give me any solution or suggestion?
Thank you!!
|
|
|
|
|
Anonymous wrote:
It added some abnormal word that I don't want.
Coulde you give me any solution or suggestion?
That happens because you're not writing an HTML file, you're writing a CArchive object. Those extra characters are data inside the CArchive . To write a plain text file, you can use CStdioFile .
--Mike--
LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ
Strange things are afoot at the U+004B U+20DD
|
|
|
|
|
Hi Michael
I changed to use CStdioFile and sloved this question.
Thank you for your help..^^
Thank you.
|
|
|
|
|
I cannot get the data from my vector after I’ve loaded it! It shows in debug that the vector is loading, but I can’t get the data it has loaded out of the vector.
Here’s the pertinent code:
#pragma warning(disable: 4786)
#include "stdafx.h"
#include "Well.h"
#include "Leases.h"
//#include "stdafx.h"
//#include "stdafx.h"
using std::cout;
using std::endl;
int main(int argc, char* argv[])
{
cout << "Hello World" << endl << endl;
CLease cleases;
/*
int i = 0;
for(i=0; i<6; i++)
{
cout << nSerialNum << strUseMap << " " << strWellDescription << " " << strWellName << endl; endl;
db::it++;
}
*/
return 0;
}
/* This class will be included in the vector and then saved to the file
*/
#if !defined AFX_WELL_H__
#define AFX_WELL_H__
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "stdafx.h"
#include <string>
//#include <vector>
//#include "Leases.h"
//#include <string>
using std::string;
class CWell {
public:
string& GetWellName2();
string& GetWellDescription2();
string& GetUseMap2();
long GetSerialNum2();
string GetWellName(string& str);
string GetWellDescription(string& str);
string GetUseMap(string& str);
long GetSerialNum(long& SN);
CWell();
virtual ~CWell();
void Initialize();
protected:
string strWellName;
string strWellDescription;
string strUseMap;
long nSerialNum;
// Fuctions of class
// string GetWellName();
// string GetWellDescription();
// string GetUseMapLocation();
// long GetSerialNumber();
};
#endif // !defined AFX_WELL_H__
#include "stdafx.h"
//#include <vector>
#include "Well.h"
//#include <string>
CWell::CWell() {
// This class holds the data for each well
strUseMap = "";
strWellDescription = "";
strWellName = "";
nSerialNum = 0;
}
CWell::~CWell() {
}
// end class
void CWell::Initialize()
{
// Initialize the well class members to 0/NULL
nSerialNum = 0;
strUseMap = "";
strWellDescription = "";
strWellName = "";
}
long CWell::GetSerialNum(long& SN)
{
return nSerialNum = SN;
}
string CWell::GetUseMap(string& str)
{
return strUseMap = str;
}
string CWell::GetWellDescription(string& str)
{
return strWellDescription = str;
}
string CWell::GetWellName(string& str)
{
return strWellName = str;
}
long CWell::GetSerialNum2()
{
return (long)nSerialNum;
}
string& CWell::GetUseMap2()
{
return strUseMap;
}
string& CWell::GetWellDescription2()
{
return strWellDescription;
}
string& CWell::GetWellName2()
{
return strWellName;
}
#if !defined AFX_LEASES_H__
#define AFX_LEASES_H__
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "Well.h"
#include "stdafx.h"
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
//#include "Well.h"
using std::vector;
using std::iterator;
class CWell;
class CLease {
public:
CLease();
~CLease();
protected:
int nNumOfWells;
std::vector<cwell> db;
std::vector<cwell>::iterator it;
CWell cwells;
};
#endif // end class definition
#include "stdafx.h"
#include "Leases.h"
#include "stdlib.h"
using std::cout;
using std::endl;
CLease::CLease()
{
//CWell cwells = new CWell;
cwells.Initialize();
// For Testing Only : delete after testing is complete
long SN, SN2 = 0;
string str, str2, str3 = "";
int i = 0;
for(i=0; i< 6; i++)
{
switch(i)
{
case 0: SN = 0; SN2 = cwells.GetSerialNum(SN);
str = "1st Use Map"; cwells.GetUseMap(str); str = "";str2 = "";
str = "1st WellDescription"; cwells.GetWellDescription(str); str = "";str2 = "";
str = "1st Well Name"; cwells.GetWellName(str); str = "";str2 = "";
break;
case 1: SN = 1; SN2 = cwells.GetSerialNum(SN); SN = 0;
str = "2nd Use Map"; str2 = cwells.GetUseMap(str); str = "";str2 = "";
str = "2nd WellDescription"; str2 = cwells.GetWellDescription(str); str = "";str2 = "";
str = "2nd Well Name"; str2 = cwells.GetWellName(str); str = "";str2 = "";
break;
case 2: SN = 2; SN2 = cwells.GetSerialNum(SN); SN = 0;
str = "3rd Use Map"; str2 = cwells.GetUseMap(str); str = "";str2 = "";
str = "3rd WellDescription"; str2 = cwells.GetWellDescription(str); str = "";str2 = "";
str = "3rd Well Name"; str2 = cwells.GetWellName(str); str = "";str2 = "";
break;
case 3: SN = 3; SN2 = cwells.GetSerialNum(SN); SN = 0;
str = "4th Use Map"; str2 = cwells.GetUseMap(str); str = "";str2 = "";
str = "4th WellDescription"; str2 = cwells.GetWellDescription(str); str = "";str2 = "";
str = "4th Well Name"; str2 = cwells.GetWellName(str); str = "";str2 = "";
break;
case 4: SN = 4; SN2 = cwells.GetSerialNum(SN); SN = 0;
str = "5th Use Map"; str2 = cwells.GetUseMap(str); str = "";str2 = "";
str = "5th WellDescription"; str2 = cwells.GetWellDescription(str); str = "";str2 = "";
str = "5th Well Name"; str2 = cwells.GetWellName(str); str = "";str2 = "";
break;
case 5: SN = 5; SN2 = cwells.GetSerialNum(SN); SN = 0;
str = "6th Use Map"; str2 = cwells.GetUseMap(str); str = "";str2 = "";
str = "6th WellDescription"; str2 = cwells.GetWellDescription(str); str = "";str2 = "";
str = "6th Well Name"; str2 = cwells.GetWellName(str); str = "";str2 = "";
break;
} // end switch
db.push_back(cwells);
//SN = /*dynamic_cast<long> (*/cwells.GetSerialNum2();
//str = /*dynamic_cast<char> (*/cwells.GetUseMap2();
//str2 = /*dynamic_cast<char> (*/cwells.GetWellDescription2();
//str3 = /*dynamic_cast<char> (*/cwells.GetWellName2();
//cout << SN << str << " " << str2 << " " << str3 << endl;
//cout << *it << endl;
it++;
SN = 0;
str = "";
str2 = "";
str3 = "";
//char ch;
//getc(ch);
/* for(i=0; i<6; i++)
{
cout << nSerialNum << strUseMap << " " << strWellDescription << " " << strWellName << endl; endl;
db::it++;
}
*/
} // end for
// now check the container
CWell well;
for(it=db.begin(); it != db.end(); it++)
{
SN = /*dynamic_cast<long> (*/well.GetSerialNum2();
str = /*dynamic_cast<char> (*/well.GetUseMap2();
str2 = /*dynamic_cast<char> (*/well.GetWellDescription2();
str3 = /*dynamic_cast<char> (*/well.GetWellName2();
cout << SN << " " << str << " " << str2 << " " << str3 << endl;
//cout << *it << endl;
SN = 0;
str = "";
str2 = "";
str3 = "";
} // end for
}
CLease::~CLease()
{
}
C++ is my favorite programming language
|
|
|
|
|
Is it possible to create a console application to send an image to the clipboard using:-
c:\image.jpg (for example)
as part of the command line parameter. I have just started learning C++ and am trying to create some simple console apps to get started.
Regards
Paul
|
|
|
|
|
Yes... read the image file (look for hints and code in the forum and articles) and then use ::SetClipboardData() (look it up in MSDN ... there is also an example there.). Hope this helps.
- tareq
|
|
|
|
|
Thanks for the reply
Can anyone tell me which header file I have to include to use the clipboard functions.
Is it hust windows.h ?
|
|
|
|
|
Stirfie wrote:
Can anyone tell me which header file I have to include to use the clipboard functions.
They are in winuser.h which you get by including windows.h .
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|