|
Solved!
Me stupid! My clock was one month behind... wrong date.
Thanks a lot.
|
|
|
|
|
That was a new cause of the problem (for me)!
But of course, it can give the same results.
I'm glad to be able to assist you.
Have a Happy easter, in case you celebrate it. Else, have a nice spring.
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
Hi all
How to get the total time of a wav file.
Please help me
|
|
|
|
|
Perhaps looking through the WAV format[^] would be of help, or maybe a quick search[^].
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
Thanks for the reply
If i am having the forumala
Sampling rate * Bits Per Sample * Channels)/(Bits Per Byte) = Bytes Per Second.
eg If we are playing audio at 44,100Hz and we have 16 bit audio and 2 channels,
Collapse
(44100 * 16 * 2)/8 = 176400 Bytes Per Second
Is there is any use.
I can read the file size also from the header.
But what i actually need is the total time of the wav file.From header data, Is there is any method for calculating this or
Is there is any MFC classes for handling multimedia so that i can use any functions for getting the time period.
|
|
|
|
|
Deepu Antony wrote: Is there is any use.
I believe the formula is:
FileSize / (SampleRate * BytesPerSample)
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
That information i got from code project article
[^]
|
|
|
|
|
Thanks for giving your time.It was very easy.
The only thing has to do is to get the length of file name and divide it by bytes per second.
int length =file.GetLength()-44;//Header size
int dwTotSeconds =length/16000; //16000 bytes per second.
|
|
|
|
|
Hi all,
In my application for buttons control,i use the property Owner Draw for buttons and drive the variable of this button from CBitmapButton class.
and use image over the button control.
but here tabstop is not working.
please tell me Tabstop not working on buttons if i used image over it.
thanks in advance.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
If I can rephrase you question...
When I used a normal button, pressing TAB on my dialog selected the button.
I have changed to an ownerdraw style, and TAB no longer selects my button?
If that is a reasonable summary, then I bet you're wrong - I bet that the tab button is still fine, and if you press SPACE, the button will still work - BUT it's not drawing itself in a selected state. But that's your job now. You said "I'll draw you!".
The button will send a WM_DRAWITEM message, and that will point to a DRAWITEMSTRUCT structure.
DRAWITEMSTRUCT::itemState is a variable with bits used as flags, so you can do:
if (dis->itemState & ODS_SELECTED)
{
}
in your drawing routine.
Hope that helps,
Iain.
In the process of moving to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), give me a job!
|
|
|
|
|
Hello everyone,
First time post here so please be lenient.
My question is in regards to a C++ syntax problem. I am trying to make a standard (DOS) program that can capture TCP/IP traffic. This will be an academic project between a friend and I.
Question is this; how do we go about getting the program to interface with the Layer 3 (network layer) to capture TCP/IP traffic?
We are also trying to figure out how to retrieve device properties and display them in the terminal. Information such as a standard input “ipconfig” to display the network adapter’s information.
This entire program will be in C++, using N++ for a editor and Dev++ for a compiler.
Please if there is any required reading you would recommend, please include it in your response.
Thank you very much in advance,
V/R
Rob&Big
|
|
|
|
|
it looks like you're attempting to write a driver/system like this :- http://www.winpcap.org/[^]
rbwest86 wrote: C++ syntax problem
dont understand what you mean here
rbwest86 wrote: standard (DOS) program
huh ? do you mean a console-mode executable ?
It really depends on what the purpose of the exercise is - you can waste a lot of time writing something as good as winpcap yourselves, and/or its cousin 'WireShark' for viewing the data
rbwest86 wrote: We are also trying to figure out how to retrieve device properties and display them in the terminal.
c'mon - google for it - there's plenty of examples out there, even some here on CP
|
|
|
|
|
Welcome to codeproject!
To echo Garth a bit:
c++ syntax has nothing to do with this. That's things like "How do I make a for loop", not "how do I access hardware to grab TCP/IP data".
Next, do you *really* mean DOS? Those installation disks must have been very dusty...
If you mean "I'm running windows, but I don't know about messages and things, so I just want a console program", then codeproject can help you.
Have a look in:
http://www.codeproject.com/KB/IP/[^]
I can see three articles in as many seconds, searching for "sniff":
Statistic consol sniffer – no driver installation is needed[^]
WinSniff :The packet capturing application for Windows[^]
Sniffing using Winsock[^]
That should keep you going a little while.
Other search term you might want to use is: "promiscuous". It's what a network card that's listening to *everything* is called.
Good luck,
Iain.
In the process of moving to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), give me a job!
|
|
|
|
|
Well after reading a lot about this topic, I have found that this covers a different side of programming I am unfamiliar with.
I have read countless source codes all using winsock.h and have no idea how to properly use this.
Would there be a good tutorial around here explaining C++ programming in conjunction with Networking? I am more familiar with a different aspect of C++.
Thank you again for all the help.
V/R
Rob
|
|
|
|
|
If you are doing what I think you're doing, and writing an application to look at all network traffic passing your computer, then the subject is just plain difficult.
If you are wanting client / server software to talk between computers, then it's a lot easier. Just look in the networking section of codeproject, and there;s a whole range of articles there, from simple chat between 2 pc programs, to full fledged servers.
Either way, it's not an easy topic!
Good luck,
Iain.
In the process of moving to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), give me a job!
|
|
|
|
|
Ok, so I have done more reading.
I have been reading about winsocks. I due have a question. Here is the code I have been piecing together. Can someone please tell me what I am doing wrong? I get a compiling error "using Dev++" on line 105. I know I am new to programming with sockets but I need a little guidance. I am stationed in Iraq and there is no reference other than feedback from this forum. Thank you very much in advance.
Errors:
Compiler: Default compiler
Building Makefile: "C:\Users\mininet\C++\socket programming\Makefile.win"
Executing make...
make.exe -f "C:\Users\mininet\C++\socket programming\Makefile.win" all
g++.exe -c main.cpp -o main.o -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include"
main.cpp:105: error: expected constructor, destructor, or type conversion before '=' token
main.cpp:105: error: expected `,' or `;' before '=' token
main.cpp:106: error: expected unqualified-id before "if"
main.cpp:106: error: expected `,' or `;' before "if"
main.cpp:115: error: expected unqualified-id before "if"
main.cpp:115: error: expected `,' or `;' before "if"
main.cpp:130: error: expected unqualified-id before "if"
main.cpp:130: error: expected `,' or `;' before "if"
make.exe: *** [main.o] Error 1
Execution terminated
------------------------------------------------------------------------------------
Here is the source I am working with.
#include <windows.h><br />
#include <winsock.h><br />
#include <iostream><br />
<br />
<br />
LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);<br />
<br />
<br />
char szClassName[ ] = "WindowsApp";<br />
<br />
int WINAPI WinMain (HINSTANCE hThisInstance,<br />
HINSTANCE hPrevInstance,<br />
LPSTR lpszArgument,<br />
int nFunsterStil)<br />
<br />
{<br />
HWND hwnd; <br />
MSG messages; <br />
WNDCLASSEX wincl; <br />
<br />
<br />
wincl.hInstance = hThisInstance;<br />
wincl.lpszClassName = szClassName;<br />
wincl.lpfnWndProc = WindowProcedure; <br />
wincl.style = CS_DBLCLKS; <br />
wincl.cbSize = sizeof (WNDCLASSEX);<br />
<br />
<br />
wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);<br />
wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);<br />
wincl.hCursor = LoadCursor (NULL, IDC_ARROW);<br />
wincl.lpszMenuName = NULL; <br />
wincl.cbClsExtra = 0; <br />
wincl.cbWndExtra = 0; <br />
<br />
wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND;<br />
<br />
<br />
if (!RegisterClassEx (&wincl))<br />
return 0;<br />
<br />
<br />
hwnd = CreateWindowEx (<br />
0, <br />
szClassName, <br />
"Windows App", <br />
WS_OVERLAPPEDWINDOW, <br />
CW_USEDEFAULT, <br />
CW_USEDEFAULT, <br />
544, <br />
375, <br />
HWND_DESKTOP, <br />
NULL, <br />
hThisInstance, <br />
NULL <br />
);<br />
<br />
<br />
ShowWindow (hwnd, nFunsterStil);<br />
<br />
<br />
while (GetMessage (&messages, NULL, 0, 0))<br />
{<br />
<br />
TranslateMessage(&messages);<br />
<br />
DispatchMessage(&messages);<br />
}<br />
<br />
<br />
return messages.wParam;<br />
}<br />
<br />
<br />
<br />
<br />
LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)<br />
{<br />
switch (message) <br />
{<br />
case WM_DESTROY:<br />
PostQuitMessage (0); <br />
break;<br />
default: <br />
return DefWindowProc (hwnd, message, wParam, lParam);<br />
}<br />
<br />
return 0;<br />
}<br />
<br />
<br />
int (PASCAL FAR * lpfn_recv)(SOCKET, char FAR *, int, int);<br />
int (PASCAL FAR * lpfn_send)(SOCKET, char FAR *, int, int);<br />
int (PASCAL FAR * lpfn_WSAStartup)(WORD, LPWSADATA);<br />
int (PASCAL FAR * lpfn_WSACleanup)(void); <br />
int (PASCAL FAR * lpfn_WSAGetLastError)(void); <br />
<br />
OFSTRUCT stFile; <br />
HFILE hFile; <br />
HINSTANCE hWinSockDLL = 0; <br />
<br />
#ifdef WIN32 <br />
<br />
hFile = OpenFile("wsock32.dll", (OFSTRUCT FAR*)&stFile,OF_EXIST); <br />
if (hFile != HFILE_ERROR) <br />
hWinSockDLL = LoadLibrary ("wsock32.dll");<br />
#else<br />
<br />
hFile = OpenFile("winsock.dll", (OFSTRUCT FAR*)&stFile,OF_EXIST); <br />
if (hFile != HFILE_ERROR) <br />
hWinSockDLL = LoadLibrary ("winsock.dll");<br />
#endif <br />
<br />
if (hWinsockDLL >= 32) { <br />
(FARPROC)lpfn_recv = GetProcAddress (hWinsockDLL,"recv");<br />
(FARPROC)lpfn_send = GetProcAddress (hWinsockDLL,"send");<br />
(FARPROC)lpfn_WSAStartup = GetProcAddress(hWinSockDLL,"WSAStartup");<br />
(FARPROC)lpfn_WSACleanup = GetProcAddress(hWinSockDLL,"WSACleanup"); <br />
(FARPROC)lpfn_WSAGetLastError = GetProcAddress(hWinsockDLL,"WSAGetLastError");<br />
<br />
<br />
if (!lpfn_recv | !lpfn_send | !lpfn_WSAStartup | <br />
!lpfn_WSACleanup | !lpfn_WSAGetLastError) { <br />
FreeLibrary (hWinSockDLL); <br />
hWinSockDLL = 0; <br />
} <br />
} <br />
<br />
if (!hWinSockDLL) { <br />
MessageBox (hwnd, "Unable to load winsock.dll","Error"); <br />
} <br />
<br />
|
|
|
|
|
I have some problems when porting a WIN32 project into 64-Bit using VS2008.
1. I am using many third party libraries in my WIN32 project in which one of them uses old iostream functions. It gives me linker error LNK1104: cannot open file 'LIBCIMT.LIB' when I compile in X64 mode. I have the source code of the library with me. I tried recompiling the third party library using the new iostream header files under VS2008, but it gives me compilation errors which seems to be some in-compatibility issues of new and old iostreams.
2. In my project, I use both SQL and MAPI. The project compiles and runs perfectly in WIN32 mode. But the same gives me compilation error C2371: 'BOOKMARK' : redefinition; different basic types
Here is a sample code to reproduce the problem.
#include "stdafx.h"
#include <comdef.h>
#include <atlbase.h>
#include <sqlext.h>
#include <mapix.h>
int _tmain(int argc, _TCHAR* argv[])
{
return 0;
}
All the header files are from the VS2008 installation folder.
How do I solve these problem with minimal changes in my code
Thanks in advance
cheers
Varghese Paul
|
|
|
|
|
Varghese Paul M wrote: 1. I am using many third party libraries in my WIN32 project in which one of them uses old iostream functions. It gives me linker error LNK1104: cannot open file 'LIBCIMT.LIB' when I compile in X64 mode. I have the source code of the library with me. I tried recompiling the third party library using the new iostream header files under VS2008, but it gives me compilation errors which seems to be some in-compatibility issues of new and old iostreams.
That sounds about right. I suspect you're going to have to bite the bullet & just start going through them, fixing them.
One thing to remember is that (IIRC) old iostreams weren't in the std namespace, new ones are. Also - this page has some handy migration hints[^].
Varghese Paul M wrote: 2. In my project, I use both SQL and MAPI. The project compiles and runs perfectly in WIN32 mode. But the same gives me compilation error C2371: 'BOOKMARK' : redefinition; different basic types
Here is a sample code to reproduce the problem.
You were lucky before. MAPI and SQL both define BOOKMARK. They happened to both be 32-bit, but now they're not. The only things I can suggest are 1) separating SQL and MAPI functionality into separate source files, or 2) putting (say) the MAPI stuff into a namespace like this:
namespace MAPI
{
#include <mapix.h>
}
and either using using namespace MAPI; or explicitly identifying things in this new MAPI namespace.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
How to reduce the Video capture size using Filters
|
|
|
|
|
Hai!
I have an MFC application in which if i press a button, a message box pops up. In that message box i have to display the Error message and caption so i am using MessageBox () instead of AfxMessageBox () since in AfxMessageBox () i cannot specify the caption.
Now the problem with MessageBox () is for as many times I press the button that many time the message box pops up, but if i use AfxMessage box it pops up once unless i respond to it i am not able to press the button in the main dialog.
So i need in this format i want to display the error message, its caption but unless user responds to that message box i must not be able to press the button as it happens in AfxMessageBox ().
I tried with the following, but still multiple messagebox pops up if i continously press the button in main dialog
MessageBox ("This error is due to XYZ", "Error", MB_ICONERROR | MB_APPLMODAL);
Thanks!
|
|
|
|
|
Thanks !
I got the solution !
|
|
|
|
|
Of whom?
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
Is the solution secret? Other people may learn from it...
My guess is you didn't have the parent window of the ::MessageBox set - Just NULL isn't good enough.
Do I get a prize?
Iain.
In the process of moving to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), give me a job!
|
|
|
|
|
windows api function MessageBox yes, AfxMessageBox function MFC Yes
|
|
|
|
|
MessageBox ("This error is due to XYZ", "Error", MB_ICONERROR | MB_APPLMODAL); (YOURS)
MessageBox ("This error is due to XYZ", "Error", MB_ICONERROR | MB_SYSTEMMODAL); (MINES)
The only difference between applmodal and systemmodal is systemmodal is given TOPMOSTWINDOW also, therefore, you would have to manually give focus back to the main application before pressing XYZ, or whatever it is first
|
|
|
|
|