detect thread lockups

571 byte By bbly at 2007-11-19 12:34:42
My program makes a call into a COM object which is part of a Microsoft service. We have had the occasional problem of this service locking up. this means that my program locks up when it makes a call into the COM object and doesn't return.I have try/catch around the call but the problem is that...

multithreading problem

851 byte By Dman832 at 2007-11-19 12:35:21
I am using VC++ in visual studio dotNET. I wrote a program that has several threads running doing stuff, and a dialog box that is updated by the main thread. Everything works well when I hit "run" in the development environment. But when I run the executable, everything seems fine, but if I so much...

Notepad.exe command line in batch mode

336 byte By oblonski at 2007-11-19 12:35:36
Hi, can any one help me!I'm trying to write a command line which launch notepad.exe, replace a string with another and write a new file in a batch (silent) mode. is that possible ?For Unix users, the "sed" command can do this, is there any equivalent command (msdos) or a nother way to do so ?...

Event when thread ends?

753 byte By Runt888 at 2007-11-19 12:35:40
I'm writing an GUI application that needs to do some lengthy processing. I've got my main thread handling the UI and the event loop. When it needs to do some processing, it creates a new thread to do it. The thread does the processing, and updates some shared variables so the main threa...

PMYDATA : undeclared identifier - My first thread (a crap shoot)

4500 byte By Cerf at 2007-11-19 12:36:32
Hey,I am creating a dll that is used in one of my visual basic programs. The thread will just do some basic background calculations for me#include "stdafx.h"#include "vbThreaded.h"#include <windows.h>UINT CVbThreadedApp::ThreadFunc(){ typedef void (__stdcall *FUNCPTR)(BSTR pbstr); FUNCPTR...

Casting LPVOID to a managed type?

871 byte By Robert123 at 2007-11-19 12:38:13
In my thread function I'm trying to do the following:DWORD WINAPI ThreadFunc(LPVOID lpParam ) { Form1 __gc* ObjectPointer = (Form __gc*)lpParam; ObjectPointer->Write_to_listView(); return 0; } I created the thread in _tWinMain as follows... Form1 __gc* pNewObject = new Form...

Critical sections and Semaphores

297 byte By Rigel at 2007-11-19 12:38:31
Alright silly question. Why is there a distinction between critical sections and semaphores? Isn't a critical section a semaphore with a resource count and maximum resource count of 1? Why didn't the designers just implement a semaphore so it is defaulted as a "critical section"?

allow secondary thread to run before main thread

1819 byte By frutti42 at 2007-11-19 12:38:45
My application is being launched from another application. When launched from that other application, there are two processes or instances that get created. One of the instances is created by a call to the wrapper function that calls CreateProcess. That function also sets the global variable to TRUE...

Exceptions within a thread func

1894 byte By kempofighter at 2007-11-19 12:39:27
I can't quite find an answer to this question so I thought I'd post an example.I found some code where someone throws an exception from within a posix thread func. I don't understand how it could be caught and what an operating system would do if a throw unwinds to the beginning of a...

Help with threads

1550 byte By JernauGurgeh at 2007-11-19 12:46:52
I am writing a program that has a few very processor intensive functions and I want to be able to run these in a thread, so that the main program window is not blocked while the threads are underway, and also if possible to have a progress bar indicating the progress of the thread (I will probably d...

Problem at the end of thread?

723 byte By dtdai78 at 2007-11-19 12:51:57
Hello all,I have a class like this:class ADialog{public://.... bool CheckValid(); static void ThrProg(LPVOID pParam); void CheckData();//...};bool ADialog::CheckValid(){ //... AfxBeginThread((AFX_THREADPROC)ThrProg, (LPVOID)this); //...}void ADialog::ThrProg(LPVOID pParam){ ADialog *p...

How to notify a thread in VC++

172 byte By novice123 at 2007-11-19 12:51:58
Hi,<br/> I have two threads running, how to notify one thread from other. Is it possible ?. I am using VC++ 7.0 <br/> Please let me know .<br/>thanks

Thread question, does this code look OK?

1371 byte By Jim44 at 2007-11-19 12:53:46
pthread_mutex_t *out_queue_mutex; pthread_cond_t *out_queue_chk_cv;... out_queue_mutex = new pthread_mutex_t[threadCount]; out_queue_chk_cv = new pthread_cond_t[threadCount];... for (int i = 0; i < threadCount; i++) { pthread_mutex_init (&out_queue_mutex[i], NULL); p...

create multiple thread under one thread

757 byte By dragondad at 2007-11-19 12:54:13
I have a project to convert the existing multiple process model to multiple thread model. Beside the benefit I can get from the multiple thread model (NO more IPC, yes), one real concern is that I have to create multiple thread under one of the thread. The story is like this, the main program shou...

suspend activex flash during fscommand

494 byte By brandon8863 at 2007-11-19 12:54:25
I've created a simple C++ MFC project in VC7. I added an activex shockwave flash com object to the project dialog and added the fscommand event.When I handle the fscommand from C++, is there a way to suspend the Activex flash thread in the App until right before I send the setVariable command t...

crash at dwRes = WaitForSingleObject(*m_hSemaphore, 45000);

1340 byte By mohamed123 at 2007-11-19 12:59:54
here is my code for making a pic from a camera************** void CPreviewTestDlg::OnCapture(){ GetDlgItem(IDC_BTNCAPTURE)->EnableWindow(FALSE); if(cam1Connected) { if(strName!="NOSELECTION") { waitPreviewThread(&m_hSem); cam1Capture = TRUE; cam1PicCounter++; getFileName(cam1PicCounte...

multithreading locks my form

385 byte By rantech at 2007-11-19 13:01:59
i have a multithreaded app(dialog based) . when the threads are running the main form isn't responding .i tried with DoEvents() to dispatch the messages but i don't really like the results . so i understand that the solution would be a gui thread ? or what ?there's anybody here that c...

simplest thread program doesnt work

564 byte By Organize at 2007-11-19 13:03:43
DWORD WINAPI tredu (LPVOID lpParam );int APIENTRY WinMain(HINSTANCE a,HINSTANCE b,LPSTR comanda,int arata){ HANDLE hThread; DWORD dwID,dwThrdParam = 1; hThread = CreateThread (NULL, 0,tredu ,&dwThrdParam, 0, &dwID); if (hThread==NULL) MessageBox(0,"a","a",MB_OK); return 0;}DWORD WINAPI tredu (L...

Newbie encounter with multithreading?

1373 byte By dp_76 at 2007-11-19 13:04:02
HiI have to convert a single-threaded windows explorer type MFC SDI application into a multi threaded one.I have gone thru few multithreading articles & has decided to follow the following path:In the project, there is one user defined class(process.cpp) that does all the processing work.In this cpp...

PostThreadMessage not received in time

647 byte By DumbMonkey at 2007-11-19 13:14:47
Hi all,I wonder if anyone could give me some suggestions on this problem.I have a thread running in a class with a GetMessage(...) function.In another class I am posting messages to the thread with PostThreadMessage(ThreadID, WM_SOMETHING, MessageLength, (LONG) Message);The problem I have is that th...

How to use threads in c language

508 byte By shamaila at 2007-11-19 13:22:35
hi to alli m doing project related to networking using c-language and linux operating system .Now i want to transfer a file from client to server using SRTP packets.SRTP is(secure real time protocol i.e use for security of real time protocol ) and for this i hav to use threads as i hav to send SRTP...

how to change and pass thread parameter back to main

299 byte By dragondad at 2007-11-19 13:29:17
I have a question no solution yet, when we call pthread_create, we can pass the parameter to thread function, but how can we change the passed parameter, and pass it back to main().<br/> If you know how to do it, please give me a short sample, or just a URL you think will be helpful.<br/> Thanks.

How to create a thread is suspended state using pthreads

172 byte By shim at 2007-11-19 13:31:56
Hi all,<br/>I just want to know how to create a thread in suspended state using pthreads and after creation how (which api) to kickstart that thread?<br/>Regards,

Simple question about CWinThreads ResumeThread()

945 byte By Dan|] at 2007-11-19 13:37:41
Hello,Just a(naive) question - or two - about resuming a thread, created suspended.1. Let's say that we have a class:"//MyThreads header...class MyThread :: public CWinThread {...BOOL InitInstance();Procedure();...HANDLE m_hEventKill;/* in the contructor is initialized m_hEventKill = CreateEven...

Multithreading

1827 byte By nazgul27 at 2007-11-19 13:41:29
Guys, here is the problem.CCriticalSection cs;class Server{ struct LiveData { LiveData () {++id;} static int id; }; std::deque <LiveData> deq;}// working threadUINT Thread (LPVOID p){ Server* pDlg = (Server*) p; ....... p->AddLiveData (); ::Post...

first thread - linker error

844 byte By vc185002 at 2007-11-19 13:42:07
Hi i am new to threadi had proceded this wayI created a Class MyThead derived from CWInThread and these were the members which i createdpublic: static CRITICAL_SECTION viren; MyThread(); virtual ~MyThread(); virtual BOOL InitInstance(); virtual int ExitInstance(); void Maintr(); but when i tried v...

Working Thread Question

255 byte By Dan|] at 2007-11-19 13:46:07
Hi all, <br/>Just a simple question for my own edification: <br/>The only way to end a working thread is from the controlling function ?<br/>If there is a way to stop it otherwise, please give me a hint.<br/>Respectfully thanks,<br/>DD

list of all threads ( pthread_ts ) in a process

165 byte By shex at 2007-11-19 13:48:03
Hi<br/>I'm using pthread library, is there a way of getting all pthread_id of all my siblings threads (in my process)?<br/>Thanks in advance<br/>Oren

Ansychronous fire & forget?

1060 byte By Spiny at 2007-11-19 13:51:48
HiI'm an experienced developer, but only recently come to .NET. Would anyone be so kind as to shed some light on a question?I have a requirement to code a method that's called (indirectly) from a web service. The method needs to run asynchronously with the web method returning, possibly be...

Multithreading: Creating Threads Within Threads?

1989 byte By tkrampe at 2007-11-19 13:51:56
Hi, I'm a bit new to C# and I had a question about something that I can't figure out and can't seem to find any documentation on. In a program that I am writing I have a bit of code that contacts a server and builds up the folder structure of a given directory(i.e. sub directories, f...

threads and httpwebrequest

393 byte By unni1 at 2007-11-19 13:57:48
hi all, i ve a problem in httprequest.when i try to send 2 requests in one function using keepalive = "true" it is using single channel to send request to server. but when i tried same thing using two threads and calling two diff. functions then it is creating another channel for second request.so...

Cannot call a class member function from thread

4206 byte By Biancazzurri at 2007-11-19 13:59:57
Hi, I have a problem:3 classes:Opengl.h1)class OpenGL{ private: static HGLRC hRC;// Rendering Context static HDC hDC; //Device Context static HWND hWnd; static HINSTANCE hInstance; static bool active; static bool fullscreen; public: OpenGL (); ~OpenGL (); static bool Active...

Accessing struct members in side a thread

1041 byte By redspider at 2007-11-19 14:01:14
What im trying todo is access struct members inside a thread and use the same struct for every thread, the code here compiles fine but when it runs i get a popup saying the memory cannot be found bla bla bla , What am i doing rong ?The output i want is - 1234 #define X_THREADS 4typedef struct ThrStc...

After putting dialog in child thread, GetDlgItm no longer works

1051 byte By koden at 2007-11-19 14:02:38
CButton *lpStart = (CButton*)GetDlgItem(IDC_STARTBUTTON); CButton *lpExit = (CButton*)GetDlgItem(IDCANCEL); CEdit *lpLog = (CEdit *)GetDlgItem(IDC_LOG);The above used to work when it wasn't a thread. It gives the following errors now:C:\...testDlg.cpp(239) : error C2352: 'CWnd::GetDlgItem...

MFC Threads and Messages

233 byte By koden at 2007-11-19 14:02:42
I can't seem to get this: http://www.dev-archive.com/forum/showthread.php?t=359456 to work. Instead, is it possible to make my own message handler and send a message on one thread, catching it on another thread?<br/>Thanks

::PostThreadMessage not working:(

958 byte By Vaderman at 2007-11-19 14:04:22
I've performed the following steps to create a thread:HANDLE wait_a_bit = ::CreateEvent(NULL, TRUE, FALSE, RUNNING_EVENT);::WaitForSingleObject(wait_a_bit, 10); // synchronise threads // doing some code here... The Thread is created in DLL, then returns the Thread_ID of the newly created thr...

Threads ahhhh

774 byte By polus at 2007-11-19 14:04:48
Hi, Im trying to create a worker thread and have followed/read several guides. I get this error when trying to compile:error C2665: 'AfxBeginThread' : none of the 2 overloads can convert parameter 1 from type 'void (void)'I dont understand, there is a funtion that takes void, voi...

Semaphore not releasing

1681 byte By freax at 2007-11-19 14:07:13
I am making an application which requires sending data from a thread to another thread. For that, I am sending a commom variable into all threads. For synchronization, I am using semaphores. However, a simple trial isn't working. The ReleaseSemaphore isn't working. Am pasting the code here...

Database development & Multithreading in VC++

819 byte By Vaderman at 2007-11-19 14:07:20
I don't usually do this but I wanted to keep my skills in this area in check...What sort of questions should I be asking myself when it comes to the above? Once I know this then I can go away and study the field(s) of concern. I am starting to design and develop a database for a client (this...

How to tell if a Worker thread is suspended

355 byte By charris67 at 2007-11-19 14:09:28
I'm kinda new to threads. I have a worker thread that is frequently suspended and resumed. How can I tell if it is currently suspended so that the program won't call SuspendThread more times than ResumeThread?would like to do something like this...if(thread is suspended){ resume thre...

Random thread numbers

539 byte By redspider at 2007-11-19 14:10:33
Need help with random thread numbers.I have a function that makes threads , the number of threads depends on user input.So i need to have the right amount of HANDLE's for the threads, but the amount needs to be a const int eg.const int threads = 5;DWORD dwThreadId[threads];HANDLE hThread[threa...

MFC Threads and Messages

7226 byte By rohini2018 at 2007-11-19 14:14:45
hii am developing a messenger in VC++ using CAsyncSocket class. problem is that multiple connections could not be established on a system. for that multithreading need to be used but my worker threads are not working.I am new to socket as well as thread programming. please help.I have derived two cl...

Catch message when createprocess app minimized?

573 byte By bleah at 2007-11-19 14:18:18
HelloIs it possible to catch message when program launched with createprocess / shellexecuteex is minimized? I'm working with Pocket PC program and I need to open media player from my own application. When media player is closed my own application should become active again. Problem is that in...

A problem about thread and timer(with source code),help me.

1657 byte By wsun at 2007-11-19 14:19:49
i have met a problem, below is my source code.My purpose is that :after 4senconds, it will come out of the "SubThread",and return to the main thread. I have tried many times,but still failed ,please help me.Thankscode:#include "iostream.h"#include "stdio.h"#include "windows.h"DWORD WINAPI SubThread...

Always need a single threaded function to initialize synchronization objects?

937 byte By fmilano at 2007-11-19 14:22:18
Hi,I was wondering if its possible to create, for example, a Critical Section in a multithreaded environment. In other words, I know that you may not call InitializeCriticalSection more than once with the same pointer before you call DeleteCriticalSection. Anyway I want to know if there's a way...

Assert in ODBC Multi-threaded App

1822 byte By Koolski at 2007-11-19 14:22:55
Hello All,I'm working on an application that has at least 5 threads running at any given time, one of which is solely responsible for writing data to a database (MS Access). It does this via a list of records waiting to be written that is populated by one or more of the other threads. The wri...

thread

288 byte By sky_00 at 2007-11-19 14:23:24
UNIT WorkerThread(LPVOID Param);<br/>Have to make this non-static member of dialog class in order to access its members during WorkerThread run.<br/>But AfxBeginThread((void)WorkerThread,..);<br/>does not lunch the thread?. can't make it non-member(??) and can't make it static.

CWinThread + Timer

349 byte By Tischnoetentoet at 2007-11-19 14:25:15
Hi all,I need a timer in my thread, and I need it quick :)I searched, and found some usefull information. I am starting my function like this:::SetTimer(NULL, TIMER_MYTIMER, 50, NULL);I have a message map:ON_THREAD_MESSAGE(WM_TIMER, OnTimer)But my timer function is never called. Any ideas why?...

ATL and Threading

417 byte By definition at 2007-11-19 14:28:15
hey guys I need to make a body of a method I have safe. Its defined as multithreaded.class ATL_NO_VTABLE CDiscover : public CComObjectRootEx<CComMultiThreadModel>,but i dont understand how to use CComCritSecLock or any atl template to do this, I need to ensure an exceptions that are throw re...

display modeless dialog from threads

769 byte By kenn at 2007-11-19 14:28:17
Hi all, I'm writing a chat llibrary (dll with MFC statically linked) that will do something like this: -a thread will listen on port N it accepts incomming request, create new thread to process this request, the new thread will validate information, and then pop up a simple chat dialog...