|
Microsoft's own documentation makes the claim that the critical section is faster. Critical section can be used for synchronization among many threads within the same process. The critical section can not synchronize separate threads from different processes. It is difficult to make reader/writer type objects with critical sections.
|
|
|
|
|
Please if any of you can help me in these 2 cases :
Case 1:
I want to know something about Thread Termination . Generally I do it by exiting from the thread function by a return statement and posting a message to the main thread that the thread has ended . I have never used Terminate thread or Exit Thread API calls . But I have seen articles telling you call call Exit Thread from "Inside a thread" and not from "Outside a thread".Can you please explain me or put some of your thoughts in this matter ?
Case 2 :
Can you please send me a sample project which contains any program such as this :
There is a main thread which monitors two different Worker threads . Any sample application will do . So far I have done by creating a single thread within my the main thread .
Any help will be great . Thanks in Advance . Please mail me at aveek_99@yahoo.com .
Regards,
Aveek
|
|
|
|
|
sudiptam wrote:
But I have seen articles telling you call call Exit Thread from "Inside a thread" and not from "Outside a thread".Can you please explain me or put some of your thoughts in this matter ?
See here.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Please if any of you can help me in these 2 cases :
Case 1:
I want to know something about Thread Termination . Generally I do it by exiting from the thread function by a return statement and posting a message to the main thread that the thread has ended . I have never used Terminate thread or Exit Thread API calls . But I have seen articles telling you call call Exit Thread from "Inside a thread" and not from "Outside a thread".Can you please explain me or put some of your thoughts in this matter ?
Case 2 :
Can you please send me a sample project which contains any program such as this :
There is a main thread which monitors two different Worker threads . Any sample application will do . So far I have done by creating a single thread within my the main thread .
Any help will be great . Thanks in Advance . Please mail me at aveek_99@yahoo.com .
Regards,
Aveek
|
|
|
|
|
|
Hello Friends,
I want to migrate from VC++6.0 to .Net, Please suggest me the correct path and what are the different technologies are present in it.
Thanks you in advance only.
Neelesh K J Jain.
|
|
|
|
|
Hi , I'am copying some text content into the Clipboard. But I'm getting error at the SetClipboardData(CF_TEXT, h_glbl); function call. This is the code I'm using
CString str; <br />
HGLOBAL h_glbl;<br />
char * buff_data ;<br />
EmptyClipboard();<br />
m_ctrl_edit_cliptextdata.GetWindowText(str);<br />
if ( OpenClipboard() != 0 )<br />
{<br />
h_glbl = GlobalAlloc(GMEM_DDESHARE, str.GetLength() );<br />
buff_data = (char * ) GlobalLock(h_glbl);<br />
strcpy(buff_data, (LPCSTR) str) ;<br />
GlobalUnlock(h_glbl);<br />
SetClipboardData(CF_TEXT, h_glbl);<br />
CloseClipboard();<br />
}
Thanks in Advance.
|
|
|
|
|
is this why if not what error type!
Text format. Each line ends with a carriage return/linefeed (CR-LF) combination. A null character signals the end of the data. Use this format for ANSI text.
to CF_TEXT
|
|
|
|
|
SivaramanDhamodharan wrote:
But I'm getting error...
Would you mind telling us what this error is?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
DavidCrow wrote:
Would you mind telling us what this error is?
This is error message i am getting :
"Unhandled Exception at 0x77f767 in Clipboard.exe : User breakpoint"
I am using vc++.net.
Also, I tried to copy the Error dialog and failed because it is opened state by this application.
Thanks ,
DavidCrow and annonymous
|
|
|
|
|
compiler = vs.net2003 pro
anti software norton internet security 2005
i can not run forms.net but am able to compile com based apps.
i have disabled all antivirus and all others including scripts indicated
by severall help sites either internally or on net
the problem is still there can any one come up with a soloution besides un
installing NAV internet security 2005
email pgelliott@iprimus.com.au
|
|
|
|
|
yyin = fopen( yytext, "r" );
yy_switch_to_buffer(
yy_create_buffer( yyin, YY_BUF_SIZE ) );
these can only associate the input buffer with a file. However, creating new file is prohibited under my envirment.
Are there any good ways to solve this problem?
Best Regards,
|
|
|
|
|
I have a main app dialog with out the title bar style. So when i minisize the main app dialog and right click the samll icon in the work bar, there won't be a content menu jump out. Could any one teach me which message i should process to show the content menu when a app is minisized?
Please, help me.
Thanks a lot
|
|
|
|
|
For That you have make changes System Menu
here are some codes
#1 Get system Menu
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString("about box");
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
for handling Menu Message you have to overide
WM_SYSCOMAND message. i.e. this way
void CSockDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
this code is wizard generated but help very much
-----------------------------
"I Think this Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
Thank you ThatsAlok.
But i still got problem...
When i minisize the main dialog, then right click the small icon in the work bar, i can catch SC_RESTORE and SC_MINIMIZE, but i cann't catch the SC_MOUSEMENU! The left mouse click message could got, but the right mouse click couldn't catch?!
Thank you very much.
|
|
|
|
|
Hi!
nId contain value SC_MOUSEMENE.Ar eyou getting that or not pls Clarify
-----------------------------
"I Think this Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
Thank you for your such quickly reply.
Yes, I use the nID to get the message. I set one breakpoint at the first of the function OnSysCommand(..) and could get the mouse left click when minisize the main window, but if i use the right click, nothing happen, i got none message and my breakpoint even can not be called!
it seems no message pass in when i use the right mouse click?!
Thanks again for your help!
|
|
|
|
|
I have a program that all driverd from CDialog, and all have a member function - CString GetFuncName(),and use it like following
void ShowFunctionName(int functionid,CObject* functionobj)
{
CString msg;
switch(functionid)
{
case 1:
msg.Format("Function is %s",((CFunction1*)functionibj)->GetFuncName());
break;
case 2:
msg.Format("Function is %s",((CFunction2*)functionibj)->GetFuncName());
break;
......
}
MessageBox(msg);
}
I want to simplify code as following
void ShowFunctionName(int functionid,CObject* functionobj)
{
CString msg;
msg.Format("Function is %s",((CDialogEx*)functionibj)->GetFuncName());
MessageBox(msg);
}
So I create CDialogEx as following
class CDialogEx : public CDialog
{
public:
CDialogEx(){CDialog::CDialog();};
~CDialogEx(){CDialog::~CDialog();};
CDialogEx(LPCTSTR lpszTemplateName, CWnd* pParentWnd = NULL){CDialog::CDialog(lpszTemplateName,pParentWnd);};
CDialogEx(UINT nIDTemplate, CWnd* pParentWnd = NULL)
{
CDialog::CDialog(nIDTemplate, pParentWnd);
};
public:
virtual CString GetFuncNameg() {CString rtn; return rtn;};
};
and all the functions CFunction1~CFunctionn all chage inherit from CDialog to CDialogEx,And Change the constructor ( :CDialog( .. to CDialogEx(...)
CFunction1::CFunction(CWnd* pParent /*=NULL*/)
: CDialogEx(CFunction::IDD, pParent)
But when the progame run at
CFunction1 dlg;
dlg.DoMoal();
It Will cause the "Debug Assertion Error" and terminate program
Can anybody give me a sample source like abuout "How to create and use an Extened Dialog Class?"
or hint me where has the sample.
My tool is Visull C++ 6.0
|
|
|
|
|
Hi
I am working in vc++. I have to write a keyboard hook program. I have to trap all the pressed keyboard keys. For ex: if Key ’a’ and Key ‘b’ are pressed simultaneously, then my program should get a message that Key ‘a’ and Key ‘b’ are both pressed. I should be able to capture all pressed and released key events simultaneously at once. Can anyone please give me some inputs for me to proceed ahead?
Thanks
Madhavi
|
|
|
|
|
Hey Madhavi,
I had a similar requirement recently. I did this:
1. Wrote a hook to listen to the keyboard only
2. When I got 'a' or 'A', checked the Key State of 'B' by calling GetKeyState('b') and GetKeyState('B').
3. If either of the KeyState functions returns a value with a hi-order bit of 1, you have your event....
If this does not work well , an alternative would be to listen for 'a', and when you get it, store the time, using GetTickCount. In the next keyboard event you get, check if it is a 'b', and if the time gap between the last stored time and the current time is less than , say, 100ms, then .. run the rest of your code.
Clinton
|
|
|
|
|
Hi all,have you guys ever used the class CDirectSS defined in Xvoice.dll?
please tell me the way to change the speaker 's gender and make it speak slowly?Thanks you a lot!
Merry Christmas!!!
|
|
|
|
|
hi tiem, i found a vb6 project that uses the xvoice.dll. you may be able to use it. based on my project there is a property .CountEngines that lists the number of voices, in my case 8. so i used a list box to select each voice like this in vb6: spkSpeak.CountEngines =
val(ListBox.Text). I could not make the .gender property work, but using this approach I have 5 female voices and 3 male voices. very truly yours, joe / orange / virginia / usa / joeinorange2@aol.com
|
|
|
|
|
Hi all,have you guys ever used the class CDirectSS defined in Xvoice.dll?
please tell me the way to change the speaker 's gender and make it speak slowly?Thanks you a lot!
Merry Christmas1!!!
|
|
|
|
|
Hi,
I am new to .NET.
I have a managed .NET DLL that I need to use with some of my visual C++ code. (I have both Visual C++ 6.0 and Visual Studio .Net).
My understanding is that all the information (.lib .h) is contained within this .Net DLL and that it is all I need.
How do I incorporate this into my c++ app or solution, reference the calls and link successfully?
First, Can I do this and second, how do I go about doing it?
Thanks for you help
Phil
|
|
|
|
|
Hello,
I have a project that crashes at run-time due to an Access Violation. The violation occurs in a section that looks something like this:
double var;
for (iter = ptrA->getPtrB()->getCList().begin();
iter != ptrA->getPtrB()->getCList().end();
iter++)
{
var = iter->getVar();
}
A, B, and C are classes that have been defined elsewhere.
iter is an iterator of type std::list<c>.
ptrA is a pointer to an object of type A.
ptrB is a pointer to an object of type B.
getCList is a method in the B class that returns a list of C objects.
I have changed the names of the variables for simplicity.
When I debug at run time it brings me to the line starting with "for".
I cannot figure out where the problem is. My only hunch is that it might have something to do with the fact that the list that getCList() returns is actually NOT a list of C objects. Rather, it is a list of "D" objects where D is a class derived from C. Is that a problem? Does anyone else have anything else to suggest checking in the class definitions or anywhere else? I'd be happy to post more code if anyone thinks that would help...
Thank you!
-Jordan Atlas
|
|
|
|