|
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
|
|
|
|
|
Yea, I'm not sure that is what we wanted either. Its just that I've seen this question come up quite a few times and most of the time it is a VB type person. I've even considered creating a template class to make this possible in VC++, just to permanently answer this question.
|
|
|
|
|
I have a Cstatic control in a dialog that draws something lengthy in response to a ON_WM_CTLCOLOR message. I need a way to interupt the process of drawing to do something else and resume drawing when finish. For example i need to have access to other controls and change various options and then resume drawing. Or basically how to have an accessible "stop" button while the drawing goes on, in order to interupt the drawing.
Is there a way without thread ? or any similar example ?
Thanks
Pierre
maurizot@canl.nc
|
|
|
|
|
Solution: don't do any lengthy processing when handling messages. Especially messages that will be generated while painting. If you don't follow this rule, your application will quickly become painful to use.
Move whatever lengthy processing you're doing in WM_CTRLCOLOR to somewhere else. Draw onto an off-screen bitmap, save the results of your calculations, whatever. Then just use the cached data during message processing. Once this is done, you'll have enough flexability to move the processing into a separate thread if necessary.
--------
This is what we've waited for
This is it boys, this is War! --Shog9 --
|
|
|
|
|
I want to send messages to toolbar button to be clicked automatically. I can do that with normal buttons but how can I do that with toolbar. I can get the handle of window by the same old SPY++ technique.But i cant get the button in toolbar. So how can i send a click message to button of a toolbar if i have handle of toolbar and buttons XY location.
In my dream, I was dorwning my §orrow§
But my §orrow§, they learned to §wim
|
|
|
|
|
The buttons on a toolbar are part of the control, not individual controls themselves. So, you must send messages to the toolbar control. There are messages meant to change the state of an individual button if you wish it to look pushed (don't remember off the top of my head, check MSDN), but if you just want to fake the effect of the button getting pressed, you can just send a WM_COMMAND message to the window's owner, including the ID of the specific button.
--------
This is what we've waited for
This is it boys, this is War! --Shog9 --
|
|
|
|
|
Thanks. But I dont have the control ID and secondly I am out of process. So I cant send NM_CLICK messages to buttons. Secondly I cant get the ToolBar nID to use with GetDlgItem.
Please Please help.
In my dream, I was dorwning my §orrow§
But my §orrow§, they learned to §wim
|
|
|
|
|
Ok, no matter what you're trying to do, it'll be easier if you can determine the command ID of the specific button. Since i don't know what you're doing, i can't really suggest anything other than using Spy++ to watch the messages sent when you press the button.
Once you have the command ID, you can activate the function by simply sending the toolbar's owner a WM_COMMAND message.
--------
This is what we've waited for
This is it boys, this is War! --Shog9 --
|
|
|
|
|
Well thanks a lot. I really appreciate your help. I think I have solved the problem. Here is the procedure.
I get XY of button when user releases mouse over the button.So I also get the Handle to toolbar.To click on button i need handle of button that i can get through
gChildHwnd=::ChildWindowFromPoint(gHwnd,m_stBull.m_point);
this way I get its handle and then send messages WM_LBUTTONDOWN and WM_LBUTTONUP.This works just fine and clicks on the button.Thanks again for your support.
In my dream, I was dorwning my §orrow§
But my §orrow§, they learned to §wim
|
|
|
|
|
How do i make a true DOS program that can be run in DOS (not in a dos shell like MS-DOS but when you boot the computer into DOS)?
And can i still use libraries like stdlib and iostream or do i need an entirely different approach? I dont so much need an answer for Visual C++ but more in general...
Thanks
Kuniva
|
|
|
|
|
First of all you need a DOS compiler, VC++6 can't create DOS executables. When you have the right compiler, you can use all its features.
|
|
|
|
|
Depends the operating system.....
If you are using Win98 or win95, when you boot in DOS mode, you are using the Kernel, in that mode you can use a console project, but if you are using a operating system like MSDOS, you need a old compiler like Turbo C or the Visual C++ 1.0
Regards
Carlos Antollini.
www.wanakostudios.com
Sonork ID 100.10529 cantollini
|
|
|
|