|
Maybe you are calling ResetContent() somewhere in your OnInitDialog() ?
Philip Patrick
"Two beer or not two beer?" (Shakesbeer)
Web-site: www.saintopatrick.com
|
|
|
|
|
How do I access a MFC ActiveX .OCX interface in VC that was created in VC?
Thanks in advance...
~Timothy T. Rymer
www.digipen.edu
tim.xpertz.com
|
|
|
|
|
Assuming that CLSID_ISomeInterface is the class id of interface you want to access, so the code of getting it should be like this:
ISomeInterface* pInterface = NULL;
CoCreateInstance(CLSID_ISomeInterface, NULL, CLSCTX_INPROC_SERVER,
IID_ISomeInterface, (void**)&pInterface );
the pInterface will contain your interface.
But the code can be different for different ActiveXs. If you want to know exactly, tell what interface you want to access.
Philip Patrick
"Two beer or not two beer?" (Shakesbeer)
Web-site: www.saintopatrick.com
|
|
|
|
|
I am trying to write a simple dialog based multi-threaded app that has a worker thread doing blocking socket reads from a non windows server (no serialization) and updating progress controlls on the dialog window (like an ftp app).
I first tried following the MFC examples, deriving my thread class from CWinThread. This runs, but doesn't work correctly. Windows messages, like scrolling, are blocked at times to all applications (not just my app). I tried setting the thread priority to the lowest, but still had problems with blocking. I guessed this was due to the thread being derived from CWinThread and having message maps, but unfortunatly the VC help files I found only talked about making worker threads from functions.
I searched and found a CThread class here on codeproject.com, and I switched my code over, deriving my worker class from the CThread class and eliminating the message maps for my worker thread (which I guess was realy a UI thread). Still the problem presents itself.
Any pointers to a multi-threaded application that updates a user interface with status progress while doing blocking work with another thread, or any other suggestions would be greatly appreciated.
|
|
|
|
|
Take a look at _beginthreadex() in MSDN, I always use it for creating threads. I really hate those thread-classes...
If you want to update a progressbar, from the thread, you can pass a pointer to the progressbar, to the thread, using the "void *arglist" parameter.
Then you can access the progressbar from your thread.
If you need to access the progressbar, at the same time, from the main thread, you can make some easy syncronizing using a Critical Section...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
I can give switching _beginthreadex() a try, and would be more willing to with some examples of using that to start a class instead of a function, but before I try, do you think that will help my problem? Will that make my blocking calls in the worker thread not affect the rest of the system?
I am not even sure if the blocking calls are the problem, or if it is due to the thread working so hard and using all cpu (as I stated before, I have tried the lowest thread priority with the same results). My mouse never has a problem moving, but waiting for a response to mouse clicks, scroll bar moves, etc on any app that is running, including my own and the windows task bar sometimes take a long time to respond.
Let me explain that better. While the transfer is happening, for about half of the time the computer is very responsive. The other half of the time it can be a few seconds or longer before the system responds. It jumps between the two states of responsiveness without any apparent pattern. Sometimes it will be very response although the worker thread is transferring a lot of data. Othertimes it will be unresponsive during the same condition.
As for updating a progress meter, origionaly I accessed the progress controll directly. My worker thread class has a member that points to it's owner thread -- the dialog. I was accessing the dialog's progress controll CProgressControll directly that way. By doing that, or even just having TRACE messages everywhere I would normaly step the progress bar, caused the system to crash after a partial 'download', and never at the same place. It was like I was sending too many messages for it (1.4Ghz) to keep up with.
Currently I have the worker thread update members on the owner thread, and an OnTimer on the owner thread/dialog to update the progress bars. That works better, the system doesn't crash and when messages are getting through the status update happens.
Has anyone seen a code example for something like an ftp transfer in a worker thread class using blocking winsock, with smooth and accurate status updates in a dialog thread class?
|
|
|
|
|
Jacob Anawalt wrote:
Will that make my blocking calls in the worker thread not affect the rest of the system?
I have never seen blocking calls effect the whole system, at least not if the thread have a low priority.
Are you running Win9x or NT/2k/XP?
Jacob Anawalt wrote:
While the transfer is happening, for about half of the time the computer is very responsive. The other half of the time it can be a few seconds or longer before the system responds. It jumps between the two states of responsiveness without any apparent pattern. Sometimes it will be very response although the worker thread is transferring a lot of data. Othertimes it will be unresponsive during the same condition.
I have no idea why this is happening, I have never seen anything like that. But, I always use NT/Win2k, and they handle threads a lot better that Win9x systems...
Another option would be to move away from the blocking socket, and use a async socket instead...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Is there any freeware libraries for a media player (MP3, MPEG, AVI etc...) that does not need windows media player installed on the clients computer. Something like a third party dll containing MP3 decoder stuff. It will be used as an extra 'bonus' part of another program so it doesnt have to be too complex!
Ive already looked at the Audio/Video section of codeproject and nothing will do the job.
Any thoughts?
.NET or not .NET? MFC is the question......
|
|
|
|
|
Oddly enough the sample that exists on CP is under an example for skinable apps. But there is full source here somewhere for playing mp3s, it's just used in the context of an app that is skanable, like Winamp.
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
There are lots of free decoder libraries, check out sites like www.sourceforge.net
Stephen Caldwell
Blackfission, CEO
http://blackfission.myip.org:81
|
|
|
|
|
I use installshield for microsoft vc++6.0 to make a install programe. No error during setup, but when run the application program,it appear the warning dialog "Failed to create the empty document" in chinese -- i have a chinese version windows 98 in my computer. But it can run correctly in a PC installed VC++6.0. Can you tell me why? How can i solve this mistake? if it's because some dll files failed to install in the system , how can i find which dll file should i install?
thanks
zhaohanqing
Zhao hanqing
|
|
|
|
|
Check the versions of MFC..dlls on the computer with no VS. This can cause a problem
Philip Patrick
"Two beer or not two beer?" (Shakesbeer)
Web-site: www.saintopatrick.com
|
|
|
|
|
Does anyone know how to get a list of all the thread handles in a process on Windows NT4.0? On Windows 2000 and Windows XP the toolhelp32 api can be used, but this is not available on Windows NT 4.0.
Also the process status helper library (PSAPI) has a function to enumerate all processes, but not all threads.
Note, I am interested in the thread handles, not the thread ids as I don't know of a way to get a thread handle if you know a thread id (that works on Windows NT 4.0).
Cheers
Stephen Kellett
--
C++/Java/Win NT/Unix variants
Memory leaks/corruptions/performance/system problems. UK based.
Problems with RSI/WRULD? Contact me for advice.
|
|
|
|
|
Correct me if i'm wrong here i'm a beginner.
Doesn't VC++ 6 have some tools for looking at threads etc... I've been playing around with them myself, however u may be looking for something a bit more techy than them.
I hope this will either ring a few bells in your or other visitors heads as to the matter.
.NET or not .NET? MFC is the question......
|
|
|
|
|
Use the Spy....
But if you want it prgramatically, for each process, you need to open new enumprocess for each process. The process are a tree, and pspi show you every level, you need to open every process for see if you have more sub process...
Best Regards....
Today is Friday!!! and Party!!!
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
Hello everyone,
I thought of posting this in the operating system forum, but it has so little traffic I thought the question would be overlooked.
On Windows XP and Windows 2000 you can use:
HANDLE hThread;
DWORD dwProcessId;
dwProcessId = GetCurrentProcessID();
hThread = OpenThread(..., dwProcessId);
to get a handle to a thread if you know its thread id.
How do I do this on Windows NT 4.0? The OpenThread() function
does not exist in kernel32.dll on Windows NT 4.0.
Hoping someone can help. Kernel mode device driver solutions
are valid, I'll consider any method to get this info.
Stephen Kellett
--
C++/Java/Win NT/Unix variants
Memory leaks/corruptions/performance/system problems. UK based.
Problems with RSI/WRULD? Contact me for advice.
|
|
|
|
|
MSDN says:
Windows NT 4.0 and earlier, Windows 95/98/Me: There is no way to get the thread handle from the thread identifier. If the handles were made available this way, the owning process could fail because another process unexpectedly performed an operation on one of its threads, such as suspending it, resuming it, adjusting its priority, or terminating it. Instead, you must request the handle from the thread creator or the thread itself.
A thread can use the GetCurrentThread function to retrieve a pseudo handle to its own thread object. This pseudo handle is valid only for the calling process; it cannot be inherited or duplicated for use by other processes. To get the real handle to the thread, given a pseudo handle, use the DuplicateHandle function.
|
|
|
|
|
I would like to implement a resizable dialog box with controls in the dialog box resizing along with the dialog borders. I tried adding guides and margins in the Microsoft Dialog Editor, but these margins do not seem to resize along with the dialog borders. Can anyone let me know how I can resize items along dialog borders?
Thanks in advance.
|
|
|
|
|
|
Hey,
First off if this is a really silly question then please excuse me but this is my first attempt at writing an application in c++.
I am trying to write a c++ program that can access a SQL Server database through ODBC/ADO(I don't care how just want it to work). I get c2059 error : 'constant'on the following line:
hr = m_pConnection->Open(_bstr_t(L"driver={sql server};SERVER=(local);Database=loggy;"),_bstr_t(L"sa"),_bstr_t(L"choices"),adModeUnknown);
Every command run after this complains about not being a member of _connection. I am using #import to import the msado15.dll whcih seems to be the best way(after many surfing hours). I would apreciate it if any one could help me. I think I have just put some code in the wrong place or something.
Thank you in advance
Regards
Adam
-------
Like you will ever visit my sites...
www.ufowatch.com - Seen a UFO then report it here or view over 500 different reports.
www.clubpages.co.uk - Taking the Bournemouth club scene through the millenium
|
|
|
|
|
I have lost the Admin password to a VSS database. Without this I can no longer run the SS Admin tool. Does anyone have an idea of how to recover for this situation?
Thanks.
Chris Meech
|
|
|
|
|
After a couple of hours searching through Google, I hit this great link.
http://groups.google.com/groups?q=VSS+ADMIN+PASSWORD&selm=93v9ll%24ldt%241%40nnrp1.deja.com&rnum=6
It gives a procedure for removing the password requirement for Admin. You use a hex editor to replace some values in the database's um.dat file and presto, you can now start the Admin utility without being prompted for a password.
Hope this helps out someone else.
Chris Meech
|
|
|
|
|
In a Document/View supported application,
Can i do this.........
CMyDoc::OnFileOpen()
{
...
...
..code
}
CMyView::OnFileOpen()
{
...
...
..another code
}
CMainFrame::OnFileOpen()
{
..
...
...
codes
}
will these code generate on error
|
|
|
|
|
Hi,
i think you will get an error something like function already exits....
regards ( new in vc++ )
Sonu
|
|
|
|
|
Maverick wrote:
will these code generate on error
No you will not get an error
But all three won't get called
Nish [anony posting from a net cafe]
|
|
|
|