|
Sorry, I'm firmly contrary to giving higher priority to VIP cars.
Veni, vidi, vici.
|
|
|
|
|
|
Bad boy.
Veni, vidi, vici.
|
|
|
|
|
You forgot urinating on the door handles. Always makes me laugh!
==============================
Nothing to say.
|
|
|
|
|
At my age I'm not sure my pressure or aim is up to that. I'm off to the pub later, I'll try it on the way home and text y'all from the cells when I find out how it works
|
|
|
|
|
You useless arse. Who the hell employed you to write code.
And if you are still at college, change courses, you are totally incapable of becoming a programmer.
==============================
Nothing to say.
|
|
|
|
|
Good luck with that!
|
|
|
|
|
ambreen1153 wrote: have to Write Program code in C++ for car Parking system using queues ,In which
any VIP car is given Priority,The code should contain some simple graphics
also..
1. Learn basic C++ programming
2. Learn basic GUI programming in C++
3. Learn how to design an application
4. Learn how to build a queue that supports prioritization
5. Put steps 1-4 together.
6. Unit test 5.
|
|
|
|
|
Is this graphics simple enough?
|
|
|
|
|
That post came in with pure hope, optimism and joy.
I wonder what sort of fantasy dream or vision the poster was expecting from this forum. It reminds of those people that walk around and always ask if you have an extra cigarette.
I guess in the unicorn world, everyone would of pitched in to write the program, and we can all eat candy corn, or simply feed off the rock candy mountain.
I know the poster left with a dead unicorn and a rainbow of fire.
The only thing missing was delete your bookmark on the way out.
Thanks for the humor today
|
|
|
|
|
hello guys... I am trying to return CArray which I create locally in a function. It simply caontains names. Now this array will be modified by other functions. Here is what it looks like
CArray<CString> CMainDlg::GetNames()
{
CArray<CString> arrNames;
arrNames.SetSize(10);
arrNames.SetAt(0, "Ali");
arrNames.SetAt(1, "Salman");
arrNames.SetAt(2, "Zahid");
arrNames.SetAt(3, "Mehmood");
arrNames.SetAt(4, "Tariq");
return arrNames;
}
But the compiler is showing me this error stating - Error C2248: Can not access private member of class CObject . Whats wrong with this code? Thanks for input.
This world is going to explode due to international politics, SOON.
modified 24-May-12 5:17am.
|
|
|
|
|
Apparently you cannot use the CArray copy constructor. As a workaround you may rewrite the method this way:
void CMainDlg::GetNames(CArray <CString> & arrNames)
{
arrNames.SetSize(10);
arrNames.SetAt(0, "Ali");
arrNames.SetAt(1, "Salman");
arrNames.SetAt(2, "Zahid");
arrNames.SetAt(3, "Mehmood");
arrNames.SetAt(4, "Tariq");
}
Veni, vidi, vici.
|
|
|
|
|
May be I am making mistake here but it is not working for me. Here is what I am trying using your technique.
a.h
-------------
private:
CArray<CString> srrNames;
public:
void GetNames(CArray<CString>&);
a.cpp
-------------
void CMainDlg::GetNames(CArray<CString>& arrNames)
{
arrNames.SetSize(10);
arrNames.SetAt(0, "Ali");
arrNames.SetAt(1, "Salman");
arrNames.SetAt(2, "Zahid");
arrNames.SetAt(3, "Mehmood");
arrNames.SetAt(4, "Tariq");
}
And now in a.cpp , till calling GetNames is fine. But as I said earlier, this will be modified by other functions (which are in another class). Passing it's reference is not working. How do I pass this to other function?
This world is going to explode due to international politics, SOON.
|
|
|
|
|
Overloaded_Name wrote: Passing it's reference is not working.
What does it mean, exactly?
Veni, vidi, vici.
|
|
|
|
|
Well it means it is giving error. I am doing this.
objB.ModifyUsers(&arrUsers);
The error it gives is:
error C2664: cannot convert parameter 1 from 'CArray<TYPE> *' to 'CArray<TYPE> &'<br />
I don't know whether should I do this or not.
This world is going to explode due to international politics, SOON.
|
|
|
|
|
Overloaded_Name wrote: objB.ModifyUsers(&arrUsers);
Should be instead
objB.ModifyUsers(arrUsers);
Veni, vidi, vici.
|
|
|
|
|
Hello
I am trying to get a program to work that is not written by myself. It is a serial com and the problem I get is that the number of bytes read does not equal number of bytes to read. When I try and debug I see that the struct size is 164 bytes but I am only reading 160 bytes??
I did try increasing the timeout but no difference.
thanks in advance for any help
Dean
ReadFile(hfile,&newsystemstate,sizeof(newsystemstate),&nbytes,0)
|
|
|
|
|
That my happen. You might iterate the function call (properly adjusting the ReadFile parameters, of course) until all the bytes have been read.
Veni, vidi, vici.
|
|
|
|
|
I am currently working on a project that requires a RAS server to be set up on a Windows XP Embedded target. The RAS server has been configured and written to the windows image and functions as expected, however at times the server does not appear at boot up time. The only way to make it reappear is to reboot the system and hope it comes up.
I want to be able to create the RAS server connection programmatically if it does not exist. Is this possible? I am using MFC C++ with VS 2008 and do have access to the Windows Driver Kit.
|
|
|
|
|
You dont need to get involved with drivers since the RAS service is usermode. But, IMO the RAS is failing to start because of some issue with the machine set up so any kind of programatic attempt to start the service will fail just like trying to start it manually fails.
So my advice is to debug the service and see why it is failing. eg, is the network dead? Did the network card drivers fail? is there a TCP error? Is dialup networking configured? and so on.
==============================
Nothing to say.
|
|
|
|
|
Thank you, I believe you are correct. The last line in the "ModemLog_Communications cable between two computers" reads:
"Opening the modem device failed with error 00000005"
when the RAS server doesn't come up.
And:
"Waiting for a Call"
when successful.
I will move this discussion to an appropriate forum now that it appears to not be a C++ issue.
|
|
|
|
|
I am using CTabCtrl to switch between doc / view views. Works as expected, no problems.
But I need to change the views when the are "switched" to make OpenCV driver to be happy. The following code does do that before the tabs are switched. ( so far there is only one view in each child frame).
So far I have only two views to deal with, but will have more.
Being naturally lazy, I just do not like the CRuntimeClass and follwing if's.
Is there easier / less typing /error prone way to accomplish this?
How about using the document template to get the view pointer?
TRACE("\nvoid CMDITabs::OnSelchanging(NMHDR* pNMHDR, LRESULT* pResult) ");
// select current view - before tab changes
int i = GetCurSel();
if (i >= 0)
{
TCITEM item;
item.mask = TCIF_PARAM;
GetItem(i, &item);
HWND hWnd = HWND(item.lParam);
CWnd *pWnd = FromHandle(hWnd); // child frame
//CWnd *pChild = pWnd->GetWindow(GW_CHILD); // first child
CView *pChild_View = (CView*) pWnd->GetWindow(GW_CHILD); // first child - view
CRuntimeClass * pRuntime = pChild_View->GetRuntimeClass();
if(pRuntime->m_lpszClassName == "CTCC_MDIView_AVI_Process")
{
CTCC_MDIView_AVI_Process *pProcess = (CTCC_MDIView_AVI_Process *) pWnd->GetWindow(GW_CHILD);
if(!pProcess->m_C_OpenCV_Image->C_DisconnectDriver())
{
AfxMessageBox("failed to disconnect driver", MB_ICONSTOP);
TRACE("\nFailed to disconnect driver");
}
else
{
TRACE("\n\nCTCC_MDIView_AVI_Process driver disconnected ");
AfxMessageBox("\nCTCC_MDIView_AVI_Process driver disconnected ");
}
}
if(pRuntime->m_lpszClassName == "CTCC_MDIView_AVI_Preview")
{
CTCC_MDIView_AVI_Preview *pProcess = (CTCC_MDIView_AVI_Preview *) pWnd->GetWindow(GW_CHILD);
if(!pProcess->m_C_OpenCV_Image->C_DisconnectDriver())
{
AfxMessageBox("failed to disconnect driver", MB_ICONSTOP);
TRACE("\nFailed to disconnect driver");
}
else
{
TRACE("\nCTCC_MDIView_AVI_Preview driver disconnected ");
AfxMessageBox("\nCTCC_MDIView_AVI_Preview driver disconnected ");
}
}
|
|
|
|
|
Even without getting rid of the ifs you could cut down on the amount of reporting code by factoring the whole TRACE/AfxMessageBox malarkey into another function.
And as you've got more arrows than Custer's hat in some of those conditionals it might be worth moving some of them into their own functions. And the casts [1]. And the location of the runtime class object. There's at least one line in there you don't need for getting the runtime class as well. If you do that lot the code might not look so ugly, be easier to read AND modify.
As for runtime class... every time you use something like that you're showing up the fact you've got a missing virtual function. Create a common base class to your views, define a pure virtual function in there to do your disconnection schtick, implement the function in your views, call it where you've got the class name checks now and snip, snip Bob's yer aunty - no more runtime class required and an if statement disposed of.
Anyway the point here is simplify your code, look for places where you branch on type and replace them with virtual function calls.
Cheers,
Ash
[1] Generally loads of arrows in one statement and casting means you're missing member functions of some sort. Objects (with some exceptions) shouldn't expose their data to the world.
|
|
|
|
|
I did ask for a different way to do this and you have provided it, thanks.
I'll try your suggestion and use virtual function, since I have newer used it! Sound like a right solution.
I did not particularly ask for simplifying the existing code, it is the way it is , with all the traces and messages, just to help me to make it work. ( It still needs some tweaking outside tab control).
Putting that stuff in functions would not necessary make it function better, just make it readable, as you pointed out. But that is not the reason I asked for opinions.
|
|
|
|
|
Ok, being a grenhorn in MFC inheritance I am stumpped.
How do I get the real class pointer?
The first child pWnd_View points to the base class only, if casted to it ( CView derivative) or same if the returned pointer is just CWnd.
"Standard " GetWindow returns window pointer.
And I do have class derived from base derived from CView.
GetItem(i, &item);
HWND hWnd = HWND(item.lParam);
CWnd *pWnd = FromHandle(hWnd); // child frame
CWnd *pWnd_View = pWnd->GetWindow(GW_CHILD); // first child - view
|
|
|
|