|
Hello all,
The child-thread ends (I trace and find it calls "endthreadex()").
But why in the parent thread, after the childthread ends, the function GetExitCodeThread(ChildThreadHandle, ...) returns TRUE, and the ExitCode = "STILL_ACTIVE" ?
Does the child-thread really end ? If it not, why?
The function WaitForSingleObject() which waits the child-thread to end also can't return.
Thanks a lot
|
|
|
|
|
To quote from the documentation for _endthreadex...
"Like the Win32 ExitThread API, _endthreadex does not close the thread handle. Therefore, when you use _beginthreadex and _endthreadex, you must close the thread handle by calling the Win32 CloseHandle API."
This may answer your question.
Iain.
|
|
|
|
|
Hi
I have installed a program but when i try to run it, it gives me a horrible error:
the procedure entry point RtlStringFromGUID could not be located in the dynamic link library NTDLL.DLL.
Anyone any ideas?
Greetings
Sera
|
|
|
|
|
If you're on Windows 95, 98 or ME, forget it: these systems do not have NTDLL.DLL.
Windows 2000 and Windows XP both have this function in NTDLL.DLL.
Programmers should not be using NTDLL directly because its interface is undocumented [edit]and is therefore subject to change[/edit]. The programmer should probably have used StringFromGUID2 , which lives in OLE32.DLL.
|
|
|
|
|
Ok. But the strange thing is .. I have never called a function like that.
When do i use NTDLL directly anyways?
Greetings
|
|
|
|
|
Try the dependency walker (depends.exe) on your application. It will show what is referenced, and how, and will show which entry points are not satisfied.
It should be straight-forward to pinpoint the culprit, but essentially you need to go back to the manufacturer of your software (which might be yourself)
Good luck.
Bernd
|
|
|
|
|
Hi,
My project is working fine on my machine, but when I tried to run it on another computer, all hell went loose!!! LoadLibrary now returns error 126, even though the path to the dll is correct (ie e:\program files\edovia\some app\res.dll)! The DLL I'm loading is just for resources, should I use LoadLibraryEx() with LOAD_LIBRARY_AS_DATAFILE instead?
What could cause such a behaviour?
---------------
Tired of Spam? InboxShield for Microsoft® Outlook® 2K/2K2/2K3
http://www.inboxshield.com
|
|
|
|
|
If you're just creating a DLL with resources in, add the linker switch /NOENTRY.
I suspect the linker has linked in the C run-time startup code as the entry point, and that's loaded the C run-time DLL. The test system probably doesn't have the same version.
To check dependencies for an executable or library, use Dependency Walker[^].
|
|
|
|
|
|
Hej folx!
i am writing a graphic editor and have to paint a shaded bar, for example from dark blue to light blue back to dark blue or similar. so i tried the simple way with CPen:
for (...) // from left to right
{
pen.CreatePen (..); // with calced color
dc.SelectObject (pen); // select
dc.MoveTo (..); dc.LineTo (..) // paint line
dc.SelectStockObject (BLACK_PEN); // deselect
pen.DeleteObject (); // kill for new color
}
but this is far too slow for pics with lots of bars.
I've also tried it with creating a bitmap, filling it with "SetBitmapBits" and copying it in my dc, but the speed even gets slower..
So my question is: is there any chance to change the color of an existing pen without all that "delete/create/select" each time?
and if not .. do you know why or another solution?
thanx a lot in advance
|
|
|
|
|
No, there's no way to change the colour of an existing pen. You have to create a new pen of the colour you want to use.
Windows 98 added the GradientFill function, which you should use, unless you also want to support Windows 95. This results in one call to the graphics driver which (if it supports it) can accelerate the operation.
Note that CDC::MoveTo returns the previous drawing position. This is done by calling the underlying ::MoveToEx, passing a CPoint as the last parameter. This causes the current GDI batch to be flushed on NT-based systems, which is a relatively expensive operation (it results in a system call to process the batch). To avoid this, since you're not using the return value, call ::MoveToEx yourself and pass NULL for the lpPoint parameter.
The batch is also flushed whenever you change objects with SelectObject , so you should do as much drawing with a given set of objects as possible. In this case, you should draw from each end towards the middle, using the same pen (or brush, see below) for one segment on the left and for the opposite segment on the right.
If you have to do it yourself, consider using FillRect rather than drawing a line. You use a brush to perform fills, rather than a pen. If the overall bar is wider than the number of colours available (can happen), you'll need to draw more than one pixel's width of a given colour.
|
|
|
|
|
it works much faster with GradientFill..
|
|
|
|
|
Is there any reason why you can't create the Pens you need before the loop, select them into the dc on demand inside the loop, and delete them after the loop? I suspect that it's the creation and deletion that takes time, not the selection/deselection.
/Steen
Cheers
Steen.
"To claim that computer games influence children is ridiculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
I second this approach.
Create and deallocate your gdi objects outside of your loop and I bet you'll see a massive increase in performance.
I Dream of Absolute Zero
|
|
|
|
|
Some optimisations have already been suugested.
I would suggest using GradientFill is possible. If not, use CDC::FillSolidRect. It doesn't actually
create pens / brushes, but instead sets the background text colour write a blank string into your
rectangle.
Iain.
|
|
|
|
|
Why not load a bitmap (with any gradient that you need)?
"Gods die, when their believers are gone." --from Sandman by Neil Gaiman
|
|
|
|
|
Hi!
How do I use time.h to get milliseconds?
I will write the time as,
hour:min:sec:ms, 13:14:59:123
Thankful for your help
|
|
|
|
|
Hi !
I assume that you know how to get the current time using time_t or __time64_t structures with the appropriate call function. When the call is complete, the member millitm of the structure contains the excess milliseconds.
If you are needing to get the elapsed time in milliseconds, just first calculate the elapsed time in seconds and add the millitm member after your second-millisecond separator.
For an example, search MSDN with keyword '_time64'.
If this wasn't what you meant, please specify in more detail.
-Antti KEskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Hi. Has anyone tried to build up an Visual C++ application that sends messages using WAP's Push Access Protocol? I have. But I don't know how to do this. What tools can I use (for Proxy Gateway, for Phone Simulator) for my computer to become a stand-alone Push Initiator + Proxy Gateway + WAP Phone Simulator for my application to test on? Examples of code would be considered very usefull.
Thank you
|
|
|
|
|
Hi,
Can anyone help how to transmit BEEPS from telnet server to client.
I have code for telnet server.But i see BEEPS are not getting redirected to client.
Named pipes are used in telnet server...Pls help
Thnks
Ram
|
|
|
|
|
If you are referring to the ASCII 'beep' or bell code, then it is value 0x7. Of course, it all depends on whether the client knows what to do with the beep...
|
|
|
|
|
Hi everyone,
I have a question about SQLBindParameter function. I use this to get return values from SQL server stored procedures. I have the following code, if I want to get an integer:
struct BindParams
{
SQLUSMALLINT ParameterNumber;
SQLSMALLINT InputOutputType;
SQLSMALLINT ValueType;
SQLSMALLINT ParameterType;
SQLUINTEGER ColumnSize;
SQLSMALLINT DecimalDigits;
SQLPOINTER ParameterValuePtr;
SQLINTEGER BufferLength;
SQLINTEGER * StrLen_or_IndPtr;
};
Say, if I want to get an integer back, I use the following:
SDWORD cbParm = SQL_NTS;
BindParams p = {1, SQL_PARAM_OUTPUT,SQL_C_ULONG, SQL_INTEGER,0,0,&myIntVar,0,&cbParm};
And later I call SQLBindParameter with the required parameters.
Thisn works fine. However I would like to get a string back from SQL serve.r I have no idea how to do that. MSDN documentation is really bad on this. So, if someone has any idea on how to do this, I would really appreciate it.
Thanks,
Pankaj
Without struggle, there is no progress
|
|
|
|
|
Hey i am having the coding for shared memory. But, with the help of that its diificult to me to get the idea abt shared memory. so, pls any one just say what the procedure have to do if i have to develop an shared memory concept file. Just say the logic(wat to do and how to do it) no of the codes.
Thankfull to u..... if done so.,
;
Shanmuga Sundar.V
|
|
|
|
|
Consider looking in the MSDN Reference with keyword 'CSharedFile'. This MFC class is responsible for creating memory-based shared files. Memory files are just like disk files, with the exclusion that they reside in the RAM instead of the hard drive. Shared memory-files, in addition, are accessible from every process of a computer.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Hello all !!
I have a SDI application in wich I plot points on a chart (every 13 msec I plot a new point). I created also a separate Thread in wich I acquire the points and store them in a buffer (from the Doc class). I cannot plot the points directly from that Thread (some conflicts appears and I have runtime errors).
So, the points are plotted on the OnIddle() event from the App class. Up to here, everything works fine !!
BUT, sometimes I need to display a dialog box and so, the points are no more plotted behind. So, I was thinking about two solutions: create a separate thread just for displaying the box. But I think that's a little bit heavy . (This is different message box so I wanted to create a function to wich I send the message box and that will create the Thread).
The other solution was to use modeless dialog but there, the problem is that I need to take some specific actions when the dialog is closed...
So, can anybody give me some guidelines or some help ?
Thanks a lots
|
|
|
|