|
|
Yeah, I ran across that one among other spreadsheet-style controls. I want to show more than just a single text item in a single cell. I found an article on here that describes how to create your own control and I'm trying to work through it now.
|
|
|
|
|
Hi,
I created a SDI project with a few dialogs
One of the dialogs is to allow user to open
up a file, then the program will parse the data.
After that, it will display some text data
to the user.
I did some search on display text but I
am sure what's the best approach.
Can or should I use a CDialog to display text?
The text is going to be a couple hundred lines
and some lines are about 90 characters long.
So, I probably need to have vertical &
horizontal scroll bars.
Any suggestions would be appreciated!
Thanks,
Kevin
|
|
|
|
|
An edit control in a dialog would do nicely. You can enable several styles that help: "multiline", "want return", and "horizontal scroll" and "vertical scroll". You can set these in the resource editor when you create the control.
If the text is formatted using spaces (say, into columns), you may want to set the font used in the edit control to a monospaced font (Courier New, for example).
Software Zen: delete this;
|
|
|
|
|
kevincwong wrote: Can or should I use a CDialog to display text?
Why would you use a CDialog to display text? What exactly do you mean by this?
To Display text, a nice idea is to use CEditBox, incase you may want to allow the user to transport this data somewhere else i.e. He may copy this and paste somewhere else.
Can you elaborate the problem a little more?
You have an apple and me too. We exchange those and have one apple each.
You have an idea and me too. We exchange those and have two ideas each.
- someone
|
|
|
|
|
You are correct. After doing more research, I found that the CEditBox
can do exactly what I wanted.
I am from Unix side. So, please forgive me if my MFC lingos
or knowledge are not good enough.
Currently, I am working on a MFC project to do something like
inventory control. I already done all backend sql search stuff.
Now, I need to display the inventory information to the
user in text format.
For example:
Item 1: something something
Quantity: 20
Description: some description.........
Item 2: someting else
Quantity: 202
Description: some other description.........
So, as I mentioned before, the CEditBox works perfectly for me.
Regards,
KEvin
|
|
|
|
|
:(How to read/write a byte to LPT ? I want to use CreateFile,DeviceIoControl,ReadFile,WriteFile,... to read/write byte to Lpt port. In CreateFile(lpFileName,....) I do not know set lpFileName = ????. App run on Win2000,WinNT.
|
|
|
|
|
I think you create a null-terminated string with "LPT1", and CreateFile will understand this as being the parallel port. Here's an example where it looks like they are trying to do the same thing as yourself. Good luck.
|
|
|
|
|
Parallel port access u can use the traditional outport & inport functions
but if u want to deal with the device driver concept the u need to search
for it .Probably there are few available class on the internet wich serves
ur purpose.
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
Hello to all the weekend programmers in the house ::- ) (since it's Sunday 2 AM right now...). Is there any night-bird (or morning bird if we're at it...) able to tell me how can I retrieve such regional settings from the Windows OS like UTC Hour Difference and Week Day Name? I know it MUST be possible somehow but I searched a bit and didn't find anything relevant.
APIs such as GetSystemMetrics or SystemParametersInfo don't seem to be of any help (or am did I miss something?). So GetSystemTime returns the time in UTC format. How can I convert it to the format that the local Windows user uses?? What about the week day name? In English it's Sunday but if the user uses a French regional package it would be Dimanche (I hope I didn't mess up the spelling). Soooooooooo?
Edit 1: Stuff like CIMV2 is not good 'cause it only works on NT.
Edit 2: I found how to get the UTC time difference. Here's the answer: GetTimeZoneInformation API. Now what about the day of the week name in the regional language of the user. The Operating System has usually has them. Anybody know anything about how to get it?? ::- ).
-= E C H Y S T T A S =-
The Greater Mind Balance
-- modified at 3:52 Sunday 13th November, 2005
|
|
|
|
|
If you just need the local time, you can call GetLocalTime() , which automatically adjusts the UTC for the difference, Daylight Savings Time, and so on.
You can use GetDateFormat() to format dates according to the user's language and localization.
Software Zen: delete this;
|
|
|
|
|
I found that already. Didn't know about GetDateFormat ::- > and it's very useful to. Thanks!
-= E C H Y S T T A S =-
The Greater Mind Balance
|
|
|
|
|
Hey,
how can I create a (toplevel) window - derived from CWnd - in my SDI - application. I need a window which can be plased outside my application window. I created a class "CHelpWindow" derived from CWnd. After that, I wanted to create this window in my CMainFrame class, but not as a childwindow!
Here is my first try:
m_hHelpWindow.CreateEx(NULL, NULL,"TestWindow",WS_CAPTION,reRect,0,IDW_TEST,0);
-->CreateEx fails...
I like to have a window with border, sysmenu and caption...
Thanks for your advice...
|
|
|
|
|
|
I'll try this..
Is it possible to create a window derived from CScrollView?
|
|
|
|
|
Hi,
I am trying to draw Ascending and Descending sort arrows in a ListView Control Header using the WIN32 API. I have handled the NM_CUSTOMDRAW message and everything works ok except for one situation. The first time I click on the header control the column data is sorted properly, but the sort arrow is drawn then immediately erased. If I swap to another window and come back the sort arrow appears in the display. If I click on the same column a second time the arrow is drawn and remains in the display. The problem occurs anytime I click on a column in the header for the first time.
I know there is something I am missing here but being new to WIN32 I don't have a clue what else to try.
Thanks!
|
|
|
|
|
How about doing it with a bitmap instead, so you don't have to worry about drawing the arrow yourself? Check the docs on HDITEM - there's a mask flag HDI_BITMAP and you store a bitmap in the hbm member. If you're on XP+, the header has built-in sorting arrow support - see the HDF_SORTDOWN and HDF_SORTUP flags.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | 1ClickPicGrabber | NEW~! CP SearchBar v3.0 | C++ Forum FAQ
Come quietly or there will be... trouble.
|
|
|
|
|
Gentlefolk:
Has anyone out there done thid kind of thing?
I have been overloading "operator new" to create variable sized classes. I need to create millions of instances of these classes to be processed very rapidly and believe this technique avoids one allocation of data on the heap each invocation.
It seems to work pretty well, but ocassionally leaves stuff on the stack when I believe it has been deleted. I suspect this results when C++ creates temporaries when interpreting complicated statements, and may involve using this for a derived class. I have been not able to pin down exactly the what situation causes this.
I've tried to support "DEBUG_NEW" and that adds to the confusion.
Any help will be appreciated.
The following gives you the gist of what I'm doing.
class MyBase
{ public:
// whatever
};
class MyDerived : public MyBase
{ public:
// whatever
byte m_Data[];
MyDerived( const int &a_Size = *( int * )NULL )
{ memset( &m_Data, '\x00', a_Size ); }
virtual ~MyDerived() {}
#if !defined _DEBUG
void *operator new( size_t a_BaseSize, size_t a_AppendSize )
{ void *t_Memory = malloc( a_BaseSize + a_AppendSize ); return t_Memory; }
void operator delete( void *a_Memory )
{ free( a_Memory ); }
void operator delete( void *a_Memory, size_t a_AppendSize )
{ free( a_Memory ); }
#else
#undef new
void *operator new( size_t a_BaseSize, size_t a_AppendSize, LPCSTR a_File, int a_Line )
{ void *t_Memory = _malloc_dbg( a_BaseSize + a_AppendSize, _NORMAL_BLOCK, a_File, a_Line );
return t_Memory; }
void operator delete( void *a_Memory )
{ _free_dbg( a_Memory, _NORMAL_BLOCK ); }
void operator delete( void *a_Memory, size_t a_AppendSize, LPCSTR a_File, int a_Line )
{ _ASSERTE( false ); _free_dbg( a_Memory, _NORMAL_BLOCK ); }
#define new DEBUG_NEW
#endif
};
//MyProgram
...
int size = 100;
#if !defined _DEBUG
MyDerived &NewDerived = *new( size ) MyDerived( size );
#else
#undef new
MyDerived &NewDerived = *new( size , THIS_FILE, __LINE__ ) MyDerived( size );
#define new DEBUG_NEW
#endif
...
-Obi Wan 2
|
|
|
|
|
Hello,
Since you overloaded operator new, do you allow instances to be created in an other way? For example, did you make the constructors private?
I also see that operator new is global and not a member of your class. It should be a member of your class. See here[^] for more details.
Hope this helps
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Bob:
Thanks...
The reference you send is helpful.
In actuality (not clear in my example), the new and delete overloads are not global. They are within the class definition brackets.
The constructors have not been declared private. It is unclear to me why this would be necessary or useful.
The example in the reference says that the source line "new( 'user_args' )" is expanded to "new( 'type_size', 'user_args' )", which seems to be the case. In that case, 'type_size' is the total object size; in my case, 'type_size' is the class size without any appended data and 'user_args' is the additional allocation. The problem is that the actual size of the class is 'type_size' + 'user_args'. I'm not sure how the compiler would know how to create a temporary object, being unaware of the total size.
-Obi Wan 2
|
|
|
|
|
Obi Wan 2 wrote: The constructors have not been declared private. It is unclear to me why this would be necessary or useful.
This is to protect other users of your class to mess up your memory allocation strategy. For example by deleting a pointer to a class on the stack or whatever. Makes your class a bit more dummy proof. When doing this, the compiler also has a hard time creating temporary objects..
Obi Wan 2 wrote: The problem is that the actual size of the class is 'type_size' + 'user_args'. I'm not sure how the compiler would know how to create a temporary object, being unaware of the total size.
You'll have to look at the generated assembly for that. You'll discover the problem there.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Using VC6
Solution must be compatible with Win98 and higher (can't use WH_KEYBOARD_LL for the hook)
----------------------
I've tried creating a global keyboard hook so that I can intercept keystrokes in a given application. However, it's not capturing every key combination. I can get X, Ctrl-X, or Alt-X, but not Ctrl-Alt-X.
Can anyone provide any insight?
------- sig starts
"I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
|
That's the first article i looked at. I get the same results.
------- sig starts
"I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
What OS? I just tried the demo and I got the Ctrl + Alt + X message.
"When you know you're going to eat crow, it's best to eat it while it's still warm." - Reader's Digest
|
|
|
|