|
Hi,
I want to add a window to my application that will show a list of items.
For that I create a CFrameWand with a ClistCtrl view inside.
the problem is that the cunstructor of CFrameWnd is protected by default.
How can I pop up the window ?
Is there a method to do it without touching the specific constructor ?
Shay
|
|
|
|
|
I assume you are talking about a CFrameWnd derrived class of your own created by the class wizzard. You can either use dynamic creation (IMPLEMENT_DYANMIC ...) or make the constructor public yourself. I do the second all the time but in the past I have done some work with creating class instances using the GetRuntimeClass() stuff..
John
|
|
|
|
|
Yes, you are right, I amderiving my own class.
How do I use the "dynamic creation" ?
Or how do I use the GetRunTimeClass() ?
Thanks
|
|
|
|
|
How do I use the "dynamic creation" ?
Look in the documentation for CObject:
CRuntimeClass* pRuntimeClass = RUNTIME_CLASS( CMyClass );
CObject* pObject = pRuntimeClass->CreateObject();
ASSERT( pObject->IsKindOf( RUNTIME_CLASS( CMyClass ) ) );
However it is far easier to just make your constructor public...
John
|
|
|
|
|
Thank you,
I did converted it into public, but I said to myself it was fishy and not menat to be this way...
|
|
|
|
|
It is protected because MFC internals create it using the dynamic method and in most cases the user does not need to do this themselves.
John
|
|
|
|
|
You could use RTTI if you do not want to use MFC.
RUNTIME_CLASS is a macro written by Ms.
|
|
|
|
|
:(I want to find the relation between a font and the Unicode,
I want to know a font’s character set like to http://www.unicode.org/charts/, but I don’t’ know how I can find the character set like it?
|
|
|
|
|
If you're using Windows 2000 or XP, use the Character Map tool (typically in your start menu at Accessories > System Tools > Character Map). Check the Advanced View box.
This won't show you the code points which have no glyph (character image) assigned, but it will show you all the (basic) glyphs that are available in the font, and the code points to which they are assigned.
See here for a guide to Unicode terminology[^], including definitions of glyph, encoding and code point.
--
Mike Dimmick
|
|
|
|
|
I want to find a function that it can know which character can be displayed?
Different font have different character set, for example the font of Arial maybe have five character set and the font of PMingLiU maybe have ten character set. How I can know the number and name of a font’s character set?
|
|
|
|
|
GetFontUnicodeRanges , perhaps?
GetTextMetrics or GetOutlineTextMetrics might also be helpful, but I suspect for a TrueType font, GetTextMetrics will return DEFAULT_CHARSET in the tmCharSet field.
--
Mike Dimmick
|
|
|
|
|
Basically, UNICODE is a way the windows storing your character in the system .
UNICODE system applies a standard whereby each character in your program will be stored as 2 bytes no matter what character set it is in.
If you are using MBCS. It means that your program can selectively choose how many bytes need to be allocate for each character.
To know more about. Check out some cool articles in codeprojects.
|
|
|
|
|
I'm trying to learn how to implement a linked list. I'm having a fun time trying to get the following code to work. I didn't create a seperate header file for the top part (where the node class is defined) because I wanted to keep it simple at this point. I'm not sure where to add the main funtion or what header needs to be specified if any. I did a google search for the pop and push functions but didn't find a header. Also, where do I enter the information I want to add to my linked list database? I was hoping someone would help me out here, or at least point me in the right direction. Thanks much, Dave.
---------------------------------------------------------
//node class defined
class node {
private:
friend class llist; // We will have an llist class to manipulate
// nodes, and we want it to access node.
int information; // I'm assuming that this is a linked list
// of integers.
node *next; // Pointer to the next node.
node *previous; // Pointer to the previous node.
}
//----------------------------------------------------
//Ceate the llist class
class llist {
private:
node base; // We need a base node, from which other nodes will spring.
node *current; // A pointer to the current node.
public:
void push(int item);
int pop();
}
void llist::push(int item)
{
node *temp=current; // Temporary node
current->next=new node; // Create new node
current=current->next; // Assign current to new top node
current->information=item; // Assign the data
current->previous=temp; // Set previous pointer
}
int pop()
{
int temp;
temp=current->information;
if (current->previous == NULL) // Following a NULL pointer will lead to nothing but folly
return temp;
current=current->previous;
delete current->next;
return temp;
}
|
|
|
|
|
DaveE9th wrote:
I'm not sure where to add the main funtion
At the bottom.
DaveE9th wrote:
what header needs to be specified if any.
At this point, none are needed, although you'll probably be outputting some data so you'll eventually need stdio.h, or ostream (or wherever cout is kept).
DaveE9th wrote:
I did a google search for the pop and push functions but didn't find a header.
That's because the push() and pop() methods belong to your class.
DaveE9th wrote:
Also, where do I enter the information I want to add?
Input can come from various places, including a file, and the user typing it in.
|
|
|
|
|
Thanks Dave
"The man who reads nothing is better educated than the man who reads nothing but
newspapers."- Thomas Jefferson
|
|
|
|
|
push() and pop() are generally used when we talk about a stack and not just a list but I know STL uses push_back and push_front, pop_back, pop_front with all sequence containers..
John
|
|
|
|
|
I'm still stuck on getting this very interesting code to compile. I was hoping someone would type in the missing main function for me and let me know what else I need to do to get this going.
Thanks, Dave
VC++ 6.0
|
|
|
|
|
Thanks John, I've been reading up on vector containers in the STL as you mentioned...very fascinating.
Thanks, Dave
|
|
|
|
|
Is there anyway to verify a property page is created before I called RemovePage(), and is there anyway to insert a page (like between page 2 and 3)in the property pages? Thank you!
|
|
|
|
|
skinnyreptile wrote:
Is there anyway to verify a property page is created before I called RemovePage(),
if (::IsWindow(m_pOptionsPage->m_hWnd) == TRUE)
RemovePage(GetPageIndex(m_pOptionsPage));
skinnyreptile wrote:
is there anyway to insert a page (like between page 2 and 3)in the property pages?
Not that I know of.
|
|
|
|
|
I want to open a modeless dialog from a DLL.
The DLL is a MFC DLL and contains a CWinApp
In the DLL this code is run to create the dialog
void CShowDlg::Show()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
CMyDlg* pDlg = new CMyDlg();
CMyDlg->Create( IDD_MYDLG , NULL );
CMyDlg->ModifyStyleEx( 0 , WS_EX_APPWINDOW );
CMyDlg->ShowWindow( SW_SHOW );
} It Works. But the dialog is ALWAYS on top the main app. Since this dialog can be rater big it’s not good.
But if I comment out the creations of the CWinApp.
The dialog acts like any other window and can be sent to back and so.
But Then I get some other problem.
Some places in the code in the DLL is running CWaitCursor, and it is calling AfxGetApp();
Which returns NULL since theApp it out commented.
The only solution I found was to keep the CWinApp ( theApp ) and then create a new thread ( CWinThread ) and let that thread create the dialog.
Now everything works. But I got 2 extra thread just to open the dialog. And I think that one should be enough. or ?
Anyone have any ides/tips ?
|
|
|
|
|
Hi everyone,
I have a question regarding window sizes. Is there a restriction to the maximum size a window can be? I have a custom control with child windows and a zooming control. I noticed that on large zooms, my window does not show the right size. I am guessing that after 2^15 pixels, it refuses to resize it anymore. Is that true and is there a way around it?
Thanks for any help you might give me.
Without struggle, there is no progress
|
|
|
|
|
The WM_SIZE message uses the lParam to store the width and the height of the window. Since lParam is 32-bit wide (typedef unsigned long DWORD;typedef DWORD LPARAM; ), I suppose width and height shouldn't exceed 2^16-1 pixels.
We do not inherit the Earth from our ancestors, we borrow it from our children - Antoine de Saint-Exupéry (1900-1944)
|
|
|
|
|
A friend has a USB device that he wants to support under Windows without dealing with the DDK and writing a device driver. The device is a data logger and he wants to talk to it in the same way he would if it were on an RS-232 port or a TCP/IP socket. He has working code for this on MacOSX using Apple's IOKit and on Linux using libusb. Is there an equivalent API for accessing a USB port in this way under Windows?
|
|
|
|
|
No. I believe a process must communicate to a USB device through its device driver.
Kuphryn
|
|
|
|