|
Hello Friends,
Whenever my application is starting it is giving a beep sound which I don't require it. please help me regarding this problem. I am present the code which I am having in InitInstance() of App class.
BOOL CMMTRansApp::InitInstance()
{
AfxEnableControlContainer();
AfxInitRichEdit();
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
// Change the registry key under which our settings are stored.
// TODO: You should modify this string to be something appropriate
// such as the name of your company or organization.
SetRegistryKey(_T("Local AppWizard-Generated Applications"));
LoadStdProfileSettings(); // Load standard INI file options (including MRU)
// Register the application's document templates. Document templates
// serve as the connection between documents, frame windows and views.
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MMTRANS_MENU,
RUNTIME_CLASS(CMMTRansDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CMMTRansView));
AddDocTemplate(pDocTemplate);
// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
// Dispatch commands specified on the command line
//AfxMessageBox("Test");
if (!ProcessShellCommand(cmdInfo))
return FALSE;
//AfxMessageBox("Test1");
// The one and only window has been initialized, so show and update it.
m_pMainWnd->ShowWindow(SW_SHOWMAXIMIZED);
// Setting the window title
((CMainFrame*)AfxGetMainWnd())->SetWindowTitle();
......
}
When I debugged I got known that the beep is coming when ProcessShellCommand(cmdInfo) condition is checked. But when I am having other applications it is not giving me the beep sound. So I want to solve this beep sound problem in my actual application.
Thanks in Advance.
Neelesh K J Jain.
|
|
|
|
|
Neelesh K J Jain wrote:
When I debugged I got known that the beep is coming when ProcessShellCommand(cmdInfo)...
So have you stepped into it to see what code is causing the beep?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I am building an application with embeded property pages in a dialog (CDialog)
Here is how i have done it;
Following code is in the OnInitDialog
m_PSheet=new CPropertySheet("Hello"); // Hello appears no where
// Adding two property pages CPropertyPage
m_PSheet->AddPage(&m_p1);
m_PSheet->AddPage(&m_p2);
//Modeless
m_PSheet->Create(this,WS_CHILD,NULL);
m_PSheet->ShowWindow(TRUE);
Each propertypage contains a button which simply displays Message from Page 1
or page2.
Both pages work absolutely fine as long there is no control on main dialog but if i add a button on main dialog; then pressing button on property pages losts the program (Hangs); the button on main dialog works fine;
I want all controls on property pages and as well as on main dialog working.
Please help;
|
|
|
|
|
What I did for adding a CPropertySheet on a dialog is that first of all I added a Picture control on the dialog which was of the same size as that of the property sheet. I named that picture control as IDC_PROPSHEET and then I added a member variable named m_dlgPropSheet of the type of CPropertySheet. Then in OnInitDialog i did the following steps, after adding pages in Sheet.
m_dlgPropSheet.Create(this,WS_CHILD|WS_VISIBLE,0);
m_dlgPropSheet.ModifyStyleEx(0,WS_EX_CONTROLPARENT);
m_dlgPropSheet.ModifyStyle( 0, WS_TABSTOP );
CRect rcSheet;
GetDlgItem(IDC_PROPSHEET)->GetWindowRect(&rcSheet);
ScreenToClient( &rcSheet );
m_dlgPropSheet.SetWindowPos(NULL,rcSheet.left-7, rcSheet.top-7, 0, 0,SWP_NOZORDER|SWP_NOSIZE|SWP_NOACTIVATE );
Try doing this, Hope it would help.
Still Alone in this beautiful world
My Articles
|
|
|
|
|
Thank u very much ur code has solved my problem,
Infact the difference between ur and my code is of the following two lines,
adding them in my code has solved my problem; I have not changed my remaining code.
m_PSheet.ModifyStyleEx(0,WS_EX_CONTROLPARENT);
m_PSheet.ModifyStyle( 0, WS_TABSTOP );
According to MSDN.
WS_EX_CONTROLPARENT Allows the user to navigate among the child windows of the window by using the TAB key
How simply changing style to WS_EX_CONTROLPARENT solved it ? please desribe.
|
|
|
|
|
You are right. I used Picture control just for sizing it properly at my required position.
AFAIK, WS_EX_CONTROLPARENT enables a control to be controlled by the parent. Since there is not a direct method to add CPropertySheet directly over a CDialog, therefore, I guess, we need to do this through this approach. I am not sure about its exact reason myself.
Still Alone in this beautiful world
My Articles
|
|
|
|
|
One thing more;
I think u have used Picture control only for sizeing, and it has nothing to do with real problem.
|
|
|
|
|
Obviously you are missing the PSheet point - it is not to be used in Dialog (at least normally). PSheet was designed to be used on itself only, providing general dialog with pages - I guess this is the reason you have problems. If you want to have dialog with pages among other controls, you will have to add it manually by adding tab control and managing tab switches yourself.
I do have a class for this, if someone would be interested I could try to make an article on CP on with it.
Igor Green
http://www.grigsoft.com
Compare It! + Synchronize It! : Files and folders comparison never was easier!
|
|
|
|
|
Thanks for reply
I was also thinking that property pages are not working because of CDialog; but surprisingly they have. If u have time then please look the above solution provided by "Amir Butt" simply by changing style to "WS_EX_CONTROLPARENT" solved the problem; i.e. embeded propertypages in a dialog where as controls on pages and dialog are working fine.
If u know what magic WS_EX_CONTROLPARENT has done then please describe.
I could try to make an article on CP on with it.
That will be a great greatness.
|
|
|
|
|
This Api Will Help you
DWORD GetModuleFileName(
HMODULE hModule,
LPTSTR lpFilename,
DWORD nSize
);
pass HWND to First parameter.
"I Think this Will Help"
Alok Gupta visit me at http://www.thisisalok.tk
|
|
|
|
|
That won't work. The first parameter is a module handle (an HMODULE ), not a window handle (an HWND ).
Software Zen: delete this;
|
|
|
|
|
With All Due Respect
we Can Type Cast HMODULE with HWND
like
HWND hWnd=this->m_hWnd;
char Filename[200];
GetModuleFileName((HMODULE)hWnd,Filename,199);
"I Think this Will Help"
Alok Gupta visit me at http://www.thisisalok.tk
|
|
|
|
|
That doesn't change the fact that the underlying object for an HMODULE is a module, and an HWND is a window. If you can get away with the type cast, and Windows returns useful information, that's fine. I wouldn't rely on this working in the future, however. This would be an undocumented behavior for the GetModuleFileName API function.
Why not use the correct function: GetWindowModuleFileName() [^]
Software Zen: delete this;
|
|
|
|
|
Sir,With All Due respect,
Correct me if i am wrong
Both HWND and HMODULE are 32 bit Unsigned Long or DWORD
"I Think this Will Help"
Alok Gupta visit me at http://www.thisisalok.tk
|
|
|
|
|
That's true. In Windows, a handle is a token that is used by to identify a specific object. An HWND therefore identifies a window, while an HMODULE identifies a module. When you pass an HWND when Windows expects an HMODULE , it will attempt to use a window handle to identify a module.
For example, let's suppose that handles are implemented as an index within an array. An HWND with the value of 11 would therefore specify the 11th window in the system. An HMODULE with the value of 11 would specify the 11th module in the system. The two aren't related, and you aren't going to get the results you want.
There's an even more obvious example. Suppose that handles are implemented as pointers to a structure. An HWND would therefore point to a structure that defines a window, while an HMODULE would point to a structure for a module. Passing one for the other would obviously have poor results.
While Window handles aren't implemented this way (as far as I know), you should treat them as opaque entities. This implies that, if an API function calls for a handle of a given type, you will only get the expected behavior if you pass a valid handle of that type. If you use a type cast to force the call to receive a handle of another type, then the results are unpredictable.
Software Zen: delete this;
|
|
|
|
|
Yeah Thanks Sir,
Now i understand Difference Between TWO.
Thanks Again
"I Think this Will Help"
Alok Gupta visit me at http://www.thisisalok.tk
|
|
|
|
|
|
you are right about the discussion of HWND and HMODULE. i have got the module name though the GetWindowModuleFileName but it gives the dll file name that explorer.exe is using not the explorer.exe filename.The question is how to get explorer.exe
|
|
|
|
|
Exactly where do u calling this GetWindowModuleName() from a DLL or EXE.
If you are calling from DLL:
Use NULL in Place of HWND or Module , which ever you like
char lpFileName[201];
::GetModuleFileName(NULL,lpFileName,200);
Sorry Sir Gary, from Next time I will use GetWindowModuleName() api.
"I Think this Will Help"
Alok Gupta visit me at http://www.thisisalok.tk
|
|
|
|
|
Hello friends ,
I have a problem in creating dialog boxes, Which has buttons (are created dynamically) and when i click On a button Draw line between two buttons i.e (void DrawLine(int FromButtonId , int ToButtonId) is a function to place the line between the two buttons. I draw the line by setting flags to the Drawline button. the function creates the line but i doesn't view the line when i minimise the dialog box i can able to see the line..after the maximizing the dialog window, I use the Invalidate() function,but it clears all buttons in the dialog box and the line is placed in appropriate position and it blinks..
but i want to place the line as well as buttons in the desired positions.
so plz help me what to do. and how to do..
thanks in advance .
Surya Prakash
|
|
|
|
|
You have to make a logic to do all above in the OnPaint function that takes care of looks of dialog, doing in OnPaint also solves the problem caused by minimizing the dialog.
|
|
|
|
|
how can I create emulator microphone device to play audio file throught it and save in my sound file format?
somebody give me an idea, thanks!!!
Nho'c Ti`
|
|
|
|
|
I think u should look for File format converter.
|
|
|
|
|
Hello!
This is my first post to this forum and english is not my mother tongue, hope you understand me.
I have the following expression
(?:<b>)?(.+?)(?:</b>)
and the string
<b>test</b>
. I am using regex_search function and the match I get is "<b>test". But the first part of the expression "(?:<b>)?" should be greedy, and the "<b>" at the beginning should not be in the match. Am I right?
How should I write the expression to get "test" without "<b>" as the match?
I want to read a word from a webpage, and this word may be between "<b>" and "</b>", but it doesn't have to. This expression is part of a bigger project (part of a bigger expression).
You can download the source code and exe from here http://www.icpnet.pl/~arekrob/regexp2.rar .
Are there any tools to help writing regular expressions compatible with boost regex library?
|
|
|
|
|
try this tool, it's terrific:
http://www.codeproject.com/dotnet/Expresso.asp
About the expression:
I'd use this as an expression:
[<b>]?(.+)?[</b>]?
-- modified 12-Sep-18 21:01pm.
|
|
|
|