|
Much apreciated guys for your contributions.
Thanks,
Garyc
|
|
|
|
|
Hi,
I need help to write a multi thread simple class,
I know this should be simple but I face some difficulties,
any help will be appreciated.
Implementing single-write, multiple-read multi thread synchronization (using windows synchronization primitives like mutex, semaphore etc.).
Thanks in advance,
Eyal
modified on Saturday, October 17, 2009 7:11 AM
|
|
|
|
|
Hi Eyal!
In what problem did you run, what have you done so far, which multithreading tutorials have you read?
Have a good weekend
/M
|
|
|
|
|
Hi Moak,
Just faced with this question in a C++ questioner/quiz.
I read information/tutorials on multithreading mutex but I haven't deal yet with the answer.
looking for the right answer.
Best,
Eyal
|
|
|
|
|
|
cmk,
Thank you very much,
Eyal
|
|
|
|
|
The code I'm using needs HWND but I just have no clue how it works and how to initialise it.
In my SoundManager class I have:
bool OggPlayer::InitDirectSound( HWND hWnd )
{
//code
}
and then in mainGame:
void MainGame::Initialise()
{
HWND hwnd = NULL;
op.InitDirectSound(hwnd);
op.OpenOgg("music.ogg");
op.Play();
//random code
}
Obviously I need to pass hwnd into InitDirectSound but at this point I'm just guessing and setting it to null.
Any help explained in layman's terms would be appreciated.
|
|
|
|
|
What kind of application have you built?
Is it an MFC application?
If it is you can get the main application window handle using AfxGetMainWnd()->m_hWnd .
If it is a dialog application and your writing the code in the dialog class, you can directly use m_hWnd .
|
|
|
|
|
No MFC involved.
I'll try using m_hWnd... when I figure out how to use it >_>
|
|
|
|
|
GLGunblade wrote: I'll try using m_hWnd... when I figure out how to use it >_>
This is just the handle to your application's main window (whether app, or dialog). Windows needs it to discover who makes the call to an API function. You don't need to figure out how to use it so much as use the value that is returned by a CreateWindow() call, or in a Dialog application the handle that Windows sends you on every callback.
|
|
|
|
|
Sorry but still stuck, I'm pretty much a n00b programmer.
By using it I mean I just have no clue on handles or what not or where to put m_hWnd, it comes up as undeclared identifier. Everytime I've coded I've never really bothered with this and if some piece of code included it i just stuck it in and hoped it worked.
I have no CreateWindow call and I have no idea where in my program (which isn't really my program) windows sends a handle.
|
|
|
|
|
GLGunblade wrote: which isn't really my program
Cannot ask the author?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
He wasn't available at the time and since I wanted this done asap and wasn't probably wouldn't see him till Tuesday i thought i'd ask.
Though I've got it working. Thanks for the help guys
|
|
|
|
|
GLGunblade wrote: I have no CreateWindow call and I have no idea where in my program (which isn't really my program) windows sends a handle.
I would suggest that you get hold of a book on Windows programming to get an understanding of the basics; Charles Petzold has written some very good ones.
|
|
|
|
|
i'll keep that in mind and take a look, thanks
|
|
|
|
|
Hi,
I am wondering if any of the experts can give me some insights into the Different behavior
of the RichEdit when the object is Connected
By DDX_CONTROL as opposed to Create
1) The Font is Different
2) GetTextExtent for calculating the Length
of a line works differently (maybe
this has to do with font)
3) The Background Color is different
with DDX_CONTROL it seems be in
reverse video (when I right
it goes away)
thankx
|
|
|
|
|
I can't answer 100%, but I'll help a bit.
The difference is not DDX_Control. That just helps you associate a variable in your dialog with a window.
The difference is:
a) A control "built" in to the dialog resource, and created automatically as part of the dialog creation,
and
b) A control you create manually, later.
So, to answer your points...
1) Different Fonts.
At creation time for the dialog, it sets the font (WM_SETFONT) of the child windows (ie, your rich edit) to the same font as the dialog is set to use.
When you create a window manually later, this step does not happen.
2) Different extent sizes.
Almost certainly the same issue. Text size comes from fonts.
3) Inverse background colour.
Not sure, but I bet the text is inially selected, or something along those lines. Try dragging the mouse over text - I bet it goes inverse too.
Points 1 & 2 would be the same for a button, or an edit control... Nothing to do with the rich edit control at all.
Hope that helps!
Iain.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need contract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
I guess I can send EM_GETCHARFORMAT to the rich edit control after the DDX_CONTROL connects it to the object
and find out the font
I can then set it with the EM_SETCHARFORMAT message
|
|
|
|
|
Think you right I Sent EM_GETCHARFORMAT message to get the Font
With Create there was garbage in the szFaceName
With DDX_CONTROL It was "Shell Dlg 2"
Tried to change the font with EM_SETCHARFORMAT setting CFM_FACE and CFM_SIZE
that didn't seem to work
Anyway thankx for your help
|
|
|
|
|
Hi
in my project i import msado15.dll to opetate data from database
now i want to let the data can print in ms-word,so i
#import "C:\Program Files\Common Files\Microsoft Shared\OFFICE11\MSO.dll" rename_namespace("AAA")
but it said:
error C2011: '_Application' : 'class' type redefinition
error C2011: '_Global' : 'class' type redefinition
error C2011: 'FontNames' : 'class' type redefinition
error C2011: 'Languages' : 'class' type redefinition
error C2011: 'Language' : 'class' type redefinition
error C2011: 'Documents' : 'class' type redefinition
error C2011: '_Document' : 'class' type redefinition
..........................
i know it should rename_namespace, but i am a fresh man, i can not find example
how can i work this problem, how to rename namespace, and what name should be renamed
thanks a lot
Sincerely
|
|
|
|
|
Are you using the same namespace name in both #imports ?
If both DLLs contain the _Application object you will get this error.
So try this -
#import msado15.dll rename_namespace("AAA")
#import mso.dll rename_namespace("BBB")
Now you can access the ADO object as AAA::_Application and the Office object as BBB::_Application .
|
|
|
|
|
can i use
#import msado15.dll no_namespace
#import mso.dll rename_namespace("BBB")
because if msado15 renamed,my project many code should be modified,because msado's method i have used
thanks a lot
|
|
|
|
|
Sure.
Now you can access MSADO15's class as just _Application and MSO's class as BBB::_Application .
|
|
|
|
|
|
Have you tried something like:
#import <mso.dll> rename("_Application","_MSOApplication") Although Superman's suggestion is a bit cleaner.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|