|
CMainFrame *mf = (CMainFrame*) GetParent();
You're getting in trouble with the cast. The toolbar's parent window isn't the main frame, it's the CDockBar that the toolbar lives in. Call AfxGetMainWnd() instead to get a pointer to the main frame.
--Mike--
http://home.inreach.com/mdunn/
Push the button, Frank.
|
|
|
|
|
--Mike-- http://home.inreach.com/mdunn/ Push the button, Frank.
Exactly what button am I supposed to push???
|
|
|
|
|
This is question which is rather specific to WinCE...
I can't figure out how to use the CCeCommandBar class to add a button to the command bar represented by the class. This class has methods for inserting menus, combo boxes, and separators, but, for some reason, no InsertButton method.
I have tried using the nonMFC function CommandBar_AddButton, taking as the first parameter the HWND which is the m_hWnd member of the CCeCommandBar. For some reason I am also having trouble getting this to work.
Your help much appreciated, I'm afraid I'm rather a novice at all this.
Matthew Fleming
|
|
|
|
|
I have a function that takes as an argument the address of a function
to be used as a CALLBACK
HRESULT CALLBACK ACallBackFunction(PVOID var);
if i try to make this functiona a method of a class it will not work
and i get the following compile error.
cannot convert from 'long (void *)' to 'long (__stdcall *const )(void *)'
so how can I make a class method be used as a CALLBACK (WINAPI,FAR PASCAL)
|
|
|
|
|
|
Or see Lohman's brand new article on this site.
|
|
|
|
|
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.
|
|
|
|