|
Thank you.
That was what I was looking for.
V.Dolinay
|
|
|
|
|
hi,
I am a new socket programmer, I know that socket allow sending buffer of char by send(), if I wont to send a struct or whole class, how I do it?I wish do it by basic socket, then by MFC class.
in reality, I have an application that I would make it work on network, it is installed one several machine , one machine ( the master) send to the others data (object, commend)and the result is sent to this machine,
thanks.
|
|
|
|
|
You can send() your struct/class as raw bytes. sizeof will tell you how many bytes. And at the other side you must recv() that many number of bytes into a pointer to your struct/class cast to a byte *
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
thanks,
If my struct is:
struct X{
int..;
char*..;
..
};
struct X Y;
and I woul send Y by send(),how i send it as raw bytes, i cast it: send(socket,(byte *)Y,sizeof(Y),0)?
and wen I received it I will recost it:
....
int i=recv(socket,buf,..)
struct X* pX;
pX=(struct X*)buf;
...?
|
|
|
|
|
That should work BUT ONLY IF your struct DOES NOT HAVE ANY pointer members. In your case you seem to have a char*. Replace char* with a char[].
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Hello
I would like my database app to be able to store files... is this easy to do via CRecordset class.
Any tips would be nice.
Best regards
Henrik
|
|
|
|
|
Read the file and store it as a string in database and store its extenstion in another record.
Mazy
"The more I search, the more my need
For you,
The more I bless, the more I bleed
For you."The Outlaw Torn-Metallica
|
|
|
|
|
What kind of datatype do you use in the SQL Server then ??
regards
Henrik
|
|
|
|
|
It depends on the type of file, for a plain text file i'd use MEMO or TEXT, if it was a binary file your best bet would be BLOB or BINARY.
I'm not sure if these are the MS SQL Server types or one of the many other DB's i've used
|
|
|
|
|
Thank's
I shall try this tonight.. hopefully you will not be hearing from me again
|
|
|
|
|
How to populate MS flex grid with some recordset?
// This is the problem
m_cFlex.SetDataSource(LPDISPATCH(pRst));
Flex grid give me a message "Type mismatch". Anyone know why? What I need to write here?
pRst is variable ADOCG::_RecordsetPtr pRst;
|
|
|
|
|
Hello all,
I am working at a MFC application and I am using the STL containers also. The problem is that I am trying to use valarray and when I include
[pre]
#include <valarray>
[/pre]
I get all sorts of compiling errors
[pre]
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\valarray(104) : warning C4003: not enough actual parameters for macro 'min'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\valarray(110) : warning C4003: not enough actual parameters for macro 'max'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\valarray(104) : error C2059: syntax error : 'function-style cast'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\valarray(167) : see reference to class template instantiation 'std::valarray<_Ty>' being compiled
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\valarray(104) : error C2334: unexpected token(s) preceding ':'; skipping apparent function body
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\valarray(167) : see reference to class template instantiation 'std::valarray<_Ty>' being compiled
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\valarray(109) : error C2143: syntax error : missing ')' before '}'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\valarray(167) : see reference to class template instantiation 'std::valarray<_Ty>' being compiled
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\valarray(109) : error C2059: syntax error : ')'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\valarray(167) : see reference to class template instantiation 'std::valarray<_Ty>' being compiled
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\valarray(109) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\valarray(167) : see reference to class template instantiation 'std::valarray<_Ty>' being compiled
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\valarray(109) : error C2238: unexpected token(s) preceding ';'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\valarray(167) : see reference to class template instantiation 'std::valarray<_Ty>' being compiled
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\valarray(110) : error C2146: syntax error : missing ';' before identifier '_Ty'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\valarray(167) : see reference to class template instantiation 'std::valarray<_Ty>' being compiled
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\valarray(104) : error C2629: unexpected 'unsigned int ('
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\valarray(648) : see reference to class template instantiation 'std::valarray<unsigned int="">' being compiled
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\valarray(104) : error C2334: unexpected token(s) preceding ':'; skipping apparent function body
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\valarray(648) : see reference to class template instantiation 'std::valarray<unsigned int="">' being compiled
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\valarray(109) : error C2143: syntax error : missing ')' before '}'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\valarray(648) : see reference to class template instantiation 'std::valarray<unsigned int="">' being compiled
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\valarray(109) : error C2059: syntax error : ')'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\valarray(648) : see reference to class template instantiation 'std::valarray<unsigned int="">' being compiled
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\valarray(110) : error C2334: unexpected token(s) preceding ':'; skipping apparent function body
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\valarray(648) : see reference to class template instantiation 'std::valarray<unsigned int="">' being compiled
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\valarray(115) : error C2143: syntax error : missing ')' before '}'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\valarray(648) : see reference to class template instantiation 'std::valarray<unsigned int="">' being compiled
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\valarray(115) : error C2059: syntax error : ')'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\valarray(648) : see reference to class template instantiation 'std::valarray<unsigned int="">' being compiled
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\valarray(115) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\valarray(648) : see reference to class template instantiation 'std::valarray<unsigned int="">' being compiled
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\valarray(115) : error C2238: unexpected token(s) preceding ';'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\valarray(648) : see reference to class template instantiation 'std::valarray<unsigned int="">' being compiled
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\valarray(116) : error C2146: syntax error : missing ';' before identifier 'valarray'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\valarray(648) : see reference to class template instantiation 'std::valarray<unsigned int="">' being compiled
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\valarray(104) : error C2629: unexpected 'bool ('
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\valarray(754) : see reference to class template instantiation 'std::valarray<bool>' being compiled
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\valarray(756) : see reference to class template instantiation 'std::mask_array<_Ty>' being compiled
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\valarray(104) : error C2334: unexpected token(s) preceding ':'; skipping apparent function body
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\valarray(754) : see reference to class template instantiation 'std::valarray<bool>' being compiled
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\valarray(756) : see reference to class template instantiation 'std::mask_array<_Ty>' being compiled
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\valarray(109) : error C2143: syntax error : missing ')' before '}'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\valarray(754) : see reference to class template instantiation 'std::valarray<bool>' being compiled
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\valarray(756) : see reference to class template instantiation 'std::mask_array<_Ty>' being compiled
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\valarray(109) : error C2059: syntax error : ')'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\valarray(754) : see reference to class template instantiation 'std::valarray<bool>' being compiled
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\valarray(756) : see reference to class template instantiation 'std::mask_array<_Ty>' being compiled
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\valarray(109) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\valarray(754) : see reference to class template instantiation 'std::valarray<bool>' being compiled
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\valarray(756) : see reference to class template instantiation 'std::mask_array<_Ty>' being compiled
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\valarray(109) : error C2238: unexpected token(s) preceding ';'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\valarray(754) : see reference to class template instantiation 'std::valarray<bool>' being compiled
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\valarray(756) : see reference to class template instantiation 'std::mask_array<_Ty>' being compiled
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\valarray(110) : error C2146: syntax error : missing ';' before identifier '_Ty'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\valarray(754) : see reference to class template instantiation 'std::valarray<bool>' being compiled
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\valarray(756) : see reference to class template instantiation 'std::mask_array<_Ty>' being compiled
Error executing cl.exe.
[/pre]
However it compiles fine in a Console App.
Anybody have an idea?
Best regards,
Alexandru Savescu
|
|
|
|
|
Include valarray like this:
#undef min
#undef max
#include <valarray> The problem stems from some pesky min and max macros defined in windef.h that interfere with valarray::min and valarray::max .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thank you Joaquin, apparently they fixed this in VC 7.0
Best regards,
Alexandru Savescu
|
|
|
|
|
Does anybody know how to access Ports in Windows NT?
|
|
|
|
|
What kind of ports? Message ports?
Now that we've taken care of the educational bit (be precise), I assume you want to access some I/O port (serial, parallel, ...).
You talk to (or even write yourself) a device driver. Try searching Google for something like "Windows NT direct I/O".
|
|
|
|
|
Anyone know how to disable the list control from automatically displaying a vertical scroll bar when there are too many items to display?
I tried the LVS_NOSCROLL style but this disables scrolling entirely. I just want to get rid of the visual scroll bars but still have the ability to scroll the list control (I am using another method to scroll it as the program is designed to run on a touch-screen PC and the default scroll bars are to small to use).
|
|
|
|
|
I don't have a sure-shot answer for you, but I took a look at the CWnd class and noticed that it has a couple of functions you might wanna try: ShowScrollBar and EnableScrollBarCtrl .
Regards,
Alvaro
Insanity: doing the same thing over and over again and expecting different results. - Albert Einstein
|
|
|
|
|
Hello, I'm a beginner programmer and I'd like some advice if possible.
I'm TRYING to make an application that displays a bitmap (a map) and then I want to put values on that map, values that I take from a file. This wasn't a problem till I knocked my head to screen resolution changes and screen-to-printer changes. Now this is where I want some advice. Can anyone please tell me some CDC methods to use for this ? I don't want the program made, just some advice to build upon.
How do I pDC->TextOut(100,100,"Value") without bothering about screen resolution changes and display-to-printer conversions. Do I have to take screen rect coord and then do smtg like this : pDC->TextOut(100*(screenreswidth/800),100*(screenresheight/600),"Value") after inputing the coords with the resolution of 800x600. Or, do I have to use SetMapMode(MM_....) and then the Device to Logical() method ? If that, can anyone explain the concept since i'm not english and It's a litte difficult to translate (conceptually) device to logical. An example perhaps ?
And then, the screen-to-printer conversion problem. Is it absolutely necessary to calculate the screen-to-printer scale and then x*scale and y*scale. If so, it's a lot of work to do cause I have to display values for over a hundred cities on the map.
What can I do ?
Thank you !
|
|
|
|
|
you wish to draw text on the bitmap right??? You can try CMemBm class in codeproject.
|
|
|
|
|
No, I dont't wanna draw on the bitmap, I wanna TextOut some values and I needed advice for coordinates transformation which I can't get so easy.
The CMemBm class, from what I've seen it's just for drawing, so it's not helpfull.
|
|
|
|
|
|
Open the Quick watch window and in the edit box enter the function name (i.e. myfunc (0) ). Most likely will not work.
Best regards,
Alexandru Savescu
|
|
|
|
|
This is my third post now, can't anyone help me? I would like to know how to close/open a DeskBand from another process. Also why does explorer hang on to your deskband when it is closed? Am I doing something wrong? When I close my deskband, I can't delete the dll because explorer keeps it open.
If you know anything about this please help.
Thanks
|
|
|
|
|
The reason why IE is holding on to your DLL is because you have not properly destroyed all of your COM objects. There is a reference count in the object server of your DLL that keeps track of how many objects that are still active. And there is a function call DLLCanUnloadNow that lets OLE know if it can unload your DLL. This function will not let the owner process unload the DLL as long as there are outstanding objects.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|