|
One solution is to add a handler for WM_CTLCOLOR. Update color of the static control inside the handler.
Kuphryn
|
|
|
|
|
Yes. That was one avenue that led to a feeling of stupidity. Put a handler in the Find Dialog and SendMesssage to its window. I have yet to find a description of the proper setup of WM_CTLCOLOR wparam, lparam. Do you know a good source for such info? Thanks.
Alex.
|
|
|
|
|
Look up WM_CTLCOLORSTATIC in the MSDN Library.
Trust in the code Luke. Yea right!
|
|
|
|
|
Silly me, searching on just WM_CTLCOLOR. I see COLORSTATIC is restricted to a thread, but I can work around that.
Many thanks, John. Between you and kuphryn I feel the Force may be with me again.
|
|
|
|
|
I have a raw socket and i construct its IP and TCP header myself. The TCP header is like the following:
#pragma pack(1)
struct tcpheader {
unsigned short int th_sport;
unsigned short int th_dport;
unsigned int th_seq;
unsigned int th_ack;
unsigned char th_x2:4, th_off:4;
unsigned char th_flags;
unsigned short int th_win;
unsigned short int th_sum;
unsigned short int th_urp;
};
Now when i want to send a packet i fill in all the values and everything works great. I use a packet capturer to check if the values i filled in were actually the values transmitted. Now the problem is that i send packets in a while loop and everytime i increase the sequence number by one like this:
while (!kbhit())
{
if (sendto(s, datagram, 40, 0, (SOCKADDR *)&sin, sizeof(sin)) == SOCKET_ERROR)
{
printf("sendto() failed: %d\n", WSAGetLastError());
return -1;
}
printf(".");
Sleep(1000);
tcph->th_seq++;
}
When i check the packets in my capture program i see that the first packet is in order if i set tcph->th_seq to 0. But if i use another value like 7000000 i see much larger number in my capture program, and also if the code increments from 0, the sequence number doesn't rise by 1 every packet but with A LOT more (the second packets sequence number is 16777216!). Could anyone explain why its not just incrementing by 1 each time, and how can i set the sequence number to the value i want?
Many thanks in advance
Kuniva
--------------------------------------------
|
|
|
|
|
Kuniva wrote:
if the code increments from 0, the sequence number doesn't rise by 1 every packet but with A LOT more (the second packets sequence number is 16777216!).
Boy are you gonna feel stupid now. ;->
Have you checked what that number is in hex? Does 0x01000000 ring any bells? Network byte order and host byte order is a mismatch on IA32. Now start using htonl and ntohl.
|
|
|
|
|
lol! I don't feel stupid actually, i figured it would be something like that hehe
Thanks a lot for the help
Kuniva
--------------------------------------------
|
|
|
|
|
I have compiled ZLib source code in turbo c 3.0?
I want to use it on MSDOS for compressing and uncompressing the files.
My question is that
Is it possible to run ZLib code on MSDOS.
v
f
dssg
dsfg
dfsgsd
f
|
|
|
|
|
|
I want to randomly generate a number for the certain range of number??? How?? Help me
|
|
|
|
|
Most random number generators will provide a number between 0 and 1. If you want to produce numbers between 15 and 20, for example, the difference is 5 (20 - 15), and the offset is 15. So, generally, if you take rand()*5 + 15 you'll get numbers between 15 and 20.
rand() * range + offset
Dave
"You can say that again." -- Dept. of Redundancy Dept.
|
|
|
|
|
better in this case will be
rand()%(range+1) + offset;
use srand to initial your randomgenerator
Heiko
|
|
|
|
|
How can I convert a CString to a char * variable?
CString str;
char *szBuffer;
//code
.
.
.
szBuffer = (const char *) str; //why does this not work, and what do I have to do?
|
|
|
|
|
Use the getBuffer function.
|
|
|
|
|
CString str;
TCHAR *szBuffer=(LPTSTR)(LPCTSTR)str;
~RaGE();
|
|
|
|
|
Rage wrote:
TCHAR *szBuffer=(LPTSTR)(LPCTSTR)str;
This only works is you do not write into the CString.
If you really need to write into it, you have to use GetBuffer() /ReleaseBuffer() .
My opinions may have changed, but not the fact that I am right.
|
|
|
|
|
Yep, I know, but in his initial example he tried to typecaste in a const char *, so ...
~RaGE();
|
|
|
|
|
Yeah, but that type of stuff IS really dangerous.
It works once you understood when to use it (at a InsertItem() with a LVITEM / TVITEM.pszText for example).
But IMHO it is nothing to tell beginners. Shhhh!
My opinions may have changed, but not the fact that I am right.
|
|
|
|
|
|
Hello I am looking for a source to get the common toolbar xp icons as described here[^]. I am really looking for the source files because I want to use them with alpha blending so I really need the transparency channel and it won't work if I just screencap and crop. I have been looking for them in systems DLL without luck.
Does anyone know?
Regards,
Nicolas
|
|
|
|
|
hey all,
i'm a beginner and have one problem.
I want to program a CListCtrl(report-view) object with the resource-editor within a non-modal dialog. Always when I declare a variable with the assistent for the object(CListCtrl variable), i get a DEBUG ASSERTION FAILED during carring out my application. Why?????
The same Project within a modal dialog works fine.
Can everybody help me???
thanks
Stefcos
|
|
|
|
|
What is the file and line # of the fired assertion?
|
|
|
|
|
Is there a easy way to acces desktop icons and move them around in x and y pos?
I think I saw a program that did that a while ago.
/Jarek
He believed the commercials that said drink beer, get laid
but at closin' time he was alone, he didn't get paid.
Last night his lover was a razorblade..
"Dan Reed song Mix it up"
What do you want to patch today?
|
|
|
|
|
How about getting a handle to the desktop window, and enumerating its child windows?
|
|
|
|
|
Okey sounds interessting but do you have some sample code or an example?
I never did it before!
/Jarek
He believed the commercials that said drink beer, get laid
but at closin' time he was alone, he didn't get paid.
Last night his lover was a razorblade..
"Dan Reed song Mix it up"
What do you want to patch today?
|
|
|
|