|
I'm playing around with a client/server app that uses winsock/iocp to send/receive data via a simple protocol. A backend database is basically being queried by the clients over the TCP connection.
I would like to return results to the client using ADO's GetRows method on the server and passing the SAFEARRAY that GetRows returns as a buffer over the TCP connection. No, I'm not using COM/DCOM, straight TCP, so I need to send a buffer.
Currently I'm using ADO's GetString to create a buffer, passing then, and then parsing it on the client. I'd like to use GetRows and pass a SAFEARRAY directly. This allows improved concurrency because of the asynchronous capabilities of GetRows, and would also remove the need to parse the data on the client.
From what I understand, a SAFEARRAY consists of an array descriptor and then a buffer of data. I assume that the data buffer is very pointer-centric, but if I can get the size of the buffer and pass it, perhaps I could "fix-up" the pointers on the receiving end or something (based on an offset of the pointer to the start of the buffer on the server vs. the start of the allocated buffer on the client)?
Thoughts?
Mike Stephenson
|
|
|
|
|
hi
i have a problem and i dont know how to solve it,
i want to record wave file as long as my application is running and while recording i want to split the wav recorded (continuous word)into isolated words(split at the silence)into wav files
and this must be real time problem
sorry for disturbing
thanks in advance
|
|
|
|
|
By "record", do you mean "write to hard disk" or "capture in memory"?
The standard C WaveIn functions can be used to capture audio to blocks of memory, where each "block" is a series of samples. Each sample is a value (0 to 255 for 8-bit or 0 to 65535 for 16-bit.)
You could capture (say) blocks of 50 milliseconds, then a simple check for "silence" would be to calculate the sum of the difference of each sample from 128 or 32768. If this sum is below some threshold (determined by trial-and-error), it is "silence", i.e. the break between words.
As far as I remember, the FISTER http://www.codeproject.com/audio/fister.asp[^] application was a good starting point.
|
|
|
|
|
I need to premise that I'm a novice in visual C++.
Having said that, I'm creating an interface which requires over 200 edit boxes (that return numeric values). By creating 200 edit boxes, however, I get over 200 OnEnChangeEdit###() functions. I would like to have all the edit boxes point to a single function that knows which element of the matrix has been edited. How do I do this?
Thanks,
Francesco
|
|
|
|
|
at the top of your dialog class's .CPP file, you'll see a lot of ON_EN_CHANGE(IDC_*, On*) macros that map change events to functions. change all those to point to the same function.
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
Thanks a lot!
while we're at it, do you know if there's a way to progressively build updates/releases, so that I don't have to edit on previous (working) versions of the program, risking that it WON'T work anymore?
Thanks again!
|
|
|
|
|
also, and i hope this is the last question, is there a way to automatically insert say 200 edit boxes all of the same dimensions in an nxm matrix instead of manually having to copy and paste them all?
thanks for all your help!
|
|
|
|
|
and any ideas on how to automatically insert say 200 edit boxes all of the same dimensions in an nxm matrix instead of manually having to copy and paste them all?
|
|
|
|
|
francescot wrote: ...is there a way to automatically insert say 200 edit boxes all of the same dimensions in an nxm matrix...
This sounds like a grid control.
"The words of God are not like the oak leaf which dies and falls to the earth, but like the pine tree which stays green forever." - Native American Proverb
|
|
|
|
|
|
Chris Losinger wrote: what you need is some kind of Source Control system (ex. SourceSafe)
Or, if you really insist in a working one, CVS.
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|
|
could you briefly tell me how to use CVS? how do i insert it in my project?
thanks.
|
|
|
|
|
francescot wrote: could you briefly tell me how to use CVS?
The CVS-Client I used was WinCVS[^]. There is a lot of documentation about setting up CVS and accessing the repository on that Website.
CVS itself, coming from the Unix side, is rather console-heavy. But in normal use you do not need to use the console if you do not want to.
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|
|
Thanks, I'll check it out. Incidentally, do you know how to arrange Edit boxes in a matrix without having to copy and paste them and use your eyes to figure out if distances between them are all the same?
|
|
|
|
|
francescot wrote: Incidentally, do you know how to arrange Edit boxes in a matrix
HoHum - I think I would close the IDE and edit the rc-file myself. The coordinates are in there, and you can change them as you like.
But this is still tedious work.
The whole concept of the WIN32-resource management is very old fashioned - which is why they started Vista in the first place.
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|
|
but then how do I know which box was the one that was edited? where do I keep track of that?
|
|
|
|
|
these might come in handy:
#define GetMemberID() \
( (GetCurrentMessage()->wParam) & 0x0000ffff )
#define GetMemberWnd() \
( FromHandlePermanent( (HWND) (GetCurrentMessage()->lParam) ) )
(found em via Google)
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
|
|
I still haven't been able to figure out how this works. I can't assign a vector to the edit box because DDX_Control doesn't accept that.
Is there anything else you can suggest?
|
|
|
|
|
|
Here's the problem: I have 220 edit control boxes placed in a 10x22 matrix into which I have to individually insert numbers between -255 and 255. By editing the content of a box, I also know the address of the cell that was edited, and this is crucial. If I set up each box to go into the same subroutine (which is what I want), such as:
ON_EN_CHANGE(IDC_EDIT_Weights101, OnEnChangeEditWeights)
ON_EN_CHANGE(IDC_EDIT_Weights102, OnEnChangeEditWeights)
then in the OnEnChangeEditWeights subroutine, I also HAVE to be able to recognize which cell (101 or 102) was edited. What I wanted to do was to have a situation like this:
DDX_Control(pDX, IDC_EDIT_Weights101, weight[1]);
DDX_Control(pDX, IDC_EDIT_Weights102, weight[2]);
which is illegal because DDX control does not accept vectors. So how do I get the information about: 1) the box that was edited; 2) the value inserted, without having to create 220 individual subroutines, each with its own variable (weight1, weight2,...) that contains the address?
Let me know if this is clear enough.
|
|
|
|
|
francescot wrote: which is illegal because DDX control does not accept vectors
weight[x] is an int?
what about DDX_Text(pDX, IDC_EDIT_Weights101, weight[1]);
DDX_Control maps to a CWnd. but DDX_Text maps to int, float, CString, etc..
---
and, just FYI, if you can ensure that the IDs for the edit controls always fall into a fixed range, you can use the ON_CONTROL_RANGE[^] macro to handle the EN_CHANGE message. that will provide your handler the control ID - a little cleaner than using that macro i posted yesterday, but requires some diligence around the resource IDs.
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
I tried the first suggestion and here's what i got:
error C2665: 'DDX_Text' : none of the 17 overloads can convert parameter 3 from type 'HWND__'
am i doing something wrong?
i'll take a look at the on_control_range macro
|
|
|
|
|
francescot wrote: am i doing something wrong?
i assume width[] was a vector of ints. i guess it's a vector of HWNDs ?
use DDX_Text to put data into ints. use DDX_Control to associate CWnd-derived classes with resource IDs
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|