|
rishimohan wrote: URGENT!!!!! HELP PLEASE!!!!!!!!!!!
not a really good description for a question, isn't it ?
|
|
|
|
|
How to send unsigned char* using winsock.h?
The send function in winsock that I know is only accepted char*.
Thanks.
|
|
|
|
|
So what exactly is the problem? As long as the receiving end casts what it gets to an unsigned char , it should be fine.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
The server is only accepted unsigned char, and I can't change the configuration (it's must not).
So my client application should send unsigned char.
The problem : is winsock able to send unsigned char?
|
|
|
|
|
Just make a cast to a char*, it is that easy.
|
|
|
|
|
wira1guys wrote: The problem : is winsock able to send unsigned char?
Not unless you first cast it to a signed char .
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks.
I had already found that winsock is send the value of the char, it depends on the length parameter.
|
|
|
|
|
Hi
I am writing a OpenGL Application and I want to put it into a SDI Application with Visual C++ .NET 2003.
I have used a tutorial on code guru to get the SDI kind of working, but I cant figure out how to resize the openGL window when the SDI window is being resized.
I have placed my whole openGL SDI application on
http://www.ece.ubc.ca/~npatel/OpenGL/OpenGLTest.rar
Any help would be greatly appreciated.
Thanks
|
|
|
|
|
Can you post some relevant code snippet ? Where do you put the openGL stuff ? In a control, on a view, ... ? If that's the case, you just have to resize this control.
|
|
|
|
|
You can download the whole project from the link I provided.
|
|
|
|
|
1) I don't have winrar installed on my computer (I'm at work)
2) I don't really want to dig into your code trying to understand what you did without any explanation.
You should be able to provide some relevant code snippet and explain clearly your problem. That's already a big step in understanding your problem and trying to solve it.
Remember that people here have limited time and are not getting paid.
|
|
|
|
|
|
Is there any way to create a memory device context that is valid between processes? If you do a HDC hdc = CreateCompatibleDC(...) its returning a pointer that's valid only for the current process address space. However, considering that DLL's can designate blocks of memory that are shared between processes, it seems you could have a mem DC shareable between processes as well.
|
|
|
|
|
An HDC is only valid within the context of the process that created it.
You can share the handle in a shared data segment but that won't make it
valid to another process.
What part(s) of the device context are you looking to share between processes?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: An HDC is only valid within the context of the process that created it.
You can share the handle in a shared data segment but that won't make it
valid to another process.
What part(s) of the device context are you looking to share between processes?
Just an HBITMAP, not fonts, or pens, etc. If one process does a hdc = CreateCompatibleDC(...) and SelectObject(hdc,hbmp), I want any other process to be able to BitBlt to/from it.
This hdc is part of a C++ object I have defined in a shared memory segment of a DLL:
G g_list __attribute__((section ("shared"), shared));
So, every process that accesses that DLL is accessing the exact same g_list and g_list members. The class doesn't contain pointers, with the exception of this hdc which I didn't realize was a local pointer.
|
|
|
|
|
Force Code wrote: Just an HBITMAP
Sharing pointers between processes is a no-no, you need to share the data. In this case that data is called a "dib section".
Waldermort
|
|
|
|
|
I was going to suggest the same thing as WalderMort -
A DIB section through a named file mapping (in-memory).
All the info you need to create the DIBSection and a
memory DC in the second process can be shared.
See CreateDIBSection()[^].
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: I was going to suggest the same thing as WalderMort -
A DIB section through a named file mapping (in-memory).
All the info you need to create the DIBSection and a
memory DC in the second process can be shared.
See CreateDIBSection()[^].
We must be looking at documentation near simultaneously, somehow. I saw the file mapping thing but ruled it out as too byzantine (for my tastes).
What I did instead was to make hdc static in the class - which results in each process having its own copy - strangely. Since the class is in shared memory, making it nonstatic means every process has the same copy - static results in the opposite in this case. Then I have another new static member local_cnt. if local_cnt != (nonstatic)cnt then the static hdc is deleted and recreated (thus synchronizing with changes elsewhere.
|
|
|
|
|
Force Code wrote: What I did instead was to make hdc static in the class
And in a few weeks you will be asking why your code is crashing unexpectedly.
Waldermort
|
|
|
|
|
...or days
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I have a dialog, on which CStatic frame is present.
I display the image on CStatic.
I want to move the image with arrow keys. The image moves nicely. but previous part of image is not getting erased. When i minimize and maximize the dialog, the back stuff get erased and only the image is visible.
Hi this is SHivraj
|
|
|
|
|
shivrajbhosale wrote: but previous part of image is not getting erased
Why would it get "erased" if you aren't erasing it?
The control handles its drawing. When drawing your image, you are
responsible for drawing and erasing.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Yes, you are right. Thats why i am calling Invalidate() of CStatic, which should redraw the whole control. But it does not invalidate() the region where the previous image was.
Thanks
Hi this is SHivraj
|
|
|
|
|
That was my point. The static control, depending on it's style, may only draw a frame.
It may not draw anything at all.
As suggested on another post here, you need to invalidate the appropriate window.
Yes, flicker is an issue - you should only invalidate the areas you want "erased",
not the entire dialog.
Static controls were not meant for imaging. If you want this behavior then you need to
make the control owner-drawn and implement this yourself. Better yet, implement your
own control class.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|