|
|
I have tried... but some error appeared... in string funtion(strcpy/strcmp/strcat)...
Let me know a way... If could be... let me a full code... I think, it's not too long...
Thanks...
Try to find how to die
|
|
|
|
|
Perhaps if you show us what you have tried already and what errors you are getting, we will be able to help you a little better.
And a bit of advice, don't put "help me" in the title of your post, most users will just avoid reading it.
|
|
|
|
|
First of all 'help me' doesn't tell people anything about your request. 'The last exam' tells us you want us to do your homework, people will just ignore that.
If you're going to tell us it's your homework, all the more reason not to expect help unless you post the code you've written, and ask *specific* questions about where you're stuck. Your request reads to me as 'this is the task, do my homework for me'. We're not doing that.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I think you can see ean exmmple on the codeproject about check speller maybe it some helpfuls
|
|
|
|
|
Eric Raymond (if I remember well) have a fragment about "please do my homework" questions.
You may find it both instructive and humorous.
Quick solutions you may want to consider:
1. post a bid request on Rentacoder website and have it done by someone else for a low and quick buck;
2. (variation of 1) ask help [read: copy] from a colleague;
3. read the documentation and help and do it yourself (that's the idea).
On what NOT to do:
- type with capital HELP ME, HELP Me, HeLP mE etc.
Exercise: Write a C program to generate from a string all the distinct variations that contains an upper case letter.
- post the same message with higher speaker volume on the same (or other) thread.
Is ok to ask for help, but only after you pulled your hair and destroyed your 3rd keyboard.
|
|
|
|
|
I'm sorry about my mistake... cause this is the first time I race on this site. At firts, thanks for replying to my topic.
And now, I introduce about what I've done...
#include
#include
class cspell{
char* mean;// word's meaning
char* warray[12];//warray which is an array include words
public:
void init();//initializing
void check(char*);// check spell
void set(char* m);//add a word to dictionary database
};
I have built this class. And I have met some errors while I setup 3 behaviours(init , check, set).
I want to initialize warray's member... but I can't.
And this...
void check(char* word){
for( int i = 0; i<n; i++)="" {="" n="" equals="" warray's="" size
="" if="" (strcmp(warray[i],="" word)="=0)" {
="" cout="" <<="" word;
="" "good="" word.\n";
}
};
and="" i="" want="" to="" build="" word's="" meaning...="" but="" don't="" know="" the="" method...
do="" you="" about="" my="" idea?...
i="" compare="" a="" word="" and="" member="" of="" warray.="" an="" error="" appeared.
"set"="" behaviour="" is="" so="" hard...="" please="" help="" me="" built="" this="" class="" its="" behaviours...="" thanks="" for="" reading="" replying.
my="" mind="" too="" bad...="" have="" learn="" language="" 2="" months="" ago="" by="" myself.=""
<div="">Try to find how to die
|
|
|
|
|
I have an alarm application that plays sounds when an timed-event fires. These sounds however appear to be at the mercy of other processes running and often times the sound event comes out choppy. How can I make sure the sound event being played has the highest priority and therefore will not be distorted or effected by other processes running at the same time?
Thanks!
|
|
|
|
|
How are you playing the sound?
|
|
|
|
|
I believe the code for playing sound came from CodeProject, but I can't remember where. It's been a while. Basically I call
StartPlayingFromFile(CString) to play a sound
the function above looks like this
void CPipe::StartPlayingFromFile(CString FileName)
{
m_pFile = new CSoundFile(FileName);
if(m_pFile && m_pFile->IsOK())
m_SoundOut.Start(m_pFile->GetFormat());
else
ErrorMsg("Unable to open file");
}
the function for Start() which I am assuming is where the magic really happens is
bool CSoundOut::Start(WAVEFORMATEX* format)
{
MMRESULT mmReturn = 0;
if(m_bPlaying || GetDataToSoundOut == NULL || m_pOwner == NULL)
{
return FALSE;
}
else
{
if(format != NULL)
m_Format = *format;
mmReturn = ::waveOutOpen( &m_hPlay, WAVE_MAPPER, &m_Format, m_ThreadID, NULL, CALLBACK_THREAD);
if(mmReturn)
{
waveOutErrorMsg(mmReturn, "in start()");
return FALSE;
}
else
{
m_bPlaying = true;
for(int i=0; i<3; i++)
{
CBuffer buf(m_Format.nBlockAlign*m_BufferSize, false);
GetDataToSoundOut(&buf, m_pOwner);
AddOutputBufferToQueue(&buf);
}
}
}
return TRUE;
}
I hope this helps.
|
|
|
|
|
Without seeing the sound playing code it's hard to guess why it's choppy.
How many different sounds do you play?
How long are the sound(s) (in seconds)?
Do you ever have more than one sound playing at the same time?
What's the timer interval that triggers the sound(s)?
I ask because using the PlaySound() API asynchronously may be a better, simpler solution for your
needs.
Mark
|
|
|
|
|
How many different sounds do you play?
At the same time, only one. The user defines what sound is played for each event.
How long are the sound(s) (in seconds)?
Not long at all. About 10 seconds maximum. As little as 1 to 2 seconds minimum.
Do you ever have more than one sound playing at the same time?
The software program with never have more than one sound event triggered at the same time, however the computer could be playing other sounds during that time.
What's the timer interval that triggers the sound(s)?
I'm using the OnTimer(UINT nIDEvent) function in the View.cpp file
void CAlarmeView::OnTimer(UINT nIDEvent)
{
SYSTEMTIME SystemTime;
GetLocalTime(&SystemTime);
CTime timeTime(SystemTime);
CEventObj *pCls = GetDocument()->GetFirstEvent();
if(!LockOut && (pCls) && (pCls->GetTime().GetHour() == SystemTime.wHour) &&
(pCls->GetTime().GetMinute() == SystemTime.wMinute) &&
(SystemTime.wSecond == 0))
{
if(!pCls->IsSoundSupressed())
StartPlayingFromFile(pCls->GetSound());
ResetList(true);
GetDocument()->OnFileSave();
}
__super::OnTimer(nIDEvent);
}
Let me look up the PlaySound Api function you mentioned. Is that part of MFC or .NET or is that a CodeProject submission?
Thanks!
|
|
|
|
|
Short sounds like this are good candidates for using PlaySound() or sndPlaySound() APIs since
they can easily be held in memory. These APIs are part of Windows (multimedia).
The code you are using is using buffers which is fine for long/large sounds but having
the buffer-handling notifications on the same thread as the UI is going to cause problems like
you are experiencing. That code would have to be altered to use a separate thread for the best
performance.
I'm not sure how the Windows Multimedia APIs handle sounds played at the same time (I'd have to
look it up). If you have problems playing a sound while another sound is playing then you may
need to use DirectX or mix sounds yourself.
brdavid wrote: What's the timer interval that triggers the sound(s)?
I'm using the OnTimer(UINT nIDEvent) function in the View.cpp file
I meant how long is the interval between timer events (in seconds/milliseconds/etc.))
|
|
|
|
|
Hello! Please, forgive me for my poor English.
I have a macro in excel which is saved in 'PERSOANL.XLS' to be able to use it in any workbook.
When I run Excel manually, everything works fine.
Now I need to Run this macro using my MFC application.
Here is a code
Excel::ApplicationClass ^xlApp = gcnew Excel::ApplicationClass();
xlApp->Visible = true;
Excel::Workbook ^pBook = xlApp->Workbooks->Open(path, other params...);
xlApp->Run(_T("PERSONAL.XLS!Conv"), other params...);
Excel starts, opens a file, but application throws the error that 'PERSONAL.XLS' was not found.
When I try to run a macro manually (without closing the opened workbook), I can't find it, 'PERSONAL.XLS' really doesn't exist. If I try to create a macro and save it to 'PERSONAL.XLS', Excel gives an error that the operation is not possible.
When I stop Excel and run it again manually, everything becomes fine again.
Can you help me?
|
|
|
|
|
The solution was very simple: to open PERSONAL.XLS before opening required workbook
|
|
|
|
|
Hi All,
I need to catch all keyboard event and some of the keyboard keys i need to intercept.
So i using windows hook to do it.
But in some reason when i do "SetWindowsHookEx" i getting wrong return code and my hook does not working.
This is my code ( just the relevant part ):
<br />
LRESULT CALLBACK KeyboardProc(int code,
WPARAM wParam,
LPARAM lParam
)<br />
{<br />
LRESULT lRetCode = 0;<br />
<br />
return lRetCode;<br />
}<br />
<br />
LRESULT SetHook()<br />
{<br />
<br />
HINSTANCE hinstance = NULL;<br />
HHOOK hookHandle = NULL;<br />
LRESULT lRetCode = 0;<br />
<br />
hookHandle = SetWindowsHookEx(WH_KEYBOARD, KeyboardProc, hinstance, 0);<br />
<br />
return lRetCode;<br />
}<br />
<br />
What i did wronge ?
Thanks for any help.
|
|
|
|
|
A couple of things, according to the SetWindowsHookEx [^] article in MSDN:
1. As a rule, your hook function must defined in a DLL. It's not clear from your code that you've done that.
2. You are passing an hinstance value of NULL , which probably isn't correct. You need to pass the instance handle for the DLL, which is a parameter to your DllMain[^] function.
Software Zen: delete this;
|
|
|
|
|
1. Thanks for the help.
2. From what i understand - the hook can appear in the code and not only in separate DLL - am i wrong ? and in this case ( not in the DLL ) what need to be put in the hinstance ?
|
|
|
|
|
For most cases, the hook function must be in a separate DLL. The only case where it can be in an EXE is when you are hooking only a specific thread within your process. For that to be the case, you must pass the thread ID in one of the arguments to SetWindowsHookEx . In that situation, I believe you pass NULL for the instance handle.
Software Zen: delete this;
|
|
|
|
|
Hi,
where can I find New ATL Object(RadBytes Category) on vs2003 I cant find it on the wizard
Thanks
|
|
|
|
|
|
I am trying to add item to the combobox, using the code below...
....
HWND hComboBox = CreateWindow(WC_COMBOBOXEX, L"", WS_BORDER | WS_CHILD | CBS_DROPDOWNLIST, 160, 70, 160, 23, hWnd, NULL, hInst, 0);
COMBOBOXEXITEM item;
memset(&item, 0, sizeof(COMBOBOXEXITEM));
item.iItem = 0;
item.mask = CBEIF_TEXT;
item.pszText = TEXT("Test");
item.cchTextMax = 4;
SendMessage(hComboBox, CBEM_INSERTITEM, 0, (LPARAM)&item);
....
But item is not added (SendMessage returns 0). What am i doing wrong?
|
|
|
|
|
A return of 0 means it was inserted at the first position (index 0).
A return of -1 would indicate failure.
You don't have to set item.cchTextMax when setting text
|
|
|
|
|
|
This is my first time implementing a plugin interface to an application, and am I having issues deciding the best way for communication between my plugin dll and the host application.
I've read most of the articles here, and I can't reach any sort of agreement. My plugin dll has specific defined functions that are exported. When my host wants to invoke something in the dll, it calls the exported function which was found by GetProcAddress. When my dll wants to communicate with the host it sends a registered message to the host application and uses W & LPARAM for the data. This system works, but it is cumbersome to send more than two pieces of information at a time and I'm worried about memory corruption between the dll and host.
Some of the articles suggest (but don't necessarily show how to) giving the host a similar interface that can be called from the dll.
What is the "best" approach?
Thanks
modified 12-Jul-20 21:01pm.
|
|
|
|