|
How about this, when the focus is away from that edit box, how can I
insert carriage returns at the end of the line? If I type in
long line really, long
line
and it automatically word-wrap, then I see two (2) lines, but using
these vc++ commands, I have only managed to count 1 line and that's
driving me nuts. If I could force \r\n to exist at the end of the
first line, then I would be happy.
Please, any response any one can give me will be greatly appreciated.
|
|
|
|
|
Alright, that's a bit easier. Here's what you can do:
- Retrieve the text
- Retrieve the inner width of the list box
- Get a screen DC (used only for measuring the text): (MFC)
CClientDC dc(NULL); - Get the font used in the edit box: (MFC)
pWndEdit->GetFont(); - Parse out the string one word at a time, measuring each word, and accumulating the lengths (don't forget to measure spaces & tabs). When you are unable to add another word without exceeding the width of the list box, insert "\r\n" and reset the accumulated length. Use (MFC)
CSize sizeWord = dc.GetTextExtent(strWord);
Have Fun!
--------
A closed mouth gathers no foot. --Shog9 --
|
|
|
|
|
I've been getting an odd crash within Microsoft's STL, something to do with locales... The scenario is a bit complicated so here goes...
I have a class in a static library that derives from ostream, like this:
<br />
class __declspec(dllexport) CMessageLog<br />
: public std::ostream<br />
{<br />
} ;<br />
Then, in a DLL that links in this lib, I have another class that derives from it:
<br />
class __declspec(dllexport) CSysLog<br />
: public CMessageLog<br />
{<br />
} ;<br />
Then, in my app (which uses the above DLL), doing this:
CSysLog log ;
log << x ;
causes a crash if x is anything other than a char*, std::string or char.
Stepping through in the debugger, the crash is caused by basic_ostream calling use_facet() which seems to be trying to get a facet, gets NULL and then tries to deference it.
Is there some special magic I need to do to get locales working from a DLL...?
|
|
|
|
|
Make all components of your app (main program, DLLs, libs) use the DLL version of the C run-time library. That should fix your problem.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
im still new in c++.im searching for a visual c++ code for stacks. infix to postfix. can anyone tell me how to get examples? i cant seem to find it!
|
|
|
|
|
I believe that you're looking for std::stack, found in the header <stack>.
stack is an adaption of deque.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
|
|
|
|
|
i want to play .mpeg video clips in my application but i need helpful wrapping MFC classes or sample Windows MCI APIs to implement into my APP.
i have succeded in playing .avi files (not converted from Mpeg into Avi) but i could not do the same playing .Mpeg files...
i tried to change MciSendCommand(...) parameters and MCI_DGV_OPEN_PARMS structure members in my sample Application but i haven't done it.
What should i do?
i need help
Thanks for all,
Atilla Selem
just listening to you...
|
|
|
|
|
Atilla Selem wrote:
i want to play .mpeg video clips in my application
I think you can do it with media player activex.
Mazy
"The more I search, the more my need
For you,
The more I bless, the more I bleed
For you."The Outlaw Torn-Metallica
|
|
|
|
|
Look up direct show in the MSDN - it's part of DX and makes playing movie files a snap.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
|
|
|
|
|
Hi again,
Please introduce to me USEFUL documents-tutorials-SAMPLES about Drag-Drop pictures ...
I need help FAST !
It's my next project
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
If you don't mind a bit of .NET you can see :-
http://www.codeproject.com/dotnet/csdragndrop01.asp
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Hello,
In fact i wanna drag & drop pictures ...
I don't where can i start
Help me !
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
How I can set a variable that is global to all my application?
I mean, if my prog is one file, you declare it ouside any scope, ok.
In VisualC++ how I accomplish this?
I need a global variable, or a variable usable during the entire life of my program.
"Nelle cose del mondo non e' il sapere ma il volere che puo'."
|
|
|
|
|
Pick a single cpp file and declare your global variable in that file like so:
int g_iCount = 0;
Then in the header file that accompanies that cpp file make this declaration:
extern int g_iCount;
The extern tells the compiler that it will find that variable somewhere else in your program when it tries to link all of the modules together. So now all that you have to do is include the header file in any file that wants to use that global variable g_iCount.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Two things.
1. the best way to do this is to declare it in stdafx.cpp, and declare it extern in stdafx.h. Then everything can see it
2. doing so is very poor design. If you cannot make it a member of your CWinApp derived class ( assuming you use MFC ), then you should at least wrap it in a namespace so it is globally visible, but not 'global' as such.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
|
|
|
|
|
One thing I avoid at all costs is app-level data definitions and/or declarations in stdafx.*. Making any changes means rebuilding the .pch file which often takes longer than the rest of the entire build process and defeats the purpose of having a pre-compiled header file. If I can't or don't want to make a global variable a member of the app class then I make a Globals.h file that gets included where necessary. Sometimes I make a class called CGlobals because it provides a convenient place to initialize and release the variables but this doesn't happen frequently.
|
|
|
|
|
when i make a new icon in the ide it always starts with a 32*32 icon which i dont want ... how can i delete it or only have a 16*16 icon that gets used for the system tray?
grrrrrr
"... and so i said to him ... if it don't dance (or code) and you can't eat it either f**k it or throw it away" sonork: 100.18128 8028finder.com
|
|
|
|
|
In the icon editor, click Image->New Device Image.
--Mike--
Just released - RightClick-Encrypt - Adds fast & easy file encryption to Explorer
Like the Google toolbar? Then check out UltraBar, with more features & customizable search engines!
My really out-of-date homepage
Sonork - 100.10414 AcidHelm
|
|
|
|
|
heh thanks but i did that
u still have a 32*32 that seems to get used for the system tray
"... and so i said to him ... if it don't dance (or code) and you can't eat it either f**k it or throw it away" sonork: 100.18128 8028finder.com
|
|
|
|
|
Delete the 32*32 one. "Delete device image"
|
|
|
|
|
When you call LoadImage to load the icon into an HICON, specify the size that you want, 16x16, then you will be able to have both versions stored in one icon.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
i have started designing an interface that looks like that of 3d studio max, and wondered if anyone thought it was worth the time and effort.
==================================================
When Your Mind Wonders...Where Does It Go???
|
|
|
|
|
Great Ideas Rules the World..!!!!
R_Renjith The True CP ian
|
|
|
|
|
hi
i used the default app icon for my system tray icon and it seems to have been squished down cos bits of it are missing ... am assuming one can provide a separate icon and all but how big should i make it?
16*16 or what?
sorry if this is a dumb question
"... and so i said to him ... if it don't dance (or code) and you can't eat it either f**k it or throw it away" sonork: 100.18128 8028finder.com
|
|
|
|
|
yes 16x16 in size, and cooincidentally you will need to make it a 16 color bitmap as well. Even if you give the tray a 256 color icon, it will squash it to 16 colors.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|