|
my code goes a little something like this
UCHAR dataBuffer[512];
.
. //processes stuff and puts
. //data inside dataBuffer.
.
for (a=0;a<4;a++)
{
display->AppendText(dataBuffer[a].ToString());
}
. //display is the name of my textBox.
.
.
|
|
|
|
|
I'm using FindWindow(),(just testing some stuff), and it doesn't seem to work for some of the windows I'm trying to get pointers to. For instance, this doesn't seem to work:
CWnd* pButton = this->FindWindow("Button","start");
if(pButton)
{
pButton->SetWindowText("Finish");
AfxMessageBox("found window");
}
but it works for me changing the caption of "Visual FoxPro" to "Visual CrapPro". (I HATE FoxPro).
Does anyone know what I'm doing wrong?
If I write code in my sleep, does that make me brilliant, or just a lazy programmer?
My articles
www.stillwaterexpress.com
BlackDice - the programmer formerly known as bdiamond
|
|
|
|
|
Have you verified (using Spy++) that a window exists that has a "start" caption and belongs to the "Button" class?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Yes, I drag the 'Window Finder' utility icon onto the start button, and that's what I get. The 'start' is in quotes and the 'Button' classname is not, but both parameters in the FindWindow() are specified as taking strings, so I put quotes around the 'Button' parameter also. It still returns a NULL pointer.
If I write code in my sleep, does that make me brilliant, or just a lazy programmer?
My articles
www.stillwaterexpress.com
BlackDice - the programmer formerly known as bdiamond
|
|
|
|
|
After reading the documentation on the function more carefully, I found that FindWindow only works on parent windows. So this is what I did, and it works. First I used FindWindow() to find the start button's parent (Shell_TrayWnd), then used that window's hWnd as the parent hWnd for my call to FindWindowEx().
CWnd* pShell = FindWindow("Shell_TrayWnd",NULL);
if(!pShell)
return;
CWnd* pButton = this->FindWindowEx(pShell->m_hWnd,NULL,"Button","start");
if(pButton)
{
pButton->SetWindowText("Finish");
AfxMessageBox("found window");
}
If I write code in my sleep, does that make me brilliant, or just a lazy programmer?
My articles
www.stillwaterexpress.com
BlackDice - the programmer formerly known as bdiamond
|
|
|
|
|
I am binding a user with correct password to active directory(SSL enabled). The user's attribute “User Must Change password at next logon” is set (i.e.pwdLastSet=0).
lderr = ldap_bind_s(ld, (char *) (LPCTSTR) szPath,(char *) (LPCTSTR)
szPassword, LDAP_AUTH_NEGOTIATE);
ldap_get_lderrno(pld->m_pLdap, NULL, &szErrmsg);
I get:
1. lderr = 49
2. szErrmsg = "8009030C: LdapErr: DSID-0C0903E2, comment:
AcceptSecurityContext error, data 0, v893"
Problem :
The error message I got is same when I try to bind a user with wrong password and whose attribute pwdLastSet= -1.
How will I distinguish that user login is rejected due to bad password or pwdLastSet=0 ?
I am sure there is no problem with SSL or other AD configuration.
Please Help
|
|
|
|
|
I'am getting crazy.
I work with the CRecorset Class an Access.
Now I want to use MS SQL. New projects work fine, but if i use an older project, there will be a mistake as soon as i use addnew().
i does not matter if i use a snapshot or dynamic cursor.
what makes it worse: if i use the same crecordset-class in an old and a new project the new one will word, the old one not.
please help before i go nuts!!!!!!!
|
|
|
|
|
Does anyone know is there a testing tool available which could do the following:
While running the application (which is tested) in debug mode the tool collects coverage information which can be saved for later purposes. And here is the catch, it should be possible to compare two sets of coverage information and perform logical operations to them. This way I could for example find out which lines of code were performed in a given test run but not in another and vice versa. It would be nice if the tool had a visual interface which would highlight the differences in the test run coverages (bit like in WinDiff).
This kind of tool would be valuable in a situation where a certain way to perform an operation causes an error but another (alternative) way doesn't. With bigger systems it's quite hard to do this manually.
The tool should be usable with VC++ 6.0.
|
|
|
|
|
Hey,
How can i find the status of a thread ( still active or not ) using its handle which i started using AfxBeginthread
thanks
shiju
shijuck
|
|
|
|
|
Try this function ::GetExitCodeThread()
Chris Meech
I am Canadian. [heard in a local bar]
Gently arching his fishing rod back he moves the tip forward in a gentle arch releasing the line.... kersplunk [Doug Goulden]
|
|
|
|
|
can the current Platform DK be used with VC6? Any positive/negative experiences?
we are here to help each other get through this thing, whatever it is Vonnegut jr. boost your code || Fold With Us! || sighist | doxygen
|
|
|
|
|
I'm using it, and so far no problems. That's the Feb 2003 SDK.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
|
|
|
|
|
We use the latest SDK (downloaded from the MS site, rather than off the MSDN CDs), with VC6 SP6, and it all works fine.
|
|
|
|
|
|
Hi,
I am working with Serial communication in VC++. I have a message in this format:
Message: "0XD07889ABCDEF47". It is in hexadecimal format.
0XD0 - Header
7889ABCDEF - Data
47 - Checksum
I have to compute the checksum using the formula
(~((Header+Data) & 0X7F) & 0X7F))
What data type can I use to store the Message? How do I compute the checksum using C++ code?
I am new to this exercise.
Can anyone please guide me?
Thanks
Madhavi
|
|
|
|
|
I think an integer in the form \x0D0 should do the job.
EDIT:
Just checked it! Do it like that:
int whatever='\x20';
int whatever2='\x32';
whatever+=whatever2;
Check for (decimal) 82, and you see its correct!
DKT
|
|
|
|
|
Dear friends,
I placed an edit control on dialog, i want some text to be present in edit box by default, so in OnInitDialog(), i did something like this:
SetDlgItemText(ID_MYEIDT, "My sample text");
Now the problem is that when i run the application, the cursor is at the extreme left position of edit box. I want to place the cursor at the end of the written text. How can i do so ??
Imtiaz
|
|
|
|
|
Check out the EM_SETSEL message. By specifying -1,text length as WPARAM and LPARAM, you put the caret at the end.
Steve S
Developer for hire
|
|
|
|
|
Try...
((CEdit*)GetDlgItem(ID_MYEDIT))->SetSel(-1,-1);
Pssst. You see that little light on your monitor? That's actually a government installed spy camera. Smile and wave to big brother!
|
|
|
|
|
send EM_SETSEL message to the edit box with both wParam and lParam greater than the text's length.
There is no spoon.
suhredayan
|
|
|
|
|
I need to save information that has odd bit sizes, like 4,5,9,15 bits. I need them to save them in a file, so they use as little space as possible.
For instance, i have an array short, and i only need the value of the first 11 bit of each place in the array saved to a file.( In order to compress the file size). When it has all been saved it 0 pads the data, so it will be a multiplum of 8 bits.
Is there any standard libs, or other that does this.
(Its a school projekt on sound compression.)
|
|
|
|
|
How about saving the array elements as short, then compress the data with zlib?
Pssst. You see that little light on your monitor? That's actually a government installed spy camera. Smile and wave to big brother!
|
|
|
|
|
rikkemus wrote:
(Its a school projekt on sound compression.)
That's honest, at least, and more interesting than some of the project/homework questions...
OK. You have a short value (which is normally 16 bits), and you want to save only 11 bits. File writes must be a multiple of 8 bits (1 byte). Therefore, if you have only one short, you lose, since you can't write only 3 bits to a file, and have to write 16 bits in total.
However, if you have two shorts, you want to write 22 bits. You still lose, because you have to write 24 bits, not 22. However, that's better, since you now have only two redundant bits. Your strategy should be to pack the bits into characters for writing, and unpack them after reading.
This requires use of bit shift operators >> and << and the bit manipulation operations, and (&); or (|) and not (~).
If you know how many n-bit values you have then you need to write that out to the file too, so that you know how many to read
After that, you just stream the bits out. There's code that does stuff like this in the zlib/gzip stuff, but that might be a bit complex (I'm not meaning to patronise, but it's not the easiest stuff to understand).
Essentially, you start with an empty buffer. You add to the buffer the bits you want. Let's use 11 as an example. The buffer contains bytes. Lets number the bits from the first 4 values as 1 2 3 4 for illustration. After adding four values, you'd have
11111111
11122222
22222233
33333333
34444444
4444????
You just saved two bytes of storage over writing the short values directly.
You need to track which unused bits there are in the buffer, as on the next write, the buffer should contain
11111111
11122222
22222233
33333333
34444444
44445555
5555555?
and so on. This isn't necessarily the best way to 'compress' the data, since it's only removing redundant bits, and doesn't take advantage of any other encoding the way that something like MP3 does, but it's a start, and better than nothing. You can use something like zlib (in a DLL) and write the data as shorts, and that will probably give you bigger savings, but might not count as a success in your project
Steve S
Developer for hire
|
|
|
|
|
Its divided up like this.
each set of information about the sound, have a header like this.
[0xFFF, 25*4 bit contains info about the number of bits used to represent a sound sample, 25*4 bit contains info about how much the data should be scaled.]
25*4 because there is 25 Bins that contains certain frequency, and 4 bit to represent the number of bits used. 0000 = 0 bit, 0001 = 2 bit, 0002 = 3 bit etc.
We cannot use standard compression methods like Zlib( im guessing its an algoritm like winzip? )
I was just hoping for a library allready made, that would put odd number bits into an array.
The library would do as you said, by putting the bits next after each other, since it cant write odd numbered bit count to a file.
It will become a simple compression.
Im just guessing someone might allready have made this kind of function allready.
Thx for the reply's
|
|
|
|
|
Try to pack your data into the standard word size for your machine (32 bits for example). So for example if you have 15 bit values that you have to store, pack them into a 32 bit word by:
unsigned int a[] = {1023,2032};
unsigned int c[2];
unsigned int b;
a[0] = 1023;
a[1] = 2032;
b= (a[0]<<15)+a[1];
c[0]= b >> 15;
c[1] = b & 0x1FFF;
Be careful to pay attention to sign extention rules for your give compiler. This same procedure can be used for any number of bits.
In this case you still carry two bits of overhead, but it is very easy and efficient. If that is still not accpetable, you will need to write a slightly more complex algorithm that will allow you to place values across word boundaries.
Good luck with your project.
|
|
|
|
|