|
How can I know how my propertySheet terminated ? with OK or with CANCLE ?
I need to save the data of pages if it terminated with OK.
|
|
|
|
|
|
Thank
|
|
|
|
|
Hi,
Although I asked this question before, but I can't get it,
I like to know how can I get a pointer to the first document in MDI.
the pointer has to have access to the document's data.
Thanks
Ehsan
Ehsan Behboudi
|
|
|
|
|
What do you mean by "first document"? The one that was created first or the currently active one?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
In my MDI application, I'm able to open several Bitmaps, each in a seperate document.
lets say that i opened the second bitmap. and I'd like to have a pointer to the data of the document opened first(fist document).
how do I do that?
|
|
|
|
|
You can iterate over currently open document using CDocTemplate::GetFirstDocPosition/GetNextDoc. Use CWinApp::GetFirstDocTemplatePosition/GetNextDocTemplate to get access to registered document templates, or store doctemplate pointer as a member of your app class in InitInstance.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Greetings Programs,
Ran into a bit of a conundrum and I need a little help. The following code is from an app I am writing to access and enumerate WMI objects.
if((hRes = pObjectInstance->Get(csArray.GetAt(iCounter).AllocSysString(), 0L, &varString, NULL, NULL)) == S_OK)
{
//Blah
}
Now, ordinarily this code return a Variant as one would expect. However, in some cases the data returned is supposed to be an array (Such as the Win32_NetworkAdapterConfiguration\IPAddresses object).
I pass all data returned through a switch for processing and the data that is supposed to be returned as an array definately triggers on case VT_BSTR|VT_ARRAY and not VT_BSTR.
But I can't figure out how to access that array. Can someone lend a hand please?
Many thanks,
Rhoam
|
|
|
|
|
What value returns the VT element of the variant????
Carlos Antollini.
|
|
|
|
|
Use the following functions:
SafeArrayGetLBound() and SafeArrayGetUBound() to check the bound of your array and
SafeArrayGetElement() to read each BSTR string. Since the data in not being passed
by reference: VT_BYREF (a pointer). I guess you will have to call SysFreeString().
|
|
|
|
|
I need use textBox(read only) with spin.But I have problem:
If I set the range of spin with max number bigger than 999
In run time I gets a MessageBox of error "please enter a integer"
what can I do if I need to work with bigger numbers(as 10000-100000) ???
Please help me.
|
|
|
|
|
|
Generally, you get an error like that because you have set a limitation on the number associated with the edit control. For instance, if you code the following in your DoDataExchange() function:
DDV_MinMaxInt( pDX /*CDataExchange Object*/,
m_iNumber /*member of this class*/,
50, /*minimum accepted value*/
999 /*maximum accepted value*/ );
You will get an error when your dialog is initialized if the data m_iNumber is not in the valid range.
|
|
|
|
|
I have seen search in MFC header file I have found to be call something like "Forward Class Declaration".
Here is an example of what I found... (Class Names Changed)
class CANormalCPPClass
{
class CAForwardableClassDeclaration; /*forward declaration of CAForwardableClassDeclaration*/
...
}
What going on in a class like this and how usefull is Forward Class Declaration?
|
|
|
|
|
The forward declaration tells the compiler that some name is used for a class. You could #include appropriate header, but this would (a) make compile longer and (b) introduce dependencies between two headers. You can't create variables of the forwared type, unless you provide full type definition, usually via #include. You can create pointers and references.
class CForward;
class CTest
{
CForward *m_Forward;
CForward &m_rForward;
CForward m_Forward;
void Test1(CForward *pForward);
void Test2(CForward &rForward);
void Test3(CForward forward);
};
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
A Forward Declaration is pretty much exactly what it sounds like. You declare a class before you actually define it. It is very useful for certain dependency issues which often arise in C++.
For example:
class CDefinedLater; // Defined later in the object list
class CDefinedNow{ // being defined now.
{
CDefinedLater* m_pdefinedlater; // Must be instantiated in the implentation of CDefinedNow.
};
In this way you do not have to include the header where CDefinedLater is defined in this header file, but you also cannot instatiate/construct CDefinedLater here. Doing so would make everything that is dependent upon this class, likewise dependent upon the CDefinedLater module, which can get messy.
i.e.
CDefinedLater m_definedlater;
This keeps your dependency relationships much simpler. I know a lot of people who swear by it. I also know alot of people who overuse it, instead of haveing well thought out dependencies in their class heirarchy.
|
|
|
|
|
More to the point, you might have two classes each of which contains pointers to the other, in which case forward class declarations are unavoidable.
|
|
|
|
|
Thank you for the replys.
|
|
|
|
|
Thank you for the replys.
|
|
|
|
|
I have currently converted an SDI MFC app to run non-interactively from the command line
to be used in a MakeFile. The problem is returning error messages and reports back
to the user. Does anyone know of a way to use printf (or any other output function) from
a windows app to the console that executed it?
Thanks for all your help.
Please drop me a line if you can help: JasonC@Codemasters.com
|
|
|
|
|
It's possible to open new console window and printf() into it (see KB article Q105305 for details). I think you can't use parent process console from a GUI program - the easiest way to solve your problem would be moving the non-interactive parts into console app. If you need to share this functionality with GUI app, create a DLL.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Look in the MSDN in Platform SDK/Base Services/Files and I/O/Consoles and Character Mode Support.
You will find a lot of functions like WriteConsole() etc.
Good Luck.
Carlos Antollini.
|
|
|
|
|
Hi,
I have a CFormView that contains a CTreeCtrl and a CHeaderCtrl. Everything works fine and the tree is divided in different columns but how do I find out what row and column a user has clicked on?
Cheers
|
|
|
|
|
Do you mean CTreeCtrl or CListCtrl? If you have a CTreeCtrl in columns, I would like to know how you did it.
|
|
|
|
|
I have a CTreeCtrl in columns, there is very good examples on this site to achieve that.
I have found out what column the user clicks in but I can't find the row of the click.
|
|
|
|