Click here to Skip to main content
15,894,017 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: GetClipBoardOwner with acrobat reader Pin
Richard MacCutchan1-May-12 2:05
mveRichard MacCutchan1-May-12 2:05 
GeneralRe: GetClipBoardOwner with acrobat reader Pin
randydom1-May-12 2:22
randydom1-May-12 2:22 
QuestionRe: GetClipBoardOwner with acrobat reader Pin
David Crow1-May-12 3:49
David Crow1-May-12 3:49 
QuestionMeauring CPU time of C code in milliseconds Pin
Ron120230-Apr-12 18:18
Ron120230-Apr-12 18:18 
AnswerRe: Meauring CPU time of C code in milliseconds Pin
Peter_in_278030-Apr-12 18:32
professionalPeter_in_278030-Apr-12 18:32 
GeneralRe: Meauring CPU time of C code in milliseconds Pin
Ron120230-Apr-12 18:42
Ron120230-Apr-12 18:42 
AnswerRe: Meauring CPU time of C code in milliseconds Pin
Peter_in_278030-Apr-12 18:51
professionalPeter_in_278030-Apr-12 18:51 
Questionc++ win32 CreateThread, Wait, final testing Pin
jkirkerx30-Apr-12 16:54
professionaljkirkerx30-Apr-12 16:54 
Well I figured out how to test my compiled output, and find most of the errors.

This is the heart of most of my program failures, and strange behavior. It has something to do with Threads.

On one example, I have a dialog box, that loads parameters. I then click OK, and run the validator, first creating a thread, and the validator runs in the thread, which produces strange errors, like not connecting to sql server.

If I dump the thread, and just run the code function, it works fine, no problem. So I have to decide whether to dump the threads, or try to fix them.

I've tried WaitForSingleObject, and now the MsgWaitForMultipleObjects. On the latter, it just crashes on check return code, in which I run a MessageBox, and crashes.

I am posting this to see if perhaps it just needs improvement. It crashes on Case 1:, but I'm not sure if it really has a problem there or not. The message is Access violation reading location 0x2102fe2b. I don't have the expertise to proceed with the message.

DWORD dwRet;
do {
dwRet = ::MsgWaitForMultipleObjects( 1, &hThread, FALSE, INFINITE, QS_ALLEVENTS );

if (dwRet != WAIT_OBJECT_0)
			{
     MSG msg;
     while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
     {
		TranslateMessage(&msg);
		DispatchMessage(&msg);
     }
}
} while ((dwRet != WAIT_OBJECT_0) && (dwRet != WAIT_FAILED));

DWORD dwExitCode = 0;		
if ( GetExitCodeThread( hThread, &dwExitCode ) ) {
		
	CloseHandle( hThread );
			
	switch ( dwExitCode ) {
		case 0:
		// Create Project Validate was Successful
		bReturn = TRUE;
		break;

		case -1:
		{
		SetFocus( ddl_ProjectCreate_DatabaseName_Field );
		SendMessage( ddl_ProjectCreate_DatabaseName_Field, CB_SETCURSEL, (WPARAM) 0, (LPARAM) 0 ); 
		}
		break;

		case 1:
		// Project type selection error
		MessageBox( g_hWndMainFrame, TEXT("You must select a project type to create\0"), TEXT("Create Project\0"), MB_OK );
		SetFocus( lv_ProjectCreate_ProjectType );
		break;

QuestionRe: c++ win32 CreateThread, Wait, final testing Pin
Code-o-mat1-May-12 0:29
Code-o-mat1-May-12 0:29 
AnswerRe: c++ win32 CreateThread, Wait, final testing Pin
jkirkerx1-May-12 6:57
professionaljkirkerx1-May-12 6:57 
AnswerRe: c++ win32 CreateThread, Wait, final testing Pin
Albert Holguin1-May-12 3:46
professionalAlbert Holguin1-May-12 3:46 
GeneralRe: c++ win32 CreateThread, Wait, final testing Pin
jkirkerx1-May-12 6:59
professionaljkirkerx1-May-12 6:59 
AnswerRe: c++ win32 CreateThread, Wait, final testing Pin
Albert Holguin2-May-12 5:35
professionalAlbert Holguin2-May-12 5:35 
AnswerI've traced it down to this Pin
jkirkerx1-May-12 13:55
professionaljkirkerx1-May-12 13:55 
GeneralSolved Now Pin
jkirkerx1-May-12 17:35
professionaljkirkerx1-May-12 17:35 
AnswerRe: Solved Now Pin
Albert Holguin1-May-12 18:22
professionalAlbert Holguin1-May-12 18:22 
GeneralRe: Solved Now Pin
jkirkerx1-May-12 18:33
professionaljkirkerx1-May-12 18:33 
GeneralRe: Solved Now Pin
Albert Holguin2-May-12 5:36
professionalAlbert Holguin2-May-12 5:36 
Question[Win32 C++] VirtualFreeEx() error after WriteProcessMemory() success. But not always. Pin
_Kel_30-Apr-12 12:24
_Kel_30-Apr-12 12:24 
AnswerRe: [Win32 C++] VirtualFreeEx() error after WriteProcessMemory() success. But not always. Pin
Richard Andrew x6430-Apr-12 12:54
professionalRichard Andrew x6430-Apr-12 12:54 
GeneralRe: [Win32 C++] VirtualFreeEx() error after WriteProcessMemory() success. But not always. Pin
_Kel_30-Apr-12 13:18
_Kel_30-Apr-12 13:18 
GeneralRe: [Win32 C++] VirtualFreeEx() error after WriteProcessMemory() success. But not always. Pin
Richard Andrew x6430-Apr-12 13:22
professionalRichard Andrew x6430-Apr-12 13:22 
GeneralRe: [Win32 C++] VirtualFreeEx() error after WriteProcessMemory() success. But not always. Pin
_Kel_30-Apr-12 14:30
_Kel_30-Apr-12 14:30 
GeneralRe: [Win32 C++] VirtualFreeEx() error after WriteProcessMemory() success. But not always. Pin
Richard Andrew x6430-Apr-12 14:43
professionalRichard Andrew x6430-Apr-12 14:43 
QuestionOnInitDialog? Pin
Le Quang Long30-Apr-12 4:38
Le Quang Long30-Apr-12 4:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.