Click here to Skip to main content
15,921,941 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Exclude Process Name from Process List Pin
Ryan Binns13-Jul-03 5:00
Ryan Binns13-Jul-03 5:00 
GeneralRe: Exclude Process Name from Process List Pin
parths13-Jul-03 15:39
parths13-Jul-03 15:39 
GeneralRe: Exclude Process Name from Process List Pin
Ryan Binns13-Jul-03 15:45
Ryan Binns13-Jul-03 15:45 
GeneralRe: Exclude Process Name from Process List Pin
parths14-Jul-03 17:25
parths14-Jul-03 17:25 
GeneralRe: Exclude Process Name from Process List Pin
Ryan Binns14-Jul-03 17:40
Ryan Binns14-Jul-03 17:40 
GeneralHelp Required Pin
apocalypse7413-Jul-03 0:46
sussapocalypse7413-Jul-03 0:46 
GeneralRe: Help Required Pin
valikac13-Jul-03 5:42
valikac13-Jul-03 5:42 
Generaloops! Adding a window to console program Pin
DaveE9th13-Jul-03 0:05
DaveE9th13-Jul-03 0:05 
I found this project in the code project archives but I'm getting the error messages at the bottom. I was hoping someone might give me a hand getting this going. Am I missing a header or something? Thanks, Dave

<br />
<br />
/********************** test.cpp **************************/ <br />
<br />
// define _MT so that _beginthread( ) is available <br />
#ifndef _MT <br />
#define _MT <br />
#endif <br />
<br />
#include "stdio.h" <br />
#include "windows.h" <br />
#include "process.h" <br />
#include "resource.h" <br />
<br />
// global flag <br />
bool bDone = false; <br />
<br />
// this function is called by a new thread <br />
void InputThreadProc( void *dummy ) <br />
{ <br />
// create the dialog window <br />
HWNDhWnd = ::CreateDialog(NULL,<br />
MAKEINTRESOURCE(IDD_DIALOG),NULL,NULL); <br />
if ( hWnd!=NULL ) <br />
{ <br />
// show dialog <br />
::ShowWindow(hWnd,SW_SHOW); <br />
} <br />
else <br />
{ <br />
printf("Failed to create dialog\n"); <br />
bDone = true; <br />
return; <br />
} <br />
// message loop to process user input <br />
MSG msg; <br />
while(1) <br />
{ <br />
if ( ::PeekMessage(&msg, hWnd, 0, 0, PM_REMOVE) ) <br />
{ <br />
if ( msg.message==WM_KEYUP ) <br />
{ <br />
int nVirtKey = (int) msg.wParam; <br />
// if the user pressed the ESCAPE key, then <br />
// print the text the user entered and quit <br />
if ( nVirtKey==VK_ESCAPE ) <br />
{ <br />
// get the edit control <br />
HWND hEdit = ::GetDlgItem(hWnd,IDC_EDIT); <br />
if ( hEdit ) <br />
{ <br />
// get the input text the user entered <br />
// and print it to the console window <br />
char pText[3201]; <br />
int nSize = ::GetWindowText( hEdit, <br />
pText, 3200 ); <br />
pText[nSize] = 0; <br />
printf("\nYou have entered the "); <br />
printf("following text in a second ");<br />
printf("thread:\n\n%s\n\n",pText);<br />
} <br />
else <br />
{ <br />
printf("Failed to get edit control\n"); <br />
} <br />
// destroy the dialog and get out of<br />
// the message loop <br />
::DestroyWindow(hWnd); <br />
bDone = true; <br />
break; <br />
} <br />
} <br />
// process message <br />
::TranslateMessage(&msg); <br />
::DispatchMessage(&msg); <br />
} <br />
else <br />
{ <br />
// if there is no message to process, <br />
// then sleep for a while to avoid burning <br />
// too much CPU cycles <br />
::Sleep(100); <br />
} <br />
} <br />
} <br />
<br />
void main( int argc, char** argv ) <br />
{ <br />
printf("Hello, world of console apps\n"); <br />
// create a new thread to allow user input <br />
if( _beginthread(InputThreadProc, 0, NULL )==-1) <br />
{ <br />
printf("Failed to create thread"); <br />
return; <br />
} <br />
// wait for the new thread to finish <br />
while ( !bDone ) <br />
{ <br />
// sleep 3 seonds <br />
::Sleep(3000); <br />
printf("main thread running\n"); <br />
} <br />
} <br />
<br />
/************************** end ************************/ <br />
---------------------------------------------------------<br />
--------------------Configuration: console_window - Win32 Debug--------------------<br />
Compiling...<br />
console_window.cpp<br />
C:\Program Files\Microsoft Visual Studio\MyProjects\console_window\console_window.cpp(20) : error C2065: 'HWNDhWnd' : undeclared identifier<br />
C:\Program Files\Microsoft Visual Studio\MyProjects\console_window\console_window.cpp(21) : error C2065: 'IDD_DIALOG' : undeclared identifier<br />
C:\Program Files\Microsoft Visual Studio\MyProjects\console_window\console_window.cpp(21) : error C2440: '=' : cannot convert from 'struct HWND__ *' to 'int'<br />
This conversion requires a reinterpret_cast, a C-style cast or function-style cast<br />
C:\Program Files\Microsoft Visual Studio\MyProjects\console_window\console_window.cpp(22) : error C2065: 'hWnd' : undeclared identifier<br />
C:\Program Files\Microsoft Visual Studio\MyProjects\console_window\console_window.cpp(47) : error C2065: 'IDC_EDIT' : undeclared identifier<br />
Error executing cl.exe.<br />
<br />
console_window.exe - 5 error(s), 0 warning(s)<br />
<br />



Big Grin | :-D

"The man who reads nothing is better educated than the man who reads nothing but newspapers."- Thomas Jefferson


GeneralRe: oops! Adding a window to console program Pin
PJ Arends13-Jul-03 0:25
professionalPJ Arends13-Jul-03 0:25 
GeneralRe: oops! Adding a window to console program Pin
Ryan Binns13-Jul-03 5:09
Ryan Binns13-Jul-03 5:09 
GeneralRe: oops! Adding a window to console program Pin
adamUK13-Jul-03 6:54
adamUK13-Jul-03 6:54 
GeneralRe: oops! Adding a window to console program Pin
Ryan Binns13-Jul-03 15:20
Ryan Binns13-Jul-03 15:20 
GeneralRe: oops! Adding a window to console program Pin
adamUK14-Jul-03 5:54
adamUK14-Jul-03 5:54 
GeneralRe: oops! Adding a window to console program Pin
DaveE9th13-Jul-03 8:57
DaveE9th13-Jul-03 8:57 
GeneralRe: oops! Adding a window to console program Pin
PJ Arends13-Jul-03 14:22
professionalPJ Arends13-Jul-03 14:22 
GeneralRe: oops! Adding a window to console program Pin
DaveE9th13-Jul-03 19:28
DaveE9th13-Jul-03 19:28 
GeneralRe: oops! Adding a window to console program Pin
jan larsen14-Jul-03 2:49
jan larsen14-Jul-03 2:49 
Generaladding a window to console program Pin
Anonymous12-Jul-03 23:50
Anonymous12-Jul-03 23:50 
QuestionIs this function in the windows98 support? Pin
Alice8012-Jul-03 17:13
Alice8012-Jul-03 17:13 
AnswerRe: Is this function in the windows98 support? Pin
Christian Graus12-Jul-03 18:00
protectorChristian Graus12-Jul-03 18:00 
AnswerRe: Is this function in the windows98 support? Pin
Ryan Binns12-Jul-03 23:36
Ryan Binns12-Jul-03 23:36 
GeneralRe: Is this function in the windows98 support? Pin
Alice8012-Jul-03 23:51
Alice8012-Jul-03 23:51 
GeneralRe: Is this function in the windows98 support? Pin
Ryan Binns13-Jul-03 0:07
Ryan Binns13-Jul-03 0:07 
Questionhow I can insert these unicode characters rightly? Pin
Alice8012-Jul-03 16:54
Alice8012-Jul-03 16:54 
AnswerRe: how I can insert these unicode characters rightly? Pin
Anthony_Yio15-Jul-03 1:16
Anthony_Yio15-Jul-03 1:16 

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.