|
ChildFrm ?That is MDI .
What can I do in dialog of MFC dll .
Thanks .
===========================
http://begtostudy.blogspot.com/
email:begtostudy@gmail.com
MSN:begtostudy@gmail.com
|
|
|
|
|
i've added onidle plus invalidate the win and set the onidle to 0; as this option allows playing of the sound.
I am very much a begginer and I'm sorta testing things out.
Could any one tell me whats going on with this approach?
Thanks very much..
Simon
-- modified at 19:58 Friday 23rd November, 2007
|
|
|
|
|
Can you post some relevant code? I'm not clear where and how you
are calling PlaySound() and what OnIdle() has to do with it.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I am trying to create a game in mfc
in the OnDraw, I am calling ---- PlaySound("c:\\sound.wav",0,SND_FILENAME | SND_ASYNC); -----
the OnIdle is called when there is no mouse or keyboard activity
and with in onidle the invalidate is called for ondraw
--- AfxGetMainWnd()->Invalidate(false); ---
so the draw is called a number of times,
I know that the playsound is called a number of times, sofor I would expect
odd behavior, so I have set the onidle return value to 0, so it is only called after keyboard or mouse interuption has ended as aposed of the call to be continuse
as I mentioned the sound only plays when there is no keyboard or mouse acticvity
what I am after Is a soloution, or a structered method to go about this,
I have looked around on the internet, an d things seem very complcated
this playsound is all I can go about
if you can refer me to any relevant articles, it would very much be a appreciated
simon
|
|
|
|
|
simon alec smith wrote: as I mentioned the sound only plays when there is no keyboard or mouse acticvity
That's the only time you'll get OnIdle() calls!
Ok I understand now, thanks for the explanation.
You may want to look into using a timer, either a regular windows timer
if resolution isn't important, or a multimedia timer for more precise timing.
I think you'll find this will work much better than trying to do periodic stuff
in OnIdle()
Using Timers[^]
Multimedia Timers[^]
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi, for some reason i can only call ON_COMMAND in my main dialog, how can i call it in a child dialog?
Any ideas would be much apreciated!
|
|
|
|
|
How can you call ON_COMMAND? ON_COMMAND is not a function or method AFAIK.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi Mark, I call it via afx_msg void OnAddNewItem(); and ON_COMMAND(ID__ADDITEM, &CItemDlg::OnAddNewItem)
Edit:
the menu item is created via CMenu and if i move ON_COMMAND(ID__ADDITEM, &CItemDlg::OnAddNewItem) to the main dialog it works fine. But i want to know why i cant call it in the child dialog
|
|
|
|
|
You aren't calling anything. You've added a method that will get called when the
window you've added it to receives a WM_COMMAND message corresponding to a
menu item or child window with the id "ID__ADDITEM".
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Ok, how do i associate the menu to the dialog? The menu opens when right mouse button is pressed and so i dont care to attatch it to the Child Dialogs system menu.
|
|
|
|
|
FredrickNorge wrote: ...how do i associate the menu to the dialog? The menu opens when right mouse button is pressed...
The TrackPopupMenu() API/method takes a window handle/ptr to the window
that should receive the command messages.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks, that made it work
|
|
|
|
|
I will try to write question shortly
struct CEvents
{
virtual HRESULT Method1() = 0;
virtual HRESULT Method2() = 0;
virtual HRESULT Method3() = 0;
};
class A : public CEvents
{
// Implementation of VTBL methods
virtual HRESULT Method1();
virtual HRESULT Method2();
virtual HRESULT Method3();
HRESULT Some();
B *m_B;
};
HRESULT Some()
{
m_b->Initialize( (CEvents*)this );
return S_OK;
}
class B
{
CEvents *m_evs;
HRESULT Initialize( CEvents *evs );
}
HRESULT B::Initialize( CEvents *evs )
{
///////////////////// THIS IS MY QUESTION /////////////////
// This i have trouble... access violation and ect....
// But when i use not pointer to class B as member of A ( B *m_B; )
// there is no any problems - PLEASE, TOLD ME, WHY??????????????
m_evs = evs;
return S_OK;
}
ISQ 469907496
|
|
|
|
|
Are you initialising the m_b member in the constructor of class A?
Habetis bona deum
|
|
|
|
|
|
I don't see anywhere that you actually create any objects.
You have pointers declared but they are uninitialized.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
actually it was shortly sample...
ISQ 469907496
|
|
|
|
|
How should we help you then?
What errors are you getting? On what line(s)? Compile or runtime?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
i have write answer for my question above... see third reply...
i am ashamed of myself....
ISQ 469907496
|
|
|
|
|
might be some one is intrested in the answer!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
i'm looking for a c++ program that will read in an ascii file and will output a csv file, is there anyway that this can be done? can anyone help me?
|
|
|
|
|
a CSV file is an ASCII file and both files are text files.
Are you only wanting to put commas between fields ?
In general, when one wants to do something like that, one will read the file in memory, parse each line ( if that is the case ) to extract the different fields (whatever is the separator criteria) and one will print out each field separated by a comma.
Do you know how to read a text file ? and write the file ?
Do you know how to parse a line of text ?
|
|
|
|
|
I need to parse each line based on a criteria I'm not sure how to go about it though, here's what I know:
Head data (zip file of 9.2 mbytes) A 109-slice MRI data set of a
human head. Complete slices are stored consecutively as a 256 x
256 array. Pixels consist of 2 consecutive bytes making one binary
integer. Data taken on the Siemens Magnetom and provided courtesy of
Siemens Medical Systems, Inc., Iselin, NJ.
I need the csv file so that a program called paraview can read it, I just don't know where to start.
I would appreciate any help.
|
|
|
|
|
whats written in your ASCII file!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
It's data for a visualization of a human head, I need to parse each line according to this:
Head data (zip file of 9.2 mbytes) A 109-slice MRI data set of a
human head. Complete slices are stored consecutively as a 256 x
256 array. Pixels consist of 2 consecutive bytes making one binary
integer. Data taken on the Siemens Magnetom and provided courtesy of
Siemens Medical Systems, Inc., Iselin, NJ.
|
|
|
|