|
I've created a "non-Document/View" MFC App in which I've created two (2) classes derived from CView and one (1) class derived from CWnd. The classes derived from CView will be used to display VCR, framebrab, or still images while the CWnd derived class will contain controls; i.e., VCR control buttons.
I'm having difficulty displaying the three windows. I tried adding member variables in the apps's CMainFrame class declaration but receive an error message that CMainFrame cannot access the derived classes constructor since it is "protected." Declaring a pointer(s) to the derived MFC classes in the CMainFrame class declaration and the calling "new" for the class produces the same error.
I need to display three (3) different windows/views in the application mainframe simultaneously and I know that I need to size each of the windows before displaying them. What is a general procedure for doing this? Do I need to create CFrameWnd's for each of the CViews?
|
|
|
|
|
CView objects, as created by ClassWizard, are created with protected constructors. The reason, way back when, was that CViews were only created as part of the framework, which used CreateObject() and several other features of CObject.
The short of the matter is that, when using non-doc/view you need to make the constructors public.
Why use CViews anyways? All they really do is provide linkage to the document object, and since you don't have a document object, what's the point?
|
|
|
|
|
Looking for MFC class for handling PhtoShop files. There is only file format desc. in PhotoShop SDK, but I haven't found any really useful sample. I've seen some programs which can display PSDs quite correctly but as I found all of them using some Delphi graphics library, there are no libraries for MFC/C++? (ImageMagick also have only basic support for PSD, I've found no C code for text layers). Any ideas?
|
|
|
|
|
I m a french student, working with VC++5.0. I m trying to create a menu (that s ok) and i want to attach submenus to items, depending on the item of the first menu... but i don't know how can i get informations about the parent item of the submenu
|
|
|
|
|
I want to write a COM service which should be able to use MFC, and this service will be called from the COM object. The service should continue to run although the COM object completes its execution and returns.
Please guide.
Umair
|
|
|
|
|
Hi,
Exactly how much data can a CString contain?
I have a large amount of text data to store in 1 CString object. The text is added to the CString object 1 line at a time with a \n\r after each line. The problem is, that when the data gets to a certain point, it all goes away. A small amount of text works fine.
Is there a C++ class that will handle a large amount of text in 1 variable?
Thanks,
Frank
|
|
|
|
|
Try allocating the CString from the heap.
for example:
CString *cs;
cs = new CString("The Data");
// Do whatever
delete cs;
If that doesn't work you will have to alloc a char array on the heap.
|
|
|
|
|
First, it will probably work better if you use "\r\n" instead of "\n\r". I had trouble remembering which one to use until I realized that "\r\n" is like "RN" as in "Registered Nurse".
People have asked about the maximum possible size of CString items and I have seen no answer to this question except 2,147,483,647 (2GB; INT_MAX). Since the return value of CString::GetLength is an int, it makes sense that a CString cannot be any larger than the value of an int. So in reality, a CString size is probably limited only to available memory.
|
|
|
|
|
Hi,
a Suggestion for this behavior.
The debugger will show you only 255 (or 256?) characters,
even when CString contains more than this amount.
HTH
Holger Persch
|
|
|
|
|
Why dont you use CStringList class which is a builtin linklist of CString. You can use it for storing each line in a sepetate element of the CStringlist object. You only have to call object.AddTail(data string) for each element.
For more information you can see the detail in the MSDN help.
|
|
|
|
|
Anyone have any usefull tips on how I can go about adding a menu
option in Internet Explorer's Right Click menu for a link. I am
developing downloading software in C++ and want IE to send links
to my program.
|
|
|
|
|
Hi,
Set a registry key entry at
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt\&MYMenuItemText
Now Make the Default Value what you wish the MyMenuItemText do,
Also you can add a Binary Value to a data item "Contexts"
0x20 Allows only Anchors to display the Context-Menu-Item
and the Data Item Flags can have a DWORD value of 0x01 that can run the Default Value;
"Best bet have a look how other programs alter the \MenuExt\
key.
Regardz
Colin Davies
|
|
|
|
|
Hello everybody!
I hope that someone can help me with the strange problem that I have.
I am printing the text on the page using DrawText function. The text is big enough so it may go across several pages. And the strange thing is that when I do Zoom in the Print Preview, size of the font changes so the boundary box of the resulting text is different for different zooms! And on the page itself it looks like different portion of the text is displayed per page for every zoom coefficient.
I wonder if someone knows what is the catch here?
Thanks in advance.
|
|
|
|
|
Hi,
try using CFont::CreatePointFont(...) for initalising the font.
HTH
Holger Persch
|
|
|
|
|
Hello!
Thanks for your suggestion.
Unfortunately it will not work, because this behavior (as I found out later) is caused by bug (feature?!) in CPreviewDC implementation of the DrawText routine that I am using to output text. It does not take into account m_hAttribDC and uses only m_hDC for drawing - as a result for different zoom levels there are fonts of different height, selected into m_hDC -> size of the bounding box for DrawText veries. I do not know yet how to overcome this bug, but for sure this is not that easy...
|
|
|
|
|
I'm trying to do the following ... pass some data from a VB client to a VC++ server via
COM. I realize that I have to use automation-compatible data types such as VARIANTs
and SAFEARRAYs. However, I'm having difficulty figuring-out exactly how to define the
method in IDL and interpret the data on the server side.
The data is a set of 29 variables, most of which are integers. Some are floats, with one
string and couple of arrays thrown in for good measure. Obviously it would be tedious
to set-up and use a method with 29 parameters. So, I'd like to pass all of the data in
one chunk if I can. Additionally, there will be 2 other chunks of data returned to the
client in the same method ... but that's a different question. The only thing I'm
trying to do now is get the chunk of data to the server.
In all that I've read, it seems that the best way to pass the chunks of data is using
arrays of VARIANTs. Is that true ? If so, how do I define the method interface in
IDL and how do I unpack the data on the server ?
Any guidance would be helpful.
Thank you,
Keith Gemeinhart
|
|
|
|
|
Thanks to all who replied. I have solved the problem ... and
in the near future, I will post a short description of how I
did it.
-Keith
|
|
|
|
|
I have a code that compiled fine with another compiler but with VC++ 6.0 I get some errors.
I'm form sweden and dont understand this one:
Conversion from 'void*' to pointer to non-'void' requires an explicit cast
|
|
|
|
|
I mean whats an explicit cast?
|
|
|
|
|
Lets say you have a function that takes a void* as input.
void CMyDlg::MyFunc(void *pointer)
{
...
and inside the function, you want to tell the compiler that the pointer is to a char ...
This is the C++ way:
MessageBox( static_cast<char*>( pointer));
This is the C way
MessageBox((char*)pointer);
Both are explicit casts. An implicit cast occurs when the compiler can find an operator it can substitute to do the conversion. CString has one of these - operator LPCTSTR, but it only works for const char*.
HTH - you probably know these in another terminology.
|
|
|
|
|
Hi everyone,
PLEASE HELP ME OUT!!
I want to do the following SQL statement with ADO.
"CREATE TABLE Customer (Customer id INTEGER, Price INTEGER,ETC..)";
But how do i specify the name of the table (ie "Customer") which i want to create as a variable?? so i can have an edit box and have the user type in what they want as the table's name?? same thing for the fields. i don't want name and fields of the table to be predefined but allow the user to decide what to put in as the table name and fields. But with SQL statement, i can't put in variables inside the " CREATE TABLE..." quote right?
i also tried to define the SQL statement as a string first, then add variables inside the string and combining the strings. then have the SQL query the string. but i'm having trouble with that.
if you know a way to do solve this please let me know and i really appreciate it. Thanks
steve
|
|
|
|
|
Steve,
For your variables, iterate through the list and build up a string.
// replace following 2 code lines with code to pull values out of the UI you have built up.
char* pszVariables[] = {"Customer_Id", "Price", ...};
char* pszVariableTypes[] = {"INTEGER", "INTEGER", ...};
char** pszCurrentVar = pszVariables;
char** pszCurrentVarType = pszVariablesTypes;
_bstr_t bsVariables = ""; // you can use CString or something else if you want here.
while (pszCurrentVar && pszCurrentVarType && *pszCurrentVar && *pszCurrentVarType)
{
if (bsVariables.length())
{
bsVariables += " , ";
}
bsVariables += *pszCurrentVar;
bsVariables += " ";
bsVariables += *pszCurrentVarType;
pszCurrentVarType++;
pszCurrentVar++;
}
_bstr_t bsQuery;
bsQuery = "CREATE TABLE ";
bsQuery += pszTableName;
bsQuery += " (";
bsQuery += bsVariables;
bsQuery += ")";
// bsQuery now contains CREATE TABLE SQL statement.
// execute CREATE TABLE statement
MyConn.Execute(bsQuery);
Hope this helps,
-Erik
|
|
|
|
|
in an MFC dialog i have a Edit control. When you press enter it quits. How do i override this???
|
|
|
|
|
Override the OkOK method.
|
|
|
|
|
As Tim said, override OnOk, but if you leave in the call to CDialog::OnOk the dialog will still end.
|
|
|
|