|
i want to add some icones to the items of a tree control but i can't .
please tell me how can i do this . what's the problem of this code?
CImageList m_imgList;
CWinApp* papp=AfxGetApp();
if(papp!=0){ {
HICON hicon1,hicon2;
hicon1=papp->LoadIcon(IDI_ICON1);
hicon2=papp->LoadIcon(IDI_ICON2);
m_imgList.Add(hicon1);
m_imgList.Add(hicon2);
m_tree.SetImageList(&m_imgList,TVSIL_NORMAL);
HTREEITEM chapter;
chapter=m_tree.InsertItem("country",0,0);
m_tree.InsertItem("canada",1,1,chapter);
chapter=m_tree.InsertItem("person",0,0);
m_tree.InsertItem("sonya",1,1,chapter);}
|
|
|
|
|
did u call create() of image-list?
includeh10
|
|
|
|
|
yes one time i defined imagelist with bitmaps and i called create().
but i want to have HICON in my imagelist please tell me how could i have HICON instead of bitmaps.
|
|
|
|
|
Dear MFC guru's
I'm using MFC CSocket and CSocketFile and serialization to transfer data over the network.My data size is very large(some times upto 100KB).But my application is getting hanged after some time.When i monitor my data transfer using TDImon tool(from www.sysunternals.com) the result column is displaying PENDING when it's running and DATA_NOT_ACCEPTED before going to inactive state.My server application is not responding untill i kill my client application running on different machine.Can anyone help me how to transfer large amount of data using serialization and CSocket and why DATA_NOT_ACCEPTED error is coming.Any code examples would be great help.
Thanks and Regards
Krishna
|
|
|
|
|
hi,
my application back end is mysql. i using crystal report for report. i connect database thru ODBC. how to create ODBC at run time. any one help to me.
Thanks in Advance.
|
|
|
|
|
I am working at a company that has an established database and code. Lately they have been splitting their transactions between 2 databases running on differnt machines and then importing the transactions on one machine over to the other. The problem created by this is that their transaction ID are randomly generated long fields. The way the code use to keep ids unique was to do a select on the database to see if new randomly generated id already exists on the database and to keep on trying till a new unique number was generated( ).
Now that the code is run on two machines, two separate databases this aproach is obviously not working anymore. I could set an inifile setting sothat one machine generates only even and the other only uneven numbers but this is prone to all sort of stuff-upps
Any suggestions?
|
|
|
|
|
|
We are running db2 version 7. I did consider using a GUID, the problem is the transaction_id is an integer on the database and they will never ever allow me to change any datatypes on our database.
Thanks for the suggestion though;)
|
|
|
|
|
frankse wrote:
they will never ever allow me to change any datatypes on our database.
If that is true than the best way is to use some of the bits to represent which server it is on. Odd even will work but you may want to reserve more bits to allow more servers.
John
|
|
|
|
|
Great Idea, thanks I knew there was a cleaner solution, just could not grab a hold of it.
|
|
|
|
|
Hi
Just wondering how I can simply get the current Ip address in a C program on my NT box ? (In fact, I'd like to get same information that what's retrieved by the ipconfig exe).
My constraint is pure C.
Thanks!
Legrillon
|
|
|
|
|
You'll have to find a C library for sockets. try sourceforge or something.
|
|
|
|
|
|
Thanks Mike.
It was easy to port this example to C.
It works fine.
|
|
|
|
|
hi all,
can anyone please tell me how to set font for menu items??? Can I set my own font for menu items?? Kindly help me.
thanks!!
ramya.
|
|
|
|
|
I don't recommend changing the font on menu items (Users pick these fonts through the appearance manager and you have no right to be going around changing them).
That said, if you are desperate (idiot managers pushing you to do so) you can create an owner drawn menu, and implement the DrawItem function to select and use whatever font you like. You'll have to implement MeasureItem as well to decide the height of menu items.
There are about 7 billion custom menu implementations out there. Grab one and get to work.
|
|
|
|
|
Anonymous wrote:
(Users pick these fonts through the appearance manager and you have no right to be going around changing them).
Funniest thing I've read all week. I guess Microsoft better go ripping the chapters for owner draw menus out of their MFC and Windows programming books right about now then!
I hope you were joking!
|
|
|
|
|
He (or she) wasn't joking. Ownerdraw menus are for the purpose of adding graphical bits to menu's who's purpose is to select something visual. They are not to encourage programmers to choose what _they_ think is a cool new menu font. The fact that you _can_ do something doesn't mean you should.
--
-Blake (com/bcdev/blake)
|
|
|
|
|
I think that a big asset to windows and MFC is the fact that you don't have to follow standardized ui and font schemes.
Good thing we don't program for a framework that forces you to conform, what a boring world it would be.
Just look at KDevelop linux programming with GTK, that's a whole new level of boring conformity, unless you make your own custom widgets and menus from scratch.
You can't even C++ style subclass GTK widgets at all. You can only psuedo subclass them with C
|
|
|
|
|
A consistent user interface is a good thing. Those who can not remember the past are condemned to repeat it.
--
-Blake (com/bcdev/blake)
|
|
|
|
|
I agree with Blake.
Software that fails to conform with my expectations gets junked. It's a little rule known as "The Path of Least Astonishment". You never do anything in an application that the user does not expect, and this includes changing the user interface unnecessarily.
What happens if you use some sort of "cool" font not installed on my system? (And BTW, I don't want "cool" fonts installed on mine)
What happens if I have specific disability settings, and your code doen't manage them properly - would you doom a blind or partially sighted person to not being able to use your application, because you decided that your groovy interface was more important than having an application that everyone can use.
Don't be so bloody arrogant. You might find it boring, but then again, I want applications that I can just get on and use, not have a million and one applications with their own conflicting ideas on what my user experience should be. Who is more important - your users, or your ego?
The framework doesn't force you to conform because there are occasions you need to break it. Looking groovy isn't one of those occasions!
One reason for using a framework is to reduce development times. Why then increase it by pissing about owner drawing your menus?
--
Ian Darling
"The moral of the story is that with a contrived example, you can prove anything." - Joel Spolsky
|
|
|
|
|
you can just bitmap the menu items and draw that instead, then they don't have to have the font installed.
As for blind people, well, I guess they can't use it, but there are already so many applications they can use that I doubt it would make a big difference with a few owner draw apps out there.
Maybe microsoft should consider making DirectX 3D Visually impaired compatible too if we're going to go down the road you describe.
|
|
|
|
|
Beer26 wrote:
you can just bitmap the menu items and draw that instead, then they don't have to have the font installed.
So people who use large fonts? Maybe you could StretchBlit your menu items to the larger size so they look inconsistent and crap!
Beer26 wrote:
As for blind people, well, I guess they can't use it, but there are already so many applications they can use that I doubt it would make a big difference with a few owner draw apps out there.
So your application is probably being done better elsewhere, because I would suggest that people considering disabilities probably develop more usable software anyway.
Beer26 wrote:
Maybe microsoft should consider making DirectX 3D Visually impaired compatible too if we're going to go down the road you describe.
You fail to appreciate the difference between an application that is primarily visual (ie, a lot of games), and an application that does not need to be visual at all (just about everything else). There are also people who have written games designed to be played as an aural rather than visual experience. Like this guy, in fact:
http://student-kmt.hku.nl/~audiogam/ag/articles/chrislewisinterview01.htm[^]
--
Ian Darling
"The moral of the story is that with a contrived example, you can prove anything." - Joel Spolsky
|
|
|
|
|
Ian Darling wrote:
Maybe you could StretchBlit your menu items
I didn't mention anything about StretchBliting, If the draw rect is bigger, you draw the real size and center it, and screw their large font settings.
I'm personally sick of the windows standard ui, and if it didn't take so much longer to do owner draw I would do it alot more.
As a matter of fact I will be doing it alot more even though it takes a little extra effort.
|
|
|
|
|
Beer26 wrote:
screw their large font settings
And that sums up entirely what is wrong with your attitude towards application development.
Maybe you should go read some books on user interfaces, like GUI Bloopers or The Inmates Are Running The Asylum.
Then you'll (hopefully) appreciate what an asinine, and quite frankly, appalling, attitude towards users you have there.
--
Ian Darling
"The moral of the story is that with a contrived example, you can prove anything." - Joel Spolsky
|
|
|
|