|
hi
if i remove the typecast the following error will come:
error C2664: 'PlaySoundW' : cannot convert parameter 1 from 'const char [12]' to 'LPCWSTR'
If i use _T("c:\\tada.wav"): error C3861: '_T': identifier not found
The file tada.wav is present in current directory, c:\, c:\windows\media
If i give the full path, no change in output.
If i give some invalid filename say "afsdfasdf.wav", then also no change in output: one small beap comes.
Manjunath S
GESL
Bangalore
|
|
|
|
|
I think you need to convert the string from ANSII to UNICODE. It should work this way
|
|
|
|
|
Manjunath S wrote: error C2664: 'PlaySoundW' : cannot convert parameter 1 from 'const char [12]' to 'LPCWSTR'
Precede the string literal with an L .
Manjunath S wrote: If i use _T("c:\\tada.wav"): error C3861: '_T': identifier not found
Did you include <tchar.h> ?
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
#include <afxwin.h>
class CExerciseApp : public CWinApp
{
public:
virtual BOOL InitInstance();
};
class CMainFrame : public CFrameWnd
{
public:
CMainFrame();
};
CMainFrame::CMainFrame()
{
Create(NULL, "MFC Fundamentals");
}
BOOL CExerciseApp::InitInstance()
{
m_pMainWnd = new CMainFrame;
m_pMainWnd->ShowWindow(SW_NORMAL);
return TRUE;
}
This is my basic Win32 application.Its shows unhandled ecxeption error.I set MFC as use MFC as shared DLL.i dnt know why the error occurs.Its mot console appliaion, it is win32 applcation.
|
|
|
|
|
update the window......m_pMainWnd->UpdateWindow ();
|
|
|
|
|
where is the object of CMainFrame!
Anu_Bala wrote: BOOL CExerciseApp::InitInstance()
{
m_pMainWnd = new CMainFrame;
m_pMainWnd->ShowWindow(SW_NORMAL);
return TRUE;
}
this should be something like this
CMainFrame *MyPtr=new CMainFrame;
MyPtr->ShowWindow(SW_NORMAL);
m_pMainWnd=MyPtr;
"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
Support CRY- Child Relief and You
|
|
|
|
|
Anu_Bala wrote: This is my basic Win32 application.
No, it's an MFC application that you've tried to create manually. Use AppWizard to create the application. You'll save yourself much time and grief.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Anu_Bala wrote: CMainFrame::CMainFrame()
{
Create(NULL, "MFC Fundamentals");
}
Do not call Create from within the constructor. You will be trying to use objects that haven't been fully initialized yet. Instead, make your constructor empty and call Create in InitInstance:
#include "stdafx.h"
class CExerciseApp : public CWinApp
{
public:
virtual BOOL InitInstance();
};
class CMainFrame : public CFrameWnd
{
public:
CMainFrame();
};
CMainFrame::CMainFrame()
{
}
BOOL CExerciseApp::InitInstance()
{
CMainFrame* pFrame = new CMainFrame;
pFrame->Create(NULL, _T("My Non-AppWizard MFC App"));
m_pMainWnd = pFrame;
m_pMainWnd->ShowWindow(SW_NORMAL);
return TRUE;
}
CExerciseApp theApp;
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Hi All,
I have created a Mutex Object using
CreateMutex(...) Api, in One Machine and i want to Open the Mutex Handle what i have Created using
OpenMutex(...) Api, because Mutex Handle is Accessed across the Boundaries.
But I am not able to Open the CMutex Object what i have Created.
Please provide a Snippet of code to Open the CMutex Object from Different Machine.
uday.
|
|
|
|
|
Mutex's are not designed for this behavior. If you want to synchronize information across network boundaries, you will have to come up with your own techniques (or google for some).
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
hi zac,
CreateMutux(...) will have inherited Handle as the first parameter in the API what is the use of the Parameter.
Please tell me the Use of the Security Attribues in Mutex. Will this help to Open the Mutex Across the Boundaries.
If yes then give me a snippet of Code.
Uday.
|
|
|
|
|
Security Attributes lets you change how inherited mutexes will behave. This is a machine dependent operation, though. There is no security attributes that will let you create a mutex that is valid between two machines.
See MSDN.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Hi all,
I downloaded an example of modeless dialog
for measurement studio. Now it works but
when i click on the parent window it gets
the focus but the child window remains the foreground
window.
I think i have to call ShowWindow with a different
parameter respect to SW_SHOW but i'd like
to have some hint from you.
Sincerly yours,
Desmo16.
|
|
|
|
|
moreover if i minimize the child window
the parent window is minimized too, while
i don't want that.
|
|
|
|
|
Desmo16 wrote: ...when i click on the parent window it gets
the focus but the child window remains the foreground
window.
Exactly what did you expect to happen with a modeless dialog?
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I supposed that while a modal dialog
won't let you activate the parent window,
a modeless dialog will let you give the focus
on the parent window by clicking on it, and that
the parent window return to the foreground when
you click on it, so that you can use both the
windows, but I've seen in the Measurement Studio example
and also in the Visual Studio .NET Samples that
the modeless dialog stay always on top.
Maybe i'm a little bit confused
Anyway is there a way to take on top the
parent/child window every time i click on it ?
Thanx in advance,
Desmo16.
|
|
|
|
|
Hi,
I have created an application in vc++ using mfc. The application connects to Access database. I have used DAO. The application is multi-user one. It works like this:
When the user creates a new account, a new .mdb file is created and then two tables and fields are created at runtime.
It has editable listview control, graphs -pie chart/bar graph, a password-hashing algorithm.
Some of the class I got from CodeProject and then modified them to my need.
The program does not use registry keys or any complicated programming.
I did most of the program on one xp system. I had to change the system due to some reason. When I was working on the new XP system, the computer would restart by itself. It wouldn’t happen at regular intervals. I assumed that there was something wrong with the system. After a while it totally crashed.
I switched back to my old system and completed the program. When I send it to a friend, he worked the program for a while, after which his computer too started restarting by itself.
I worked the program on two other systems, but nothing happened.
I am wondering why is the system failure occurring on some systems.
I just can’t understand whether it is my program that is causing this to happen. If so, why is it not happening in all the systems? The program does not use the windows registry or any complicated codes.
If anybody knows about this please help.
Thanks,
Tara
Fortitudine Vincimus!
|
|
|
|
|
Have you checked if the memory is OK? Try memtest.
|
|
|
|
|
pgrohs wrote: Have you checked if the memory is OK?
Please can you tell me which memory.
pgrohs wrote: Try memtest.
I do not know about memtest. Please can you explain in a little more detail.
Is the problem with my program?
Fortitudine Vincimus!
|
|
|
|
|
Look at http://www.memtest.org/.
This is a tool that checks your RAM. It happens that programs crashes without an obvious reason. In that case it is useful to check the memory to exclude a hardware problem.
|
|
|
|
|
Why is it that it on the two system that I worked on nothing happened, but on a third system, the same program is behaving this way?
Fortitudine Vincimus!
|
|
|
|
|
What do you mean with "system"? The OS or the hardware?
|
|
|
|
|
The OS,I guess, Windows XP
Fortitudine Vincimus!
|
|
|
|
|
This is what is showing on my computer that crashed.
Windows could not start because the following file is missing or corrupt:
<Windows root>\system32\hal.dll
Please re-install a copy of the above file.
Did my program cause this to happen?
Fortitudine Vincimus!
|
|
|
|
|
Just google a little bit.
|
|
|
|