|
Hadi-
Since I seem to have tons of free time.. here goes.
Historically, ascii 13,or ^M ( ctrl M ) is newline and
ascii 10, or ^J is carriage return.
Some output devices automatically translate a ^M (\n) to
a ( ^J + ^M) same as \r\n. ( for example command prompt, unix shell etc)
Some output devices DO NOT convert a ^M (\n) to a ^J ^M (\r\n),
( for example, Windows Edit Controls, Button, tooltips etc).
The best way to deal with this is to follow this rule :-
Always add a \r\n , if you want the effect of a "newline".
This way it will be guaranteed to work, no matter what your output
device is..
hope that helps..
vivek
|
|
|
|
|
Hi, I have some trouble to put an image (bitmap) on a child or parent window of a MDI. What I need is a very complete procedure step by step including new variable to put in specific class, code to add, etc., to do it easily.
Pou
|
|
|
|
|
You mean in the area visible when the MDI windows are not maximised ? It's just the CMainFrame OnEraseBackground, isn't it ?
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
Well, in MDI it's not CMainFrame. The 'app workspace' is actually MDI Client window. CMDIFrameWnd has a public HWND member called m_hWndMDIClient - this is the window to subclass.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
Is it possible to convert a bitmap that is on a child window of a MDI, to a kind of button? How?
Pou
|
|
|
|
|
Create a CBitmapButton or CButton in the first place. What do you specifically want to do ?
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
How can I determine the drive letter of my cd-rom while executing a .BAT file?
Pou
|
|
|
|
|
I'm relatively new to C++ programming which i'm sure this question will demonstrate...
I want to use vector's in an MFC dialog application that AppWizard generated for me, I added #include <vector.h> but when I declare vector<int> vTest; I get an error saying that the type is not found...
So I tried adding a "using namespace std;" and it said it can't find the namespace std...
What am I doing wrong???
Thanks,
William
|
|
|
|
|
Let me start by saying congratulations for using the STL. I was not so smart when I was starting and am only learning it now. A vector, like any array, needs to know what it is going to hold. I don't know if you're familair with templates, but they essentially allow you to specify a type as a parameter. To specify a vector of int's, you must do this:
vector<int> m_MyIntVector;
Having #included vector, you can remove using namespace std if you want to.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
Ok -
You have to say what the vector is going to hold.
So,
vector myVector; // Will not work..
Try using;
vector<int> myVector;
vector<float *=""> myVector;
vector<myownobject> myVector;
...etc
I am going to venture a guess you are coming from Java-land, where you
just say Vector myVector; then you can stick anything in there..
STL is more type safe than Java containers..
Good luck
Vivke
|
|
|
|
|
DUH -
I knew Christian coulndt have overlooked the < int >
in the template.. I didnt realize I was writing HTML in the post window.
(Definitely confusing)
Anyway, here goes..
Use;
vector < int > ; or
vector < float * >
etc..
Tips , use the > and < for the < and > signs
|
|
|
|
|
Duh - that gets me every time. I obviously didn't look at my post. < > (just testing)
Christian who just swapped PC's with Taylor
|
|
|
|
|
When U are using the MFC there are lot many classes are there which gives the functionality of vector.
Carray, CList, SafeArray like somay classes are there. U can Initiliza the classes and use it directly in your program. If you are not using MFC then inclede all the std header files.
|
|
|
|
|
When U are using the MFC there are lot many classes are there which gives the functionality of vector.
I realise that there are people here who do not speak English as a first language, but fair dinkum - 'there are a lot many classes are there' ??? 'like somay classes are there' ??? 'Initiliza' ???
Carray, CList, SafeArray like somay classes are there. U can Initiliza the classes and use it directly in your program. If you are not using MFC then inclede all the std header files.
To use CArray ( which is the same as a vector in it's O notation behaviour ( STL is defined in terms of O notation - vector was obviously meant to be an array, but it does not HAVE to be if someone comes up with a better idea )) you need to use tempplate arguments, you actually need to specify two rather than one. CList impliments a list, like deque. A list has totally different behaviour to an array in terms of speed ( quicker to remove items in the middle, slower to find them ). If you are not using MFC then you do not have CArray/CList/CSafeArray, unless there are alternate versions in the ATL headers.
Either way, the STL is more powerful, more flexible and cross platform. I recommend you use the MFC classes for the sake of learning them, but stick to STL. I also recommend you write your own list and array class, just to get a good idea of what goes on under the hood, but still use STL. I recommend the person who wrote this reply also learn the difference between container types and consider learning the STL.
Christian logged in as Alex
|
|
|
|
|
> U can Initiliza the classes
Looks like gangsta rap
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
I am hoping someone here is familiar with x.25 protocol. I have several questions I would like to ask you. Please feel free to email me if you think you might we able to help me!
|
|
|
|
|
Why don't you post the question perhaps somebody would pass by and answer it.
I also would like to know about the X.25 protocol. I
It is Illogical to define an inventor by his invention
|
|
|
|
|
Why don't you post your question we could all learn from the answer if it was answered.
P.S
Posted before I log in.
It is Illogical to define an inventor by his invention
|
|
|
|
|
I am not sure how to code the connect, bind and recieve. I have found nothing useful. I am trying to connect and only recieve data. I will not be sending any data. The program I am currently modifying was set up using TCP/IP. Please if anyone can assist me, please email me! Thanks!
trishv
|
|
|
|
|
www.MintMail.com/?m=640901
|
|
|
|
|
Unless you'd LIKE to sign up for a SPAM list that gives you 5 cents per email they send you, which probably comes in banana dollars. Speaking of which, is there anyone online who hasn't seen that annoying 'shock the monkey' banner ad ?
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
I have the following data
DWORD data, mask, pre_result, result;
int nShift;
data = 0xF4; // 11110100
mask = 0x04; // 00000100
pre_result = data | mask; // = 00000100
switch (mask)
{
case 0x01: nShift=0; break; // mask = 00000001
case 0x02: nShift=1; break; // mask = 00000010
case 0x04: nShift=2; break; // mask = 00000100
// other cases
}
result = pre_result >> nShift; // result = 1
is there a method to dynamically shift the bits of pre_result to obtain the bit value for result without using case statements?
pls help.
|
|
|
|
|
Given the values displayed for mask in the switch,
m = mask >> 1;
pre_result >> m;
should provide the same result.
BTW, the result of pre_result = data | mask is display incorrectly. It should be 11110100.
The value shown 00000100 would be the result of data & mask.
|
|
|
|
|
pre_result >> m
should be
pre_result >>= m
|
|
|
|
|
First of all, a small correction:
11110101 | 00000100 = 11110101
11110101 & 00000100 = 00000100
What are you trying to do? Do you want to check whether a specific bit is on?
Here's some quick information on bitwise operators:
OR (|) :
0 | 0 = 0,
1 | 0 = 1,
1 | 0 = 1,
1 | 1 = 1
AND (&) :
0 & 0 = 0,
1 & 0 = 0,
0 & 1 = 0,
1 & 1 = 1
XOR (^) :
0 ^ 0 = 0,
1 ^ 0 = 1,
0 ^ 1 = 1,
1 ^ 1 = 0
Now some examples:
value = 0xF4;
// 76543210
// 11110100
To turn on bit 1 : value |= 2; (value = value | 2; 2 because 2^1 = 2)
To turn on but 4 : value |= 16; (because 2^4 = 16)
To turn off bit 2: value &= ~4; (~4 is an int, all bits on except bit 2)
To check whether bit 5 is on:
if (value & 32) // 2^5 = 32, or 0x20
// it's on
Note that value & 32 does not return 1, but 32.
To get a result of 1 or 0 only, you can:
1) Use the and operator to turn off all other bits
2) Use a right shift (>>) to move bit 5 to 0
Example: (value&32) >> 5; (returns 1 or 0)
Hope this answers your question (and I hope I did't make any ridiculous errors
)
|
|
|
|