|
In an activeX (MFC) project I have defined a structure like this:
struct aaa
{
BSTR name;
int length;
}properties[200];
I have declared this structure in the C...Ctrl class.
I want the container to access the properties member (ctrlname.properties[1].name
Is it possible ? If so, how do I do that ?
|
|
|
|
|
Add a method to your ActiveX for the container to call. Have the method return the value you desire.
Goo luck,
Bill
|
|
|
|
|
hi, i'm implementing and MFC SDI application. I've inserted a new Dialog and put 1 list box in there. When i tried to add the string to the list box from the View in MFC it just display erorr. Here is the code fragment that i used in my view class:
CAss3_q1Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
Dlg dialog;
dialog.DoModal();
for (int i = 0; i< 4; i++)
{
dialog.m_team1.AddString(pDoc->A.getTeam(i));
}
It just didnt' load up and give me runtime error. ANy hints or tips.
Note: I tried to load the 4 CString object to the list, and this 4 string is in a class call group that have the method as below
CString Group::getTeam(i)
{
return team[i];
}
Cheers
|
|
|
|
|
DoModal() displays the dialog and waits until the dialog ends, typically by the user clicking OK or Cancel. You should pass a pointer to CAss3_qlDoc to your dlg object, and initialize the list box from within the dialog's OnInitDialog() handler.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Hello
As you you probably understands from the question's I'm asking I'm not a very experieced developer.
I'm having trouble to understand how i can get the document length on the document i want to print..
Must I first calculate the number of rows in the document in OnPreparePrinting and then
calculate the no: of pages to set as maxpage and must I then ceep track on wich page that is currently printing in the OnPrint function. Is this all wrong? If not is there an easiyer way to do this.
It would be great to get hold of a small example code to do this.
Thanks for taking your time.
Best regards
Henrik
|
|
|
|
|
You can use the following code to give the printer page size.
int cx = nPageWidth;
int cy = nPageLength;
static int screenXDpi = 0;
static int screenYDpi = 0;
if (screenXDpi == 0 || screenYDpi == 0)
{
CDC dcScreen;
dcScreen.CreateCompatibleDC(0);
screenXDpi = dcScreen.GetDeviceCaps(LOGPIXELSX);
screenYDpi = dcScreen.GetDeviceCaps(LOGPIXELSY);
}
cx = (cx * 1440) / 2540;
cy = (cy * 1440) / 2540;
cx = (cx * screenXDpi) / 1440;
cy = (cy * screenYDpi) / 1440;
nPageWidth = cx;
nPageLength = cy;
Regards
Jack
--------------------------------------
Xtreme Diagram++ MFC Library with full source code.
http://www.ucancode.net/
|
|
|
|
|
THANK YOU !!!!!, It helped me a lot
|
|
|
|
|
This is strange.
I have recently added a dynamically created Groupbox control to my CScrollView derived window. I find the area under the lines of the Groupbox become transparent as soon as the window is moved etc. Parts of other underlying screens show through. The area where the Radiobuttons are situated is corretly coloured.
Is there some simple way to make this opaque.
Any suggestions very welcome.
Sara
|
|
|
|
|
I think this has something to do with the Z-order of the group box with respect to the other controls in the scroll view. I might be wrong of course. But just see if you can do something using SetWindowPos and passing wndBottom as the pWndInsertAfter parameter.
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
How should I implement a 2-D array to be passed into a
class function? The following is what I know of
passing array.
void abc(int a[],int upperlimit)
{
for (int i =0; i < upperlimit; i++)
a[i]= 10;
}
What changes do I have to make to accomodate a[] to be a
2-D array? If I have not know the size of the 2-d array?
Should I use pointer here? I am trying to convert a fortran
code which allows for array to be declared as 2-D or 3-D array without specifying the size of the array. Is that possible in VC++ 6.0?
|
|
|
|
|
a 2-d array is basically a **.
So if you have int ar[10][20] you can prototype the function as :-
Fn(int **z); and then you can pass ar as the argument
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Nees is right.
Now, for your last q.
If you put NULL at the and of the array you woudn't need to remember
the size of the array.
Aizik Yair
Software Engineer
|
|
|
|
|
Two problems with NULL terminated arrays :
- if the array is 2D or 3D, you cannot determine row / column / 'layers' dimensions.
- what if one element of the array has a value of 0 (looks like NULL for the compiler) ?
|
|
|
|
|
<small><b>squizz wrote:
</b></small><i>if the array is 2D or 3D, you cannot determine row / column / 'layers' dimensions.</i>
I will answer this before Christian Graus.
[pre]
Use std::vector <std::vector<int> >
[/pre]and pass a reference to it to the member function.
Otherwise, provided that you know the dimension of the 2D array use
int f (int** x)
Best regards,
Alexandru Savescu
|
|
|
|
|
How do I add MFC support for an ATL project (Service) created in Visual C++ .Net?
RamDili
|
|
|
|
|
ramdili wrote:
How do I add MFC support for an ATL project (Service) created in Visual C++ .Net?
RamDili
Add the required headers and set the linker option to link MFC statically/dynamically.
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Well, I followed Article ID: Q173974 in MSDN which is kind of your suggestion. This seems to work for VC++ 6.0. But I need it for Visual C++ .Net and this is the error what I'm getting.
C2504: 'CAtlServiceModuleT' : base class undefined
If I add the headers after <atlbase.h> in stdafx.h , then I'm able to get rid of this error. But then I get this error::
c:\Program Files\Microsoft Visual Studio .NET\Vc7\atlmfc\include\afxv_w32.h(18): fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h>
Do you have any suggestions for me? thanks....
RamDili
|
|
|
|
|
It depends on what classes you want to use. If you are limed to CString then ofcourse CString is now shared with ATL/MFC you will not have any problems. If you want to use any MFC functionality that depends on the "AFX state", you need to do something more complicated especially for services.
So what exactly do you want to use?
|
|
|
|
|
I want to reuse lot of code from my old service project written with VC++ 6.0.
I know that ATL 7.0 supports collection classes and CString, but I don't want to rewrite my old code.I want to just reuse it by including MFC headers and maybe few work arounds without touching the old code.....any suggestions for me? thanks...
RamDili
|
|
|
|
|
Does anyone now how to open/close a deskband(on the taskbar) programatically? Also, is there a way to make explorer release the deskband once the deskband is closed? I created a deskband, but if you close it explorer still holds on to it. So you can't delete it without closing explorer. Am I doing something wrong??? Please help
|
|
|
|
|
"Does anyone now how to open/close a deskband(on the taskbar) programatically?".. or at least hide?
|
|
|
|
|
i want to create array of controls(command buttons % text boxes)in MFC applictaion. plz tell me iz it possible or not.if yes, then how?????????
|
|
|
|
|
I'd use a vector, of CWnd objects if they are to be different controls, then you can use dynamic_cast to figure out which is what.
in your header:
vector<CWnd*> m_vec_pWnd;
in your cpp:
CEdit * pEdit = new CEdit(provide default parameters);
m_vec_pWnd.push_back(pEdit);
Now you can iterator through the list and set all text boxes to say "STL rules" by doing this:
vector<CWnd*> it = m_vec_pWnd.begin();
vector<CWnd*> end = m_vec_pWnd.end();
while (it != end)
{
CEdit * pEdit = dynamic_Cast<CEdit*>(*it);
if (pEdit)
pEdit->SetWindowText("STL rules");
++it;
}
You may, however, prefer to put them in a map so you can name them and thus identify them by more than their type...
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
|
|
|
|
|
Christian's way is great if you create the controls dynamically at run time.
If you are familiar with VB control arrays and expect the resource editor to do it for you, then NO it wont.
Another way to create a control array AND use the resource editor is to use a vector or map just like Christian suggests, but instead of base it on CWnd*, base it on HWND and call GetDlgItem(IDC_XXX)->GetSafeHwnd(). Populate the vector/map in the OnInitDialog message handler.
|
|
|
|
|
Matt Gullett wrote:
If you are familiar with VB control arrays and expect the resource editor to do it for you, then NO it wont.
I'm sorry, I don't know VB, so I presumed this was what he wanted.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
|
|
|
|