|
Hello,
in my dialog-based app, I have a multiline read-only edit box and a member variable for it (CEdit m_Edit).
In "OnInitDialog" I want to set some text in my edit box, so I call m_Edit.SetWindowText("Some text..."). My problem is that the text I add is selected. I tried to add SetSel(-1, 0) but it doesn't do anything. How can I make my text unselected ?
Tnx
|
|
|
|
|
I could be wrong, but isn't SetSel(0, -1) to remove focus rather than SetSel(-1, 0) ?
|
|
|
|
|
No it doesn't work
|
|
|
|
|
How about setting the start and end positions to the number of characters in the string???
--
The Obliterator
|
|
|
|
|
Hi,
How can i give a textbox focus and immidiately select it's text so wenn the user begin's to typ he will overwrite the previous text without deleting it first...
greetz willem
|
|
|
|
|
Handle the EN_SETFOCUS message yourself and do this in the EN_SETFOCUS handler:
m_cEditCtrl.SetSel(0, -1, FALSE); Hope that helps
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
Are there any C functions that are able to check types of devices on your computer. For example, I already have the CPU_Clock_Cycles() and GetLastMemoryAddress() rolling to identify speed and RAM size. I was wondering if there are any more available to perhaps check CPU manufacturer, Hard Drive size and other periphrials.
Thanks.
|
|
|
|
|
|
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
|
|
|
|