|
Hi,
I'm not sure but i think that removing "class.h" and "class.cpp" files from the project will do the job.
Regards,
Eli
|
|
|
|
|
Hello,
How can I find out what program is running my program
by OpenWith... Dialog?
For example a user right-clicks on a file and chooses OpenWith...
and then my program.What is the address?How can my program knows
the address?
Please help me on this...
Thanks.
|
|
|
|
|
I'm not exactly sure what you are asking, but does AssocQueryString() or FindExecutable() help?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hi All,
I' m writing a Visual C++ MFC dialog-based program. I added a Menu bar uisng Insert->Resource-> Menu, not by writing code. Then, I tried to show and hide the Menu bar of a modal dialog dynamically but didn't succeed? Could anyone kindly help me?
Cheers,
hmc
|
|
|
|
|
I don't know any direct command that show/hide menu but the following will work too.
For removing menu bar at run time use following code
CWnd* pMain = AfxGetMainWnd();
if (pMain != NULL)
{
CMenu* pMenu = pMain->GetMenu();
while(pMenu != NULL && pMenu->GetMenuItemCount() > 0)
{
pMenu->DeleteMenu(0, MF_BYPOSITION);
pMain->DrawMenuBar();
}
}
For adding menu items again, use
AppendMenu
|
|
|
|
|
Hi Freind,
Thanks. But I only successfully hide the Menu, but not showing it again. Do I just need to replace "pMenu->DeleteMenu(0, MF_BYPOSITION);" to
"pMenu->AppendMenu(0, MF_BYPOSITION);" without changing other code?
Cheers
|
|
|
|
|
Can anyone help me find three different C++ statements for a source code that will print out the ASCII value of a character and only the ASCII value?
Thank you
|
|
|
|
|
#1
for(int i=65;<120;i++)
printf("\nASCII of %c is %d",i,i);
#2#3
I forget
"I Think this Will Help"
<h5
alok gupta="" <br=""> visit me at http://www.thisisalok.tk
|
|
|
|
|
There are 256 values in the ASCII table. If you are only wanting to print out the ASCII value, then you simply need to print out the numbers 0 through 255.
for (int x = 0; x < 256; x++)
cout << x << endl; It would be a little more useful if you printed out the ASCII character and its value:
for (int x = 0; x < 256; x++)
cout << (char) x << " = " << x << endl;
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Another option:
#include <iostream><br />
<br />
using std::cout;<br />
using std::endl;<br />
<br />
int main() {<br />
<br />
char character = 'A';<br />
cout << character << " " << (int) character << endl;<br />
<br />
return 0;<br />
}
|
|
|
|
|
I need help to make a simple application using Embedded Visual c++ 3.0
It's just a simple application that enables me to read and write files.
Write a file - save it - then retrieve it within the application.
Can anyone help to give me the codes needed for me to make the application work?? Thanks.
|
|
|
|
|
Using Win32 or MFC?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Using MFC. I need to do a simple Open/Save Dialog application. I'm a beginner and i ain't sure how to link the menu to the dialog.
Help please! Thanks.
|
|
|
|
|
CT Menot wrote:
Using MFC.
Ok, then you should check out the CFile and CStdioFile classes. They allow you to read from and write to a file.
CT Menot wrote:
I need to do a simple Open/Save Dialog application.
See if the CFileDialog class is what you are after.
CT Menot wrote:
...i ain't sure how to link the menu to the dialog.
What menu? While they can co-exist, menus and dialogs are not necessarily related.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I have to make a mobile IP client. I understand the principles but I don't know how to implement it.
What I need to do is getting any packet passed to network layer from link-layer, then processing them before passing them to network-layer. But I don't know how to get those frames.
One friend told me that I have to hook some Windows API, which are used for processing link-layer's frames, another told me that perhaps data from link-layer is put in a buffer.
Any one can help me?. Please give me advises or ideas.
Thank you very much!
|
|
|
|
|
I think, if you'll search the MSDN or google for NDIS.
These drivers sits between the TCP and link-layer, so it should be suitable for your needs.
|
|
|
|
|
Thank you geo_m.
After posting the question, I found that Visual Studio provides Filter-Hook driver and Firewall-Hook driver
These drivers are provided with the same purpose of NDIS. But I don't know what is the best one to use in this case.
How about system-suplied IP filter driver? I heard about it but I don't know whether we can use it or not.
|
|
|
|
|
Yes, first I looked also for he firewall-hook, but it states in documentation that
It is not recommended to implement a firewall-hook driver (or firewall driver) for Microsoft® Windows® XP and later versions of the operating system
With filter-hook, it seems better for me, but the documenatation I have is still marked as preliminary, and there is no statement about supported operating systems (if important)
Personally I would go to NDIS driver, as it is a proven solution and you can probably find more samples.
System-supplied ip filter driver - didn't heared about.
One warning - if it somehow transfer the data from driver to user mode process, it can kill the overal performance of the network on the machine, as switching from user mode to kernel mode and back is quite expensive operation. So consider carefully which method is best for use also with calculations of the expected data flow.
|
|
|
|
|
Thank you geo_m!
Now I'm implementing using NDIS. However. What I need is an IP packet that has been added an Ethernet header. But I in a source code example I saw that what we get in the function MPSendPackets() is a packet which is added an Ethernet header.
What should I do now?
|
|
|
|
|
I'm not sure, that I understood the question. Can you rephrase it somehow?
Just meanwhile, you can check FAQ and related stuff @ www.ndis.com[^]
|
|
|
|
|
I will explain more.
To build a mobile IP node, I have to tunell an IP packet. That means I have to add a new IP header before the original IP packet. It is called encapsulating. When the receiver gets the encapsulated packet, it will decapsulate to get the original IP packet. See the picture below
The original IP packet:
--------------------------------------------------------------------------
| Extra info | source IP addr | dest IP addr | Data
--------------------------------------------------------------------------
After encapsulating:
--------------------------------------------------------------------------
| New ex-info | New source addr | New dest addr | Extra infor | source IP..
--------------------------------------------------------------------------
\_________________________________________/ \_____________________________
^ ^
| |
| |
New IP header Original IP packet
That is why I need to get the IP packets and encapsulate them before transfer to higher or lower layer.
However, when I read an example source code in the article "NDIS Packet Alteration/Encapsulation Techniques" from http://www.ndis.com/code_snippets/default.html. I see that what the we can get in MPSendPacket is an Ethernet Frame (an IP packet which is added an Ethernet header). So I don't know how to add a new IP header in this case.
Do we have another way to get IP packets without Ethernet header?
|
|
|
|
|
Hm, I think, this is because NDIS sits between ethernet-layer2 and IP. Therefore you need to handle it somehow.
I downloaded the sample you mentioned - this is a sample of VPN tunnel - this is done on the ethernet level, so whole ethernet packet is encapsulated.
What I think you have to do is remove the ethernet frame from the packet, construct new ipinip packet and add an ethernet header again.
Don't know another place, where you can get & modify IP packets.
|
|
|
|
|
This is part of an assignment to make a cash register-like program. This function works counting the change to be returned, except the pennies. I can't figure out why the assignment to the penny (global) variable isn't working. Any idea's?
void makeChange(double cost, double payed) {<br />
double difference;<br />
<br />
difference = payed - cost;<br />
<br />
twenty = (int) difference / 20;<br />
difference = difference - (twenty * 20);<br />
<br />
ten = (int) difference / 10;<br />
difference = difference - (ten * 10);<br />
<br />
five = (int) difference / 5;<br />
difference = difference - (five * 5);<br />
<br />
one = (int) difference;<br />
difference = difference - one;<br />
<br />
quarter = ((int) (difference * 100)) / 25;<br />
difference = difference - (quarter * .25);<br />
<br />
dime = ((int) (difference * 100)) / 10;<br />
difference = difference - (dime * .1);<br />
<br />
nickel = ((int) (difference * 100)) / 5;<br />
difference = difference - (nickel * .05);<br />
<br />
cout << endl << "Difference before penny: " << difference << endl;<br />
cout << "Value of penny before: " << penny << endl;<br />
cout << "> penny = (int) (difference * 100); // Why isn't this line working?" << endl;<br />
cout << "> difference = difference - (penny * .01); // This \"should\" be 0 now." << endl;<br />
<br />
penny = (int) (difference * 100); <br />
difference = difference - (penny * .01);
<br />
cout << "Value of penny after: " << penny << endl;<br />
cout << "Difference after penny: " << difference << endl << endl;<br />
cout << "Flushing cout: " << cout.flush << " <-- Does this matter?" << endl << endl;<br />
}
|
|
|
|
|
You did not indicate what was not working about that statement. Do you get a compiler/linker error, a run-time error, or is the result just incorrect? What are the values of payed and cost ? What are the types of the other variables?
I know the solution to your problem, but I would rather show you how to get the right answer rather than just give you the answer outright.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Thanks for replying. I am not getting any errors, just a faulty answer. payed and cost are both entered by the user at run-time. All of the others are int's. Just to avoid confusion, here's the code in it's entirety: (I've included sample output at the end.)
<br />
<br />
#include <iostream><br />
#include <iomanip>
using namespace std;<br />
<br />
void makeChange(double, double);<br />
void displayChange();<br />
bool isNotCool(double,double);<br />
<br />
int twenty, ten, five, one, quarter, dime, nickel, penny;
<br />
int main() {<br />
double cost, payed;<br />
<br />
twenty = ten = five = one = quarter = dime = nickel = penny = 0;<br />
<br />
cout << fixed;
cin.precision(2);
cout.precision(2);<br />
<br />
cout << "This program takes in the cost of an item and the amount given to " <br />
<< endl<br />
<< "pay for it, and displays the change." << endl << endl;<br />
do {<br />
cout << "Enter the cost and the amount given " << endl<br />
<< "to pay for it separated by a space: ";<br />
cin >> cost >> payed;<br />
} while (isNotCool(cost,payed));<br />
<br />
makeChange(cost, payed);<br />
displayChange();<br />
<br />
cout << endl << "END PROGRAM" << endl;<br />
<br />
return 0;<br />
}<br />
<br />
bool isNotCool(double cost, double payed) {
if (cost > 0 && cost < 100)
if (payed > 0 && payed <= 100)
if (payed >= cost)
return false;
return true;
}<br />
<br />
void makeChange(double cost, double payed) {<br />
double difference;<br />
<br />
difference = payed - cost;<br />
<br />
twenty = (int) difference / 20;
difference = difference - (twenty * 20);
ten = (int) difference / 10;<br />
difference = difference - (ten * 10);<br />
<br />
five = (int) difference / 5;<br />
difference = difference - (five * 5);<br />
<br />
one = (int) difference;<br />
difference = difference - one;<br />
<br />
quarter = ((int) (difference * 100)) / 25;<br />
difference = difference - (quarter * .25);<br />
<br />
dime = ((int) (difference * 100)) / 10;<br />
difference = difference - (dime * .1);<br />
<br />
nickel = ((int) (difference * 100)) / 5;<br />
difference = difference - (nickel * .05);<br />
<br />
cout << endl << "Difference before penny: " << difference << endl;<br />
cout << "Value of penny before: " << penny << endl;<br />
cout << "> penny = (int) (difference * 100); // Why isn't this line working?" << endl;<br />
cout << "> difference = difference - (penny * .01); // This \"should\" be 0 now." << endl;<br />
<br />
penny = (int) (difference * 100);
difference = difference - (penny * .01);
<br />
cout << "Value of penny after: " << penny << endl;<br />
cout << "Difference after penny: " << difference << endl << endl;<br />
cout << "cout.flush = " << cout.flush << " <-- Does this matter?" << endl << endl;<br />
}<br />
<br />
void displayChange() {<br />
<br />
if (twenty) {<br />
cout << twenty << " twent";<br />
if (twenty != 1) {<br />
cout << "ies" << endl;<br />
} else {<br />
cout << "y" << endl;<br />
}<br />
}<br />
<br />
if (ten) {<br />
cout << ten << " ten";<br />
if (ten != 1) {<br />
cout << "s" << endl;<br />
} else {<br />
cout << endl;<br />
}<br />
}<br />
<br />
if (five) {<br />
cout << five << " five";<br />
if (five != 1) {<br />
cout << "s" << endl;<br />
} else {<br />
cout << endl;<br />
}<br />
}<br />
<br />
if (one) {<br />
cout << one << " one";<br />
if (one != 1) {<br />
cout << "s" << endl;<br />
} else {<br />
cout << endl;<br />
}<br />
}<br />
<br />
if (quarter) {<br />
cout << quarter << " quarter";<br />
if (quarter != 1) {<br />
cout << "s" << endl;<br />
} else {<br />
cout << endl;<br />
}<br />
}<br />
<br />
if (dime) {<br />
cout << dime << " dime";<br />
if (dime != 1) {<br />
cout << "s" << endl;<br />
} else {<br />
cout << endl;<br />
}<br />
}<br />
<br />
if (nickel) {<br />
cout << nickel << " nickel";<br />
if (nickel != 1) {<br />
cout << "ies" << endl;<br />
} else {<br />
cout << endl;<br />
}<br />
}<br />
<br />
if (penny) {<br />
cout << penny << " penn";<br />
if (penny != 1) {<br />
cout << "ies" << endl;<br />
} else {<br />
cout << "y" << endl;<br />
}<br />
}<br />
}
This program takes in the cost of an item and the amount given to
pay for it, and displays the change.
Enter the cost and the amount given
to pay for it separated by a space: .79 1
Difference before penny: 0.01
Value of penny before: 0
> penny = (int) (difference * 100);
> difference = difference - (penny * .01);
Value of penny after: 0
Difference after penny: 0.01
cout.flush = 1 <-- Does this matter?
2 dimes
END PROGRAM
But it does what it's supposed to, under certain circumstances:
This program takes in the cost of an item and the amount given to
pay for it, and displays the change.
Enter the cost and the amount given
to pay for it separated by a space: 25.99 100
Difference before penny: 0.01
Value of penny before: 0
> penny = (int) (difference * 100);
> difference = difference - (penny * .01);
Value of penny after: 1
Difference after penny: 0.00
cout.flush = 1 <-- Does this matter?
3 twenties
1 ten
4 ones
1 penny
END PROGRAM
Thanks for your help.
|
|
|
|