Hello, is there anybody who knows the command for this? I want to check if a program was shut down by an accident and then start it again (by using CreateProcess). Thanks for any help
Vassili
Posts
-
check if external program runs -
Convert CString to char *How can I convert a CString to a char * variable? CString str; char *szBuffer; //code . . . szBuffer = (const char *) str; //why does this not work, and what do I have to do?
-
How to change the captionDoes anybody know how to change the caption of the main dialog window dynamicly?
-
How to 'talk' to an OPC serverHello, I need to link my application to an OPC server (write and read data). I have no idea how to do this. Is there anybody who has a simple example? Is it the same way as using ODBC or is it complete different thing? Do you know any good books or internet links? Thank you in advance
-
How to hide a button?Thanks a lot! Meanwhile I found that it also seems to work with: myB.ShowWindow(SW_HIDE); and myB.ShowWindow(SW_SHOWNORMAL); Is there a difference between myB.ShowWindow(SW_SHOWNORMAL); and myB.EnableWindow( FALSE ); Another question: In my application I do not have any 'OK' or 'Cancel' buttons. But if I press the enter button on my keybord the application terminates... and I don't know why.
-
How to hide a button?Question: Is it possible to hide and to inactivate a button on a dialogbox if a certain condition has occured?
-
How to send CString with SendMessageHi all, does anybody know what the exact syntax is for sending a CString variable with SendMessage? I have tried every thing you can imagine: UINT MyThread(LPVOID arg) { HWND hMain = (HWND) arg; CString text; text = "Hello"; SendMessage(hMain, WM_SEND_HELLO, 0, (LPARAM &) text); } LRESULT CMyDlg::OnSendHello(WPARAM wParam, LPARAM lParam) { CString* text = (CString *) lParam; return 0; } What is wrong with this code?
-
Termination of a threadHi again, within the while loop I use the function ReadFile(...). This means that if there is nothing to read from the serial port the process will not step to the next line. It will remain in the ReadFile-step until a new information will come through the port. Because of this I can't use a condition like bContinue. On the other hand only the main program knows when to end the thread. So the question is: is there a way to terminate my thread from the main program? If not then I will have to redesign my complete program :-(
-
Termination of a threadYes, it is a worker thread. In my endless while loop I read the serial port. On an port event I send a message to the main program. I also send a message to the main program with the handle of the thread by using GetCurrentThread() UINT TheThread(LPVOID pParam) { HANDLE* pObject = (HANDLE*)pParam; HANDLE hThread; . . . hThread = GetCurrentThread(); SendMessage(pObject, WM_MY_MESSAGE, 0, (LPARAM) hThread); while(1) { //here I read the CommPort . . } return 0; } --In the main Program: LRESULT CMyDlg::MyFunction(WPARAM wParam, LPARAM lParam) { m_hThread = (HANDLE) lParam; //m_hThread is a private HANDLE variable of CMyDlg return 0L; } void CMyDlg::OnWhatEver() { //TerminateThread(m_hThread, -1); //CloseHandle(m_hThread); } If I use TerminateThread((m_hThread, -1) the application disappears but a process is still running which I have to terminate with the Task Manager. If I use CloseHandle(m_hThread) nothing happens... You posted befor that I need simply to exit the thread function - this is exactly what I want to do, but how?
-
Termination of a threadHi, I use a thread, whitch I have created with 'AfxBeginThread'. Within this thread I use an endless while loop [while(1) {//do some thing}]. Is it possible to terminate this thread by the thread-caller? All I could find is to use the TerminateThread function but to do this I have to use before the DuplicateHandle function. Unfortunately I was realy not very successfull by trying this. Can anybody help please? Thanks a lot Vassili
-
Using MScomm32.ocx with Visual Studio.NetHi, I want to use the AciveX component 'MScomm32.ocx' in my Visual C++ project. The registration of mscomm32.ocx seems to be successful with the command 'rundll32 c:\winnt\system32\mscomm32.ocx, DllRegisterServer', but when I try to insert the ActiveX Component 'Microsoft Communications Control' in the project I get the error message that I have no license. It's obviously because I dont't have VB 6.0 installed on my machine. But is there maybe another activex component available which is able to 'talk' to the serial ports including all the features of mscomm32? Or does somewhere a 'free library exist? Thanks a lot Vassili