|
Hello everybody,
In a program i need to change the style of a ComboBox (Using Win32 SDK in ATL) from CBS_DROPDOWN to CBS_DROPDOWNLIST (either way). I tried using SetWindowLong() and ModifyStyle(), but failed in both the ways and failed to get what i want. If anybody knows plz help me. Even i tried with subclassing.
Thanx in advance.
|
|
|
|
|
I think you'll have to re-create the combo - you can't change these styles at runtime. Save the control ID and position, then call DestroyWindow and Create with appropriate styles.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
I want to know why the results of debug version and release version are not identical when using VC++? (My program has no memory leak.)I set 4 level-warning in project settings,and I am sure that all the variables are initialized,but some results aren't the same slightly,for instance:"Waist=75.620499,Knee=36.650490 "in release version and "Waist=75.630901,Knee=37.181105" in debug version.I suspect if the problems consist in float type,thanks for any help.
|
|
|
|
|
Check out Surviving the Release version.
Michael Martin
Pegasystems Pty Ltd
Australia
martm@pegasystems.com
+61 413-004-018
"Don't belong. Never join. Think for yourself. Peace"
- Victor Stone
|
|
|
|
|
I have an appwizard generated SDI app. The one and only change is that my CView is a CHtmlView. The code generates an exception in the 2nd iteration of CHtmlView::OnSize() - so the program crashes immediately. I have a clean windows 2000 SP2 installation, visual studio 6 SP6 and IE5.5.2. Thought it might be a problem with whatever dll contains CHtmlView so I have tried reinstalling IE, etc.
I'm going nuts. Anyone got any ideas?
|
|
|
|
|
Hi there, reader of this message! The problem is this piece of code. I'm using MFC and using the resource manager I've drawn a bitmap button in a dialog box and using class wiz I assigned it, the name m_button. I've put this piece of code in OnInitDialog:
CBitmap bitmap;
bitmap.LoadBitmap(IDB_TREE);
hBitMap = (HBITMAP)bitmap;
m_button.SetBitmap(hBitMap);//IDB_TREE is a 16 mil col btmap, but I tried with 256 and still doesn't work. The code compiles but there is no effect. The button is as dull as always, there is no picture upon it nor any text(shouldn't be any text). I'm sure there is a simple answer, so great computer genius, would u be so kind as pointing me to it? Many thanks and happy prog!
To live in truth!
|
|
|
|
|
First of all, operatorHBITMAP is defined for CBitmap, so you can pass a CBitmap where a HBITMAP is expected. I think from memory you need to set the bitmap button to be owner drawn though. I always use AutoLoad for bitmap buttons, you create the bitmaps as resources and name them with quotes like this "ImageOne" "ImageOneX" etc. Then the caption on the button needs to be "ImageOne", and you call autoload, and get up to four bitmaps loaded ( up, down, disabled, and I forget the fourth ).
Look up Autoload in the MSDN, you'll probably find it's a better option.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
Your CBitmap object goes out of scope after OnInitDialog() returns, which destroys the bitmap object. Move the CBitmap object to a member variable.
--Mike--
http://home.inreach.com/mdunn/
You are the weakest link, GOODBYE!
|
|
|
|
|
Hi,
Make sure the style of the button is BS_BITMAP (but I'm sure you did).
Then try to use a member CBitmap variable, otherwise the bitmap is destroyed as soon as the viariable goes out of scope.
Hope this helps,
Paolo
------
"airplane is cool, but space shuttle is even better" (J. Kaczorowski)
|
|
|
|
|
Does anybody know how to convert from float to LPSTR?
for Example:
float x = 1.56;
LPSTR text;
and now???????
|
|
|
|
|
char buffer[10];
float fp = 12345.123
sprintf(buffer, "%f", fp);
It should do the trick, take a look at sprintf() in MSDN...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Yes the _fcvt function.
<br />
char *_fcvt(double value, int nDigits, int* ndecposition, int* sign );<br />
Cheers!!!!
Carlos Antollini.
|
|
|
|
|
I prefer the _gcvt
the _fcvt return a static pointer, there for I think it will have problems with multi thread app.
BTW: for some of you that wished for CodeProject irc server
I create a channle on DalNet called "#CodeProject "
|
|
|
|
|
In C (or C++) :
float x = 1.56;
LPSTR text;
/* allocate memory for 'text' */
sprintf( text, "%f", x );
---------------------------------------
In C++ :
#include <sstream>
float x = 1.56;
ostringstream out;
out << f;
string s = out.str();
// s.c_str() can be written to 'text' now
---------------------------------------
Alternatively, you can look for fcvt() on your platform (Windows, I'm assuming).
HTH
|
|
|
|
|
|
Hi,
I have a gif file on disk and would like to convert it into a bitmap for viewing. Is this something that is possible? Does anyone have any insight on how I could accomplish this?
Thanks in advance,
Craig
|
|
|
|
|
Take a look at:
http://www.codeproject.com/bitmap/cximage.asp
I vote pro drink
|
|
|
|
|
Nemanja,
Thank you for your suggestion, I will look at it and see if I can get it to convert a gif to a bitmap.
Craig
|
|
|
|
|
take a look at www.unisys.com
-c
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
You could use IPicture also.
|
|
|
|
|
I need to convert an STL string to a double? Does anybody know how to do it without writing custom code?
Thanks
Michael
|
|
|
|
|
_ecvt() can be used, though I'm not sure what platorms implement this. Windows at least does, so you're safe there. Pass in c_str() where needed.
HTH
|
|
|
|
|
Use std::stringstream.
Something like this :
std::string s = "3.4";
double d;
std::stringstream ss;
ss.str(s); // initialize the stream with a copy of the contents of string 's'
ss >> d; // extract a double from the stream
|
|
|
|
|
#include <stdlib.h>
#include <math.h>
#include <string>
std::string strPi = "3.1415";
double pi = atof(strPi.c_str());
Oliver
|
|
|
|
|
I have a few questions on list ctrl if anyone has touched upon these details. I've tried the main page which focuses on the list ctrl without luck.
1) is it possible to dynamically change the header column width of the last column so that when a scrollbar appears or disappears
I can have the column realigned to fit so I don't create a horizontal scroll bar?
2) Also, I've noticed DevStudio has listctrls where the last column cannot be resized. Is this a part of the listctrl functionality?
Thanks for the help!
Chris
|
|
|
|