|
thanks for ur idea.
please first tell me how to create directories at runtime.the directory name sholud be same like the filename.
so if i open rocky file,a directory should be created with the name rocky.
cheers
sangeet
|
|
|
|
|
When you are creating the directory using the _mkdir function store that string into the path of the filename before creating the file in that specific directory.Use the convention of "..\\..\\ " of creating the path dynamically where you want to store the file. Otherwise you can also save that specific path somewhere in the registry
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
ramyasangeet wrote: I need to get only its name not with extension(like race) and store this in fname.
Use PathRemoveExtension() .
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
Hi everybody. I'm wondering if there is a way to work around the WM_ACTIVATE message. I want to disable a window so that when the user clicks on it, it won't come in the foreground.
Unfortunately, the DisableWindow() API is not good because when clicking a disabled window you get that annoying sound on some systems (default sound that Windows makes).
So is there any other way? I tried messing with the parameters of WM_ACTIVATE before caling the DefWindowProc but it seems to be of no help. Apparently the kernel moves the window to foreground regardless and simply notifies me, the user. I can send it back to the background if I wish, but that causes an annoying visual effect each time the window is clicked... a sort of flicker.
-= E C H Y S T T A S =-
The Greater Mind Balance
Blending C++ with COM ^
|
|
|
|
|
If you want to show/hide window. Then why don't you try
ShowWindow()API.
SW_HIDE - For Hiding window
SW_SHOW - For Showing it.
The secret of life is not enjoyment
but education through experience.
- Swami Vivekananda.
|
|
|
|
|
I want to hide it under another, not completely ::- ).
-= E C H Y S T T A S =-
The Greater Mind Balance
Blending C++ with COM ^
|
|
|
|
|
Axonn Echysttas wrote: So is there any other way? I tried messing with the parameters of WM_ACTIVATE before caling the DefWindowProc but it seems to be of no help. Apparently the kernel moves the window to foreground regardless and simply notifies me, the user. I can send it back to the background if I wish, but that causes an annoying visual effect each time the window is clicked... a sort of flic
What about simply returining form Window OnClick message!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
This is not an MFC application. As for returning from WM_LBUTTONDOWN or WM_LBUTTONUP, it ain't helpin'. When I press the button on the window, it jumps back in the foreground. I want it to stay back, just like it would be disabled.
Practically, I want a disabled window, but without that sound that the system makes on usually disabled windows.
-= E C H Y S T T A S =-
The Greater Mind Balance
Blending C++ with COM ^
|
|
|
|
|
Does creating it with WS_EX_NOACTIVATE help?
|
|
|
|
|
Not really. But thanks anyway. I found the solution. If anybody is interested, here is the answer:
On WM_MOUSEACTIVATE return MA_NOACTIVATE;
On WM_ACTIVATE return 1.
Do not call DefWindowProc (in both cases).
-= E C H Y S T T A S =-
The Greater Mind Balance
Blending C++ with COM ^
|
|
|
|
|
Dear All,
I have an owner-drawn list box.
it well working now. when I scroll down to end. there is some space looks vaccant. can we color that area? or how can we ingnore that?
-Sarath
|
|
|
|
|
May be that you are adding some empty strings to the list box somewhere in the code. Post the code so that someone here can check it.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
hi Dear.
thanks I got the solution.
the problem was, i was drawing items with black background, but after the last element, the control drawing its background in white(at vaccant space).
i have solved it using following code.
HBRUSH CProtocolListBox::CtlColor(CDC* pDC, UINT nCtlColor)
{
HBRUSH hbr = NULL;
if (nCtlColor == CTLCOLOR_LISTBOX)
{
hbr = m_hbrCtlBgColor;
}
pDC->SetBkMode(TRANSPARENT);
// TODO: Return a non-NULL brush if the parent's handler should not be called
return hbr;
}
-Sarath
|
|
|
|
|
My 5 for taking the time to post the solution. Thanks.
~RaGE();
|
|
|
|
|
Hi,
I am always confused while using typedefs. I know that by using something like
typedef int number
an alias is creaed for int. But when complex typedefs are defined like the ones below, I get confused.
typedef std::map < short,_bstr_t >::iterator Iterator;
typedef COneValueCommand < short, 0 > COneIntegerCommand;
Could someone explain me the above definations
-- modified at 5:51 Tuesday 16th May, 2006
|
|
|
|
|
koumodaki wrote: typedef std::map < short,_bstr_t >::iterator Iterator;
It simply make an alias for std::map < short,_bstr_t >::iterator (you just have to use Iterator , which is shorter).
Same goes for
typedef COneValueCommand < short, 0 > COneIntegerCommand;<br /> , you can use COneIntegerCommand
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
Here's how I think of it. The following is how you declare an integer:
int ANumber;
The same thing but with a typedef added to the front declares a synonym. i.e.
typedef int ANumber;
Another example:
std::list<int> AListOfInts;
But this declares a synonym:
typedef std::list<int> AListOfInts;
Steve
|
|
|
|
|
koumodaki wrote: typedef std::map::iterator Iterator;
now instead of using >std::map::iterator< for declaring any variable, one can use Iteratoe in place of that!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
The typedef's are used to behave the UDT(User defined Data types) like inbuild data types
as well the code overheads are minimized and one can easily change the datatype through out the scope of the typedef
for e.g.
typedef std::map < short,_bstr_t >::iterator Iterator
here Iterator represent's std::map < short,_bstr_t >::iterator
Knock out 'T' from CAN'T ,
You 'CAN' if you think you 'CAN'
|
|
|
|
|
Hi thanks for the response. I have found the following code snippet from a website:
class CSimSerial
{
public:
virtual ~CSimSerial(){}
//some more virtual functions
};
typedef CSimSerial *(*GET_SIM_INTF_CREATOR)(void);
The typedef in here created an alias for the class and can be used to create objects. But what purpose would the double pointer and void serve?
-- modified at 8:07 Tuesday 16th May, 2006
|
|
|
|
|
If you use the rule I gave it's easy to figure out. First remove the typedef and see what it means:
CSimSerial* (*GET_SIM_INTF_CREATOR)(void);
Note that I've adjusted the formatting slightly. This would declare a variable called "GET_SIM_INTF_CREATOR" which is a pointer to a function which returns a "CSimSerial*" and takes no parameters.
So with the typedef on the front:
typedef CSimSerial* (*GET_SIM_INTF_CREATOR)(void);
This creates an alias called "GET_SIM_INTF_CREATOR" for a pointer to a function which returns a "CSimSerial*" and takes no parameters.
Steve
|
|
|
|
|
Hi,
I have developed the program that record a AVIs and the program that record sound to wav file,
Now I want to develop a other program to merge AVIs and wav file to avi with sound,
Have anybody know how to do this? Please help me!
The follow are some my code:
The separate module that record just avis (no sound) worked well
//Add Frame to avi file
bool CAVIUtil::AddFrame(HBITMAP hBitmap)
{
BITMAPINFO bmpInfo;
bmpInfo.bmiHeader.biBitCount = 0;
bmpInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
GetDIBits(m_hAviDC, hBitmap, 0, 0, NULL, &bmpInfo, DIB_RGB_COLORS);
bmpInfo.bmiHeader.biCompression = BI_RGB;
GetDIBits(m_hAviDC, hBitmap, 0, bmpInfo.bmiHeader.biHeight, m_lpBits, &bmpInfo, DIB_RGB_COLORS);
if (FAILED(AVIStreamWrite(m_pAviCompressedStream, m_lSample++, 1, m_lpBits, bmpInfo.bmiHeader.biSizeImage, 0, NULL, NULL)))
{
strcpy(m_szErrorMessage, "AppendFrameUsual(): AVIStreamWrite failed");
return (false);
}
return (true);
}
The record wav and record avi run with two other thread, when they finished I just add the follow code to add them togetther, but it can not play(seem to wrong format).
HRESULT CAVIUtil::AddAviWav(const char *src)
{
char *buf=0; WavChunk *wav = (WavChunk*)src;
HANDLE hf=CreateFile(src,GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,0,NULL);
if (hf==INVALID_HANDLE_VALUE) {
MessageBox(NULL,"AVIERR_FILEOPEN","ERROR",MB_OK);
return AVIERR_FILEOPEN;
}
DWORD size = GetFileSize(hf,NULL);
buf = new char[size];
DWORD red; ReadFile(hf,buf,size,&red,NULL);
CloseHandle(hf);
wav = (WavChunk*)buf;
// check that format doesn't clash
bool badformat=false;
if (m_wfx.nChannels==0)
{ m_wfx.wFormatTag=wav->fmt.wFormatTag;
m_wfx.cbSize=0;
m_wfx.nAvgBytesPerSec=wav->fmt.dwAvgBytesPerSec;
m_wfx.nBlockAlign=wav->fmt.wBlockAlign;
m_wfx.nChannels=wav->fmt.wChannels;
m_wfx.nSamplesPerSec=wav->fmt.dwSamplesPerSec;
m_wfx.wBitsPerSample=wav->fmt.wBitsPerSample;
}
else
{
if (m_wfx.wFormatTag!=wav->fmt.wFormatTag) badformat=true;
if (m_wfx.nAvgBytesPerSec!=wav->fmt.dwAvgBytesPerSec) badformat=true;
if (m_wfx.nBlockAlign!=wav->fmt.wBlockAlign) badformat=true;
if (m_wfx.nChannels!=wav->fmt.wChannels) badformat=true;
if (m_wfx.nSamplesPerSec!=wav->fmt.dwSamplesPerSec) badformat=true;
if (m_wfx.wBitsPerSample!=wav->fmt.wBitsPerSample) badformat=true;
}
if (badformat) {if (buf!=0) delete[] buf;
MessageBox(NULL,"AVIERR_BADFORMAT","ERROR",MB_OK);
return AVIERR_BADFORMAT;
}
//
// create the stream if necessary
if(m_pAudioStream==0){
AVISTREAMINFO ahdr; ZeroMemory(&ahdr,sizeof(ahdr));
ahdr.fccType=streamtypeAUDIO;
ahdr.dwScale=m_wfx.nBlockAlign;
ahdr.dwRate=m_wfx.nSamplesPerSec*m_wfx.nBlockAlign;
ahdr.dwSampleSize=m_wfx.nBlockAlign;
ahdr.dwQuality=(DWORD)-1;
HRESULT hr = AVIFileCreateStream(m_pAviFile,&m_pAudioStream, &ahdr);
if (hr!=AVIERR_OK) {if (buf!=0) delete[] buf; return hr;}
hr = AVIStreamSetFormat(m_pAudioStream,0,&m_wfx,sizeof(WAVEFORMATEX));
if (hr!=AVIERR_OK) {if (buf!=0) delete[] buf;return hr;}
}
// now we can write the data
unsigned long numbytes = wav->dat.size;
unsigned long numsamps = numbytes*8 / m_wfx.wBitsPerSample;
HRESULT hr = AVIStreamWrite(m_pAudioStream,m_lSample,numsamps,wav->dat.data,numbytes,0,NULL,NULL);
if (buf!=0) delete[] buf;
if (hr!=AVIERR_OK) {
MessageBox(NULL,"AVIERR_OK","ERROR",MB_OK);
return hr;
}
m_lSample+=numsamps;
MessageBox(NULL,"AVIS_OK","S_OK",MB_OK);
return S_OK;
}
Please help me soon if you can
Thank in advance
|
|
|
|
|
I m using ATL Service to start another Application, problem is that Application is executed but its Window not appears. If I use another application to start this application then it working properly. Plz, tell me if anyone knows this problem
STARTUPINFO siStartupInfo;
PROCESS_INFORMATION piProcessInfo;
memset(&siStartupInfo, 0, sizeof(siStartupInfo));
memset(&piProcessInfo, 0, sizeof(piProcessInfo));
siStartupInfo.cb = sizeof(siStartupInfo);
CreateProcess
(L"D:\\TestingApplication\\DialogTest\\Debug\\DialogTest.exe",0,0,0,false, CREATE_DEFAULT_ERROR_MODE,0,0,&siStartupInfo,&piProcessInfo);
Musharraf Hussain
|
|
|
|
|
Hi ppl,
I am writing a simple TCP chat app in MFC c++ (dialog based), using two threads - one for listening and acceping and another one is for receiving and sending. The problem actualy occurs when I close (click on OK or Cancel) while some thread is running. I get an assert or/and unhandled exception pointing to a my code or some code inside dbgheap.c (Ln 1974: if (_BLOCK_TYPE(pHead->nBlockUse) >= 0 && _BLOCK_TYPE(pHead->nBlockUse) < _MAX_BLOCKS) )
I suspect something about threads that are still running, though I tried to end them with TerminateThread and ExitThread. Please help.
|
|
|
|
|
Don't use TerminateThread or ExitThread to stop your thread. Instead, use a flag to signal that the thread should stop:
while (bThreadActive)
{
}
Then, when you want to stop this thread (through your main thread), set this variable to false and wait[^] for the thread to finish.
Cédric Moonen
Software developer
Charting control
|
|
|
|
|