|
| how to convert above form to following form?
|
| WAVEFORMATEX in_wfx;
| in_wfx.wFormatTag = WAVE_FORMAT_PCM;
| in_wfx.nChannels =1;
| in_wfx.nSamplesPerSec =8000;
| in_wfx.nAvgBytesPerSec =16000;
| in_wfx.nBlockAlign =2;
| in_wfx.wBitsPerSample =16;
| in_wfx.cbSize = 0;
|
|
|
| WAVEFORMATEX out_wfx;
| out_wfx.wFormatTag = WAVE_FORMAT_PCM;
| out_wfx.nChannels =1;
| out_wfx.nSamplesPerSec =8000;
| out_wfx.nAvgBytesPerSec =8000;
| out_wfx.nBlockAlign =1;
| out_wfx.wBitsPerSample =8;
| out_wfx.cbSize = 0;
|
The nAvgBytesPerSec and nBlockAlign should be calculated:
out_wfx.nBlockAlign = out_wfx.nChannels * out_wfx.wBitsPerSample / 8;
out_wfx.AvgBytesPerSec = out_wfx.nBlockAlign * out_wfx.nSamplesPerSec;
out_wfx.nAvgBytesPerSec = out_wfx.nSamplesPerSec * out_wfx.nBlockAlign;
...
|
|
|
|
|
Currently using CreateFile and WriteFile functions.
I'm using
LARGE_INTEGER Position = Download->BytesDownloaded;
SetFilePointerEx(File, Position, NULL, FILE_END);
Keeps returning unable to convert _int64 to LARGE_INTEGER.
I read the structure of LARGE_INTEGER defined in WinNT.h.
Their is a LONGLONG declaration in it, but can't use it.
|
|
|
|
|
Fareed Rizkalla wrote: LARGE_INTEGER Position = Download->BytesDownloaded;
I suspect the error is there (BytesDownloaded) is long long or __int64.
Why pass the position anyway? If you are appending, just move the file pointer to the end of the file: SetFilePointer(File, 0, NULL, FILE_END);
|
|
|
|
|
I was using CFile in my project, although I resented everything MFC.
I rewrote the parts that were responsible to file output with WriteFile.
All of a sudden it stopped working without me changing anything in the code. When I wrote the code it was working now all of sudden it doesn't want to do what it's supposed to do.
HANDLE File;
File = CreateFile(LocalPathPFile, GENERIC_WRITE, 0, NULL, OPEN_ALWAYS | OPEN_EXISTING,
FILE_ATTRIBUTE_ARCHIVE | FILE_FLAG_WRITE_THROUGH, NULL);
WriteFile(File, Data, (DWORD)BytesReceived, NULL, NULL);
CloseHandle(File);
|
|
|
|
|
A lot of Windows functions provide error information; ignoring that is irresponsible and leads to mysteries such as the one you are facing now. Add proper error checking and handling to your code, and do it everywhere. Read the MSDN documentation on every Windows function you are using, and use GetLastError the way it should.
|
|
|
|
|
Beat me to it by 2 minutes.
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
Rajesh R Subramanian wrote: Beat me to it by 2 minutes.
2 minutes? that is an eternity, it is more than 1 billion ticks. Are you having a slow day?
|
|
|
|
|
Fareed Rizkalla wrote: OPEN_ALWAYS | OPEN_EXISTING
You instruct the CreateFile call to always open an existing file (and NEVER create one). Chances are that the file is deleted and the call to CreateFile is failing.
Also, API calls return a value for a reason - they let you know if something failed. Please check the documentation for these functions and check the return values (you may have to call GetLastError to find out what exactly went wrong).
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
Hy.Have anybody know a CSMTP client class , or an tutorial about to how to construct that ?
|
|
|
|
|
Jakub Piwowarczyk has written an interesting codeproject article with a class named CSMTP. The link to it is below.
SMTP Client[^]
...
|
|
|
|
|
Thanks , I try it , but do not send attach file ( attach file size is 0 ).
modified on Saturday, May 1, 2010 1:54 PM
|
|
|
|
|
Ok, you wrote that the program worked, you got no errors, an email was sent but not the attachment. ( attached file size is 0 ).
If you have problems sending an email, use Visual Studio's debugger and analyse the conversation
between your SMTP server and the client; perhaps, your server needs a different kind of authentication or doesn't need it at all.
|
|
|
|
|
You might have right , for test I use my gmail count , smtp.gmail.com , I will work around ... thanks .
|
|
|
|
|
I am having a tree on a dialog. I can select a node by clicking it; it highlights that node. But when I click in the textbox (or any other control in the dialog) then the selected node of tree does not remain in highlight state. It looks like nobody has clicked on any node. But when I click back on TreeCtrl then the selected node again get highlight.
So how to preserve the highlighted state or how to change selected node's backColor while I click on any other node and leave tree.
Thanks,
Rahul
|
|
|
|
|
|
Thanks Gary that worked. But backcolor is light Gray. So how can I change it to light blue.
|
|
|
|
|
These are the standard Windows colors. In order to override the colors in your control, you will probably need to implement custom drawing[^], which can be a little involved.
|
|
|
|
|
When I try to put WaitForSingleObject in the main dialog of a program using visual studio c++ 6.0 I get a c0239 error: WaitForSingleObject: is not a member of global namespace, yet WaitForSingleObject pops up in the window of available member variables and functions when I type "::", and I am using WaitForSingleObject in several threads that are started by the main Dialog and exist in separate files. I made sure all the #includes matched in the different files. Does anybody know what is going on?
|
|
|
|
|
Gregory Hartmann wrote: I made sure all the #includes matched in the different files
Are you sure Windows.h is included?
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
I did try including Windows.h in the GUI dialog but I still received the same error.
|
|
|
|
|
void earth(float ihl[][], int go[][])
{
}
I found these not working. How to pass these two dimensional arrays into a function?
Thanks
|
|
|
|
|
You could do this -
void earth(float** ihl, int** go)
{
}
|
|
|
|
|
the two parameters of two dimensional arrays are from input. I need to pass them to the function to process. After the process I do not need them. So after the function call, I delete these two arrays.
Do you think I can pass them in a better way ?
Thanks
|
|
|
|
|
mrby123 wrote: So after the function call, I delete these two arrays.
Only if you used new (or malloc() ) to create them. Otherwise, there's nothing to delete.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
You are right. I used "new" created these variables before calling the function, I am planning to delete them after the function call.
Now I need a good way to pass these 2D arrays to the function
Thanks
|
|
|
|