|
Use the ES_WANTRETURN style.
CPUA 0x5041
Sonork 100.11743 Chicken Little
"So it can now be written in stone as a testament to humanities achievments "PJ did Pi at CP"." Colin Davies
Within you lies the power for good - Use it!
|
|
|
|
|
Or ::PreTranslateMessage in the dlg or mainframe,
And I swallow a small raisin.
|
|
|
|
|
Does anyone know how I can extract a specific icon format from an icon file?
I have an application with an icon associated with (IDR_MAINFRAME as usual) but it actually contains 10 different icon formats (such as 16 x 16, 16 colours; 48 x 48, 256 colours; etc). I want to be able to be able to pass a particular icon format as an HICON as a parameter to a function.
Any ideas?
Derek Lakin.
I wish I was what I thought I was when I wished I was what I am.
Salamander Software Ltd.
|
|
|
|
|
You can use LoadImage() to specify the size and color depth you want to load. It will load the format that comes closest to what you specify.
Shog9
|
|
|
|
|
I want add a checkbox before each item in a treectrl.And I want make it multi-selection.How do I?
Need your help.
Sincerely,Pole.
|
|
|
|
|
Add the TVS_CHECKBOXES style to your tree control.
There's always one more bug.
|
|
|
|
|
Thanks for your help.
Sincerely,Pole.
|
|
|
|
|
??
Any code by change? I want the caption bar to look XP-like
even if it's operating in an non-XP environment.
Please, any response any one can give me will be greatly
appreciated.
Sincerely,
Danielle (an overworked graduate student)
|
|
|
|
|
There are examples here at CP of how to pain a custom caption.
|
|
|
|
|
Any code out there that highlights a check box when a mouse
hovers over it?
|
|
|
|
|
I am running into the case where the system is running our of memory so new and malloc are returning 0 causing our application to crash. Of course windows is totally hosed at this point as well (it doesn't handle out of memory situations very well). Checking for allocation failures everywhere would be huge task and I am concerned that it would not add much value. What do you guys do about this? Do you actually check for failures and handle them? If so, how do you handle them? Thanks!
Chris
PS - I have setup a new handler with a safety buffer to ensure that I have enough memory to display a warning message to allow the user to logout, but this is till not good enough.
|
|
|
|
|
Chris Hafey wrote:
Do you actually check for failures and handle them?
yes.
Chris Hafey wrote:
If so, how do you handle them?
all of my apps use a common error code system, so i just return the appropriate error code. eventually that error will work its way back to the UI, which will give the user a nice message box.
-c
Though the cough, hough and hiccough so unsought would plough me through,
enough that I o'er life's dark lough my thorough course pursue.
--Stuart Kidd
|
|
|
|
|
Chris Hafey wrote:
Checking for allocation failures everywhere would be huge task and I am concerned that it would not add much value.
Your concerns are unfounded. However, people using your software should be really concerned. You are excercising very dangerous practices. I hope you very soon learn the errors of your ways before you hurt anyone but yourself...
What do you guys do about this?
Check every single allocation.
Do you actually check for failures and handle them?
Are you trolling, or is it that you really don't know?! Of course you have to check for failures!
If so, how do you handle them?
In the appropriate way. There's no way to know how your application should handle failures. If not even you, the developer, know what to do in case of a failure in your own application...
I'm speechless.
Would you mind telling us the name of this application? Using it would be like juggling with handgrenades with the safety off, and I sure don't want to come anywhere near it.
|
|
|
|
|
I'm back again with the same old bullshit. I can't figure out what the deal is. The app runs fine on 2000, XP, and NT. I watch the GDI resources in the task list of 2000 and XP and the number of GDI objects being used does increase slightly during execution of the application when I perform specific operations. Not a tremendous amount, though--It's tolerable. The problem is, when I run it on Windows 98, the % of GDI resources being used goes up significantly when I perform those same operations and soon enough, the app crashes because the computer is out of memory. I'm not sure what could be the difference between XP/2000/NT and 98 as far as GDI resources are concerned. Can anyone help me out?
|
|
|
|
|
Oops, sounds similar to my problem.
I have tried only Win98, and I see the same symptoms when I'm stepping into my program with the debugger. Doesn't happen in any other case...
Can you describe in which circumstances you see your problem? App running alone, in Visual, in the debugger...?
Thanks,
Eric
|
|
|
|
|
98 has a limited ammount of memory (128K I think) that can be used for resources while NT does not (other than available memory of course). You state that your application has a resource leak, begin by fixing this. Make sure that you aren't keeping allocated resources around, you need to allocate and free them for each use. Keeping things like bitmaps around as datamembers is a sure way of running our of resources.
Chris Hafey
|
|
|
|
|
Actually, I'm trying to figure out why the fixes that I made to the app to get rid of the memory leaks work in 2000, XP, and NT, but they don't work in 98. I fixed a few things in the app that I found were causing leaks and changed a few things. When I run the app in 2000, XP, or NT, I don't see any increase in GDI resource allocation other than for things like dialogs etc... More often than not, the resource level comes back down to about what it started at. On the other hand, when I run the same app in 98, I run out of resources quite rapidly and it ends up shutting the app down. I'm just trying to find out why my changes work in one OS and not in another.
|
|
|
|
|
Great, I've isolated my debugging problem thanks to your help.
I'm simply debugging in one thread while another thread keeps refreshing the window in my back. Of course, because I'm stepping slowly, the resources keeps buffering in the refresh and the whole thing explodes rather quickly (somewhere out of my scope, I'm afraid).
At least, I know now a walkaround.
Thanks again,
Eric
|
|
|
|
|
Hi,
I have a question that for some could be one of the more challenging part of the design process for most winsock applications using Win32 API winsock tools. However, at the same time it is so fundamental among all winsock applications.
I am working on a client winsock program. The client logs onto a server and send and receive data. I am using WAsyncSelect() I/O model. The problem is current I can only program the application to support one client at a time. For example, let say the application is communication. The client sends messages to the server. Currently, the application can only communicate with one server at a time. I would like to be able to connect to multiple servers simultaneously.
The problem is I do not know which I/O model is best in the case above. With WAsyncSelect(), Windows manages the I/O notices. For example, if there are incoming data, Windows sends you a message FD_READ. My main concern is if I use this model and assign multiple sockets, how would I know which socket WAsyncSelect() refers to when it sends the application messaging such as FD_READ, FD_WRITE, and FD_CLOSE?
What I/O model do you recommend for a client program supporting multiple connections simultaneously?
Thanks,
Kuphryn
|
|
|
|
|
Hello, the codegurus around the world.;)
Even though I simply work for the server accepted by the mutiple clients,
the approach must be same.
We can use the linked list and create something like FindClientSocket
to find the only one client socket in FD_READ message handlers.
Or we can use CAsynsSocket and use CObList to restore the mutiple
client socket, and then try to find only one client socket by for loop.
Good Luck!
Please, don't send me your email about your questions directly.
Have a nice day!
Sonork - 100.10571:vcdeveloper
-Masaaki Onishi-
|
|
|
|
|
Thanks. I believe that is a good design. I am working on a design that include insertion of sockets into a STL data structure.
I will need some time to incorporate this new algorithm into the program.
Kuphryn
|
|
|
|
|
I don't know if i'm remembering correctly or if sleep deprivation will really make you remember things that don't really exist.
Anyways...a while back I could have swore I seen an article on how to make subclassed/custom controls flicker free while painting in DrawItem() . I'm not referring to Keith Rules CMemDC or any other *flicker free* articles this was more "What to do after this" like overriding OnEraseBkgnd for the controls parent and the control itself and this is why!!!
Am I dreaming or is there a article like this on CP I can't find it...i've tried Owner draw, flicker free, CListCtrl etc...and returned bunk results...i'd really appreciate if someone could show me the way...
Thanx in advance!
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
I have done some reading on codeguru in hopes of finding what I was looking for and could only find an article.
The author suggests using his method of SetRedraw() and of course the comments that follow were interesting also.
Some say LockWindowUpdate(), but others say it's bad cuz it makes the rest of the screen flicker. One author displays a custom CListCtrl with it's OnPaint() and OnEraseBkgnd() over ridden...
You can do this...??? I think i've tried OnPaint before in the past to little if no success...am I wrong...?
I'm growing tired of looking for this info...I hope someone has an aswer for me...
Now i'm really tired so perhaps I should sleep
That feels nice...
cheers
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
I have just bought a book on ATL COM and the author uses the reinterpret_cast<> operator. It seems like type casting would do the same thing. Can anyone tell me if there are advantages to one over the other, or is just preference?
Thanks
|
|
|
|
|
The advantage of using C++'s new standing casting technques including static_cast, reinterpret_cast, const_cast, and dynamic_cast is control. With these new casting standards, you know exact what type of cast the compiler will interpret from your code.
Kuphryn
|
|
|
|