|
I want to make simple dialog based application. What i need is that dialog box appears in an "inactive" state i.e when i run my program from VS IDE, the dialog box goes behind and VS IDE not loose its focus. how can i do so ???
BTW: I've already used ShowWinndow options in OnInitDialog(), but these options not worked in case of Dialog Box
|
|
|
|
|
Create a modeless dialog using Create() and ShowWindow() (see MSDN), and then change the dialog's zorder
"If at any time I announce that a nation or kingdom is to be uprooted, torn down and destroyed, and if that nation I warned repents of its evil, then I will relent and not inflict on it the disaster I had planned. And if at another time I announce that a nation or kingdom is to be built up and planted, and if it does evil in my sight and does not obey me, then I will reconsider the good I had intended to do for it." -- Jeremiah 18:7-10 (God, commenting on the value of the United Nations)
|
|
|
|
|
Hi,
I was going through the DirectSound samples that come with DirectX SDK. In the file dsutil.cpp I came across the following function:
//--------------------------------------------------------------------------
// Name: CSoundManager::SetPrimaryBufferFormat()
// Desc: Set primary buffer to a specified format
// For example, to set the primary buffer format to 22kHz stereo, 16-bit
// then: dwPrimaryChannels = 2
// dwPrimaryFreq = 22050,
// dwPrimaryBitRate = 16
//--------------------------------------------------------------------------
HRESULT CSoundManager::SetPrimaryBufferFormat( DWORD dwPrimaryChannels,
DWORD dwPrimaryFreq,
DWORD dwPrimaryBitRate )
{
HRESULT hr;
LPDIRECTSOUNDBUFFER pDSBPrimary = NULL;
if( m_pDS == NULL )
return CO_E_NOTINITIALIZED;
// Get the primary buffer
DSBUFFERDESC dsbd;
ZeroMemory( &dsbd, sizeof(DSBUFFERDESC) );
dsbd.dwSize = sizeof(DSBUFFERDESC);
dsbd.dwFlags = DSBCAPS_PRIMARYBUFFER;
dsbd.dwBufferBytes = 0;
dsbd.lpwfxFormat = NULL;
if( FAILED( hr = m_pDS->CreateSoundBuffer( &dsbd, &pDSBPrimary, NULL ) ) )
return DXTRACE_ERR( TEXT("CreateSoundBuffer"), hr );
WAVEFORMATEX wfx;
ZeroMemory( &wfx, sizeof(WAVEFORMATEX) );
wfx.wFormatTag = WAVE_FORMAT_PCM;
wfx.nChannels = (WORD) dwPrimaryChannels;
wfx.nSamplesPerSec = dwPrimaryFreq;
wfx.wBitsPerSample = (WORD) dwPrimaryBitRate;
wfx.nBlockAlign = (WORD) (wfx.wBitsPerSample / 8 * wfx.nChannels);
wfx.nAvgBytesPerSec = wfx.nSamplesPerSec * wfx.nBlockAlign;
if( FAILED( hr = pDSBPrimary->SetFormat(&wfx) ) )
return DXTRACE_ERR( TEXT("SetFormat"), hr );
SAFE_RELEASE( pDSBPrimary );
return S_OK;
}
This is called after calling DirectSoundCreate8() and setting the CooperationLevel. Apparantly, this sets the format of the primary buffer. The question that I have is why is the primary buffer released after setting the format? Should we not keep a reference to the primary buffer? Or maybe I am not understanding something here.
Thanks for any help you might be able to provide.
Pankaj
Without struggle, there is no progress
|
|
|
|
|
Ok, I got it. I somehow thought it was destroying the primary buffer. Of course, it was just decrementing the reference count.
It was late at night and I was not thinking. Amazing how a hours of sleep can make you realize how stupid you wer ebefore that
Pankaj
Without struggle, there is no progress
|
|
|
|
|
I show my dialogbox.When i press close,iam closing the dialog box by using func called enddialog.If i open and close the dialog box again and again,the memory size at runtime is increasing.I dont know why.
|
|
|
|
|
Two possible reasons:
1: MFC
2: Your own code
Do you allocate memory or something?
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
Sounds like you're doing this to show your dialog:-
CMyDialog *pDlg = new CMyDialog;
pDlg->DoModal();
if that is the case, make sure that you have:-
delete pDlg;
after the domodal.
But, provided the dialog is modal, you'd be far better off doing:-
CMyDialog dlg;
dlg.DoModal();
becuase then you don't need to delete it.
Jon
Signature space for rent. Apply by email to....
|
|
|
|
|
Tell me please, how can I launch standart microsoft remote access server ( ) programmatically?
|
|
|
|
|
Please, answer me. Don't leave me alone with this problem.
|
|
|
|
|
I want add or del the resources in EXE files. I know I can do it in VC if I have sourcecode. But is there any tool to do this ? Or I can write a easy tool to do this ? Please give me some hints and Thx.
|
|
|
|
|
You can do this in VS6 IDE this way:
1) Call OpenFile dialog from menu File/Open...
2) In Files of type combo select Executable files
3) In Open as combo select Resources
4) After you open the executable file with these settings, you can edit the resources as usual.
5) Save the modified resources back into exe using save.
Watch for copyrights doing it
Pavel
Sonork 100.15206
|
|
|
|
|
Thank you.
|
|
|
|
|
Look for UpdateResource in the MSDN.
Gary R. Wheeler
|
|
|
|
|
I have a dll using MFC7 (.NET)
To export the functions from my class to the dll, I use the keywords __declspec(dllexport) (see code below).
In my class I have a static member.
My problem is that I can't have access to my static member from an external application using the dll. There is the below error:
Application error LNK2020: token not solved (0A000022) ?version@CIO@@2PBDB
How to have access to the static member from an external application????
<br />
class __declspec(dllexport) CIO<br />
{<br />
public: <br />
CIO();<br />
~CIO();<br />
<br />
public:<br />
static const char* version;<br />
<br />
};<br />
|
|
|
|
|
class __declspec(dllimport) CIO
She's so dirty, she threw a boomerang and it wouldn't even come back.
|
|
|
|
|
Usually how people solve this problem is by making a define that gets changed depending on how the DLL is used. Something like this:
<br />
#ifdef CIO_EXPORTS<br />
#define CIO_API __declspec(dllexport)<br />
#else<br />
#define CIO_API __declspec(dllimport)<br />
#endif<br />
So in your project where you compile your DLL, besure to define CIO_EXPORTS, and your class and static members will be exported. In all other cases (like the project where you want to import the DLL) the setting will be set to import those parameters.
Good Luck
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!
|
|
|
|
|
In my application when i right-click on the window i invoke a popup menu.when i click the popup menu, dialog box is displayed.I am not closing my dialog box and i switch to another application.When i click on my application name again in the taskbar, there is no reponse from my application. i have to minimize all my application to open my application again.How to correct this.
|
|
|
|
|
I think it is when you have an modal dialog box open (is it a modal dialog box?).
Then when you as you do to give it focus you can't give it focus because you have an modal dialog box open....
I only think it could be that... I'm not sure!
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
Yes iam using modal Dialog Box.How to create modeless dialog box.
|
|
|
|
|
Step 1 is to look in MSDN.
Step 2,3 and 4 are listed in MSDN.
Signature space for rent. Apply by email to....
|
|
|
|
|
Is the parent window of your popup dialog set?
Pavel
Sonork 100.15206
|
|
|
|
|
I correct that error.Thanks to all
|
|
|
|
|
the gdiplus draw a spline line through some pots,how can i do that fuction
like Graphic::DrawCurve(...)
thanks very much!
ZHANGYIFEI
|
|
|
|
|
Do you mean how you could use a similary function in C++ Win32 API??
Why not use the Graphics object and MC++?
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
i mean how gdi+ do it,i mean gdi+ drawCurve's source!
|
|
|
|