|
Padmanabha_M wrote: But not working, i will give that snippet
Code snippet or not, relative paths are just just...relative. You must first ensure (hint: don't assume) that the current working directory is such that "..\\..\\Dev\\Devices\\MCAL_Template_Make" is a valid folder.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
I'm using the Ultimate Toolbox Library, and working with the SkinsDemo example of the library distributed packages. It's just great, but i have two questions:
1- The original example using TabAllDockedControlBars() to group FoldersBar and the PropertiesBar on a Tabbed bar at the right of the main window. But at the initialization, the Tabbed bar was minimized to the right border, and nothing shown. If I remove the TabAllDockedControlBars(), three bars are shown, but not tabbed. So why? and how to init it at a specific size ?
2- Now I have 3 FolderBar(s), and want to arrange them in one colunm, three row at the right of the main window. And three bars must be calculated automatically to have the same size (or heigh). So what I have to do?
Please help!
Thanks and Regards!
|
|
|
|
|
As we all know,we use microsoft web control to link some web site.add the control to my application.My fragment code is:
//in mydlg.h file
CExplorer1 m_web;
// on some functions in mydlg.cpp file
VARIANT vTarget;
vTarget.vt = VT_BYREF|VT_I1;
vTarget.pcVal = ("_SELF");
m_web.Navigate("http://mysite/login.jsp?logname=mylogname&password=mypassword",NULL,NULL,NULL,NULL); (1)
m_web.Navigate("http://mysite/query.jsp",NULL,NULL,NULL,NULL); (2)
//the above code (1) is no problem,but, if i want to link a query page (2) after (1) ,is refused.
please, how to solve the problem if i want to link a page after link the verification or login page such as "http://mysite/login.jsp"?
thanks advanced very much!
|
|
|
|
|
Not very good in Web programming, there may be alternatives. But how about redirecting from login.asp ? Also, why not waiting to complete the first navigate. There are events from web browser control to check the status of navigation.Please check the design.
|
|
|
|
|
cwj_ wrote: //the above code (1) is no problem,but, if i want to link a query page (2) after (1) ,is refused.
Ummm - I note you don't check any error return values - it might help if you did and told us what they were - that could point to the reason your code isn't working as you hope...
Also - the class 'CExplorer1' - that's not one built into MFC (or any other class library I know of) - what, pray tell, might it be?
Finally - your problem is likely to be because you haven't waited for the web control to actually finish loading the first web page before navigating to the second one - the web control's Navigate method is not synchronous - it returns pretty much immediately, not after hte web page has completely loaded. You need to handle the web control's NavigateComplete[^] event to detect when the first web page has been completely loaded.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
use this,have a try
CString url;
GetDlgItemTextW(ULREDIT,url);
VARIANT var;
var.vt = VT_BSTR;
var.bstrVal = L"_self";
this->m_browser.Navigate(url,NULL,&var,NULL,NULL);
|
|
|
|
|
the article is, the programming window ... make the matrix of the matrix A
This is the code which i did but algorithm fails...
can you help me decode...thanks!
#define IDC_MYBUTTON 100 // Идентификатор кнопки
#define IDC_MYEDIT1 102 // Идентификатор поля редактирования 1
#define IDC_MYEDIT2 104 // Идентификатор поля редактирования 2
#include "afxwin.h"
#include <iostream>
using namespace std;
class CMyButton: public CButton
{
public:
afx_msg void OnLButtonDown(UINT, CPoint);
private:
DECLARE_MESSAGE_MAP();
};
void CMyButton::OnLButtonDown(UINT, CPoint)
{
AfxMessageBox("...");
}
BEGIN_MESSAGE_MAP(CMyButton, CButton)
ON_WM_LBUTTONDOWN()
END_MESSAGE_MAP()
class CMainWnd : public CFrameWnd
{
public:
CMainWnd();
afx_msg void OnLButtonDown(UINT, CPoint);
afx_msg void OnRButtonDblClk(UINT, CPoint);
afx_msg void OnKeyDown(UINT, UINT, UINT);
~CMainWnd();
CStatic* MyStatic;
CMyButton* MyButton;
CEdit* MyEdit1, * MyEdit2;
DECLARE_MESSAGE_MAP();
};
BEGIN_MESSAGE_MAP(CMainWnd, CFrameWnd)
ON_WM_LBUTTONDOWN()
ON_WM_RBUTTONDBLCLK()
ON_WM_KEYDOWN()
END_MESSAGE_MAP()
void CMainWnd::OnKeyDown(UINT, UINT, UINT)
{
AfxMessageBox(" Key Button Down ");
}
void CMainWnd::OnRButtonDblClk(UINT, CPoint)
{
AfxMessageBox(" Rigth Button Click ");
}
void CMainWnd::OnLButtonDown(UINT, CPoint)
{
char buff[255];
int count=0;
MyEdit1->GetLine(0,buff);
AfxMessageBox(buff);
}
CMainWnd::CMainWnd()
{
Create(NULL,"Лабораторная работа № 10",WS_OVERLAPPEDWINDOW,CRect(500,250,800,450),
NULL,NULL);
MyStatic = new CStatic();
if (MyStatic!=NULL) MyStatic->Create("matrix",WS_CHILD|WS_VISIBLE|SS_CENTER,
CRect(100,10,140,50),this);
MyButton = new CMyButton();
MyEdit1 = new CEdit();
if (MyEdit1!=NULL) MyEdit1->Create(WS_CHILD|WS_VISIBLE|WS_BORDER,
CRect(40,10,80,50),this,IDC_MYEDIT1);
MyEdit2 = new CEdit();
if (MyEdit2!=NULL) MyEdit2->Create(WS_CHILD|WS_VISIBLE|WS_BORDER,
CRect(160,10,200,50),this,IDC_MYEDIT2);
if (MyButton!=NULL) MyButton->Create("=",WS_CHILD|WS_VISIBLE|SS_CENTER,
CRect(220,10,280,50),this,IDC_MYBUTTON);
MyEdit1->SetWindowTextA("2");
MyEdit2->SetWindowTextA("3");
}
CMainWnd::~CMainWnd()
{
if (MyStatic!=NULL) delete MyStatic;
if (MyButton!=NULL) delete MyButton;
if (MyEdit1!=NULL) delete MyEdit1;
if (MyEdit2!=NULL) delete MyEdit2;
}
class CMyApp : public CWinApp
{
public:
CMyApp();
virtual BOOL InitInstance();
};
CMyApp::CMyApp()
{}
BOOL CMyApp::InitInstance()
{
m_pMainWnd=new CMainWnd();
ASSERT(m_pMainWnd);
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
matrix a;
a.inmatrix();
cout << "beginning: "<<endl;
a.outMaTrix();
int i,j;
int z =1;
do
{
cout << "enter row to delete: ";
cin >> i;
cout << "enter col to delete: ";
cin >> j;
a.MaTrixdel(i,j);
cout << "do you want to continue? 1: yes, 0: no ";
cin >> z;
} while (z == 1);
return TRUE;
};
CMyApp theApp;
class matrix
{
private:
int m_Col;
int m_row;
int a[100][100];
public:
void inmatrix()
{
cout << "enter row: ";
cin >> m_row;
cout << "enter col: ";
cin >> m_Col;
for (int i=1; i<=m_row; i++)
{
for (int j=1; j<=m_Col; j++)
{
cout << "enter a["<<i<<"]["<<j<<"]: ";
cin >> a[i][j];
}
}
}
void outMaTrix()
{
for (int i=1; i<=m_row; i++)
{
for (int j=1; j<=m_Col; j++)
{
cout << a[i][j] << " " ;
}
cout <<endl;
}
}
void MaTrixdel(int i, int j)
{
cout << "matrix after deleted: \n";
if ((i<=m_row)&&(j<=m_Col)) {
for (int k=1; k<=m_row; k++)
{
for (int h=1; h<=m_Col;h++)
{
if (!(k==i||h==j))
{
cout<<a[k][h]<<" ";
}
}
cout <<endl;
}
}
else cout<<"error:you are not right\n";
}
};
|
|
|
|
|
kiemxai wrote:
void inmatrix()
{
cout << "enter row: ";
cin >> m_row;
cout << "enter col: ";
cin >> m_Col;
for (int i=1; i<=m_row; i++)
{
for (int j=1; j<=m_Col; j++)
{
cout << "enter a["<<i<<"]["<<j<<"]: ";
cin >> a[i][j];
}
}
}
Out of interest - have you ever heard of input parameter validation (i.e. making sure m_row and m_Col are valid).
Also - you may be interested to learn that arrays in C/C++ have index ranges of 0-(size-1) (i.e. 0-99 in your case), not 1-size.
I've got no idea about the MFC stuff - I'm not wading through all that.
Also - kiemxai wrote: This is the code which i did but algorithm fails...
'algorithm fails', you say - OK, what were you expecting it to do, and what did it actually do?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
you can say more specific,with you specific code should be like?
|
|
|
|
|
kiemxai wrote: you can say more specific,with you specific code should be like?
Not really - I don't know what your code is meant ot achieve - hopefully you know that...
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi,
I'm working with a large project with lots of classes and I have a problem with including the classes. I use include guards at the top of my .h files (I've tried using #pragma once as well) to prevent including more than once. When I include the header of a class I need to use I get an error saying "undefined class", if I was using a pointer I could use a forward declaration but I'm not using a pointer, how do I get around this?
Thanks.
|
|
|
|
|
It'd help if you posted some code...
But if you have something like this:
#include "b.h"
class A
{
B b;
};
#include "a.h"
class B
{
A a;
};
then you're stuffed - that can't be fixed, because A needs to see a full definition of B before it's defined, and B needs to see a full definition of A before it's defined.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thanks, that makes sense. I hadn't looked at it that simply until I saw that.
What would be the "standard" way of creating member variables that reference each other, using your example:
#include "b.h"
class B;
class A
{
B *b;
CString s1;
};
#include "a.h"
class A;
class B
{
A *a;
CString s2;
};
That would work now I've used a forward declaration of the class and used a pointer but it seems "messy" to me to have one class as a pointer and the other not. It also seems a waste to have to implement a destructor to clean up the pointers.
|
|
|
|
|
Pointers are good.
An alternative is to use the pimpl idiom[^]:
class A
{
A();
private:
struct A_impl;
A_impl* impl_;
};
class B
{
B();
private:
struct B_impl;
B_impl* impl_;
};
#include "a.h"
#include "b.h"
struct A::A_impl
{
B b;
};
A::A() : impl_(new A_impl) {}
#include "b.h"
#include "a.h"
struct B::B_impl
{
A a;
};
B::B() : impl_(new B_impl) {}
In either case, you need to take care with copy constructors and assignment operators.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thanks for the link, very interesting but I think I'll stick with pointers for now.
|
|
|
|
|
First of all, I am a new programmer and dont know much.. This is what I'm trying to do.
Write a program for Jail Administration (inmate info, book-in info, book-out info etc) but this program must also be able to extract data that is already entered into the fingerprinting system. This fingerprinting system takes the pictures and has most of the inmates information (but not all). So I need to be able to add an inmate to the fingerprint system and my new program on a seperate computer automatically add this information as well and then I can go in and add the additional information.
Or even the other way around.. when I add info on my program I make in sends it to the fingerprinting system via network..
I'm just trying to get some direction on how to get this done. Any help would be appreciated. Thanks
|
|
|
|
|
Use a 'database' , 'query' it or 'update' the 'tables'.
I hope you heard all those words in your last class.
|
|
|
|
|
dunlapjw wrote: So I need to be able to add an inmate to the fingerprint system and my new program on a seperate computer automatically add this information...
Do you have control over this "fingerprint system" such that it can send your program the data?
dunlapjw wrote: ...when I add info on my program I make in sends it to the fingerprinting system via network..
Do you have control over this "fingerprint system" such that it can receive data from your program?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
I work in windows xp with visual studio c++ 6, by default byte alignment is 8, and qt 3.2.2. i have a program with the default byte alignment that work well.
I need to change byte alignement of my qt program to 4. Changing alignemnt of the program result in a popup error window, in the call of the show qt function of the window. If i don't call the show function the program doesn't produce no error and run ok .
I've tried both: changing byte alignemnt of all the projects (in the settings dialog), and just changing the alignment of a struct by writting pragma pack(4) before definition of the class.
|
|
|
|
|
OK - I'll bite - couple of questions first:
- Why change the alignment?
- Can you show us the call-stack resulting when the exception is raised?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
1.because i have another application that work in byte alignment 4. this other application receive msg from another computer that work in byte alignement
2.No i can't, i'll just copy a few line of it.
but i didn't see something interesting in the call stack;
qt-mt322! an address
MainWindow::qt_invoke(int,QUObject*)
qt-mt322! an address
qt-mt322! an address
....
Gui!WinMain...
When installing qt, it compile it, must i compile qt from scrath with flag zp4 ?
|
|
|
|
|
yaronillouz wrote: 1.because i have another application that work in byte alignment 4. this other application receive msg from another computer that work in byte alignement
Is the message received from the other application a Qt object? If not, I fail to see why altering the packing of a single non-Qt structure should cause a problem.
yaronillouz wrote: When installing qt, it compile it, must i compile qt from scrath with flag zp4 ?
Looking at the call stack, I'd say your issue is Qt related, which could well mean that you're giving the Qt DLL an object with an alignment it's not expecting.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
When execute the MDI application (Created purely by framework), the first child frame window is always created automatically!!! Anyone know how to disable this ?
Thanks and Regards!
|
|
|
|
|
In your MyApp::InitInstance, there will a line line:
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
and
if (!ProcessShellCommand(cmdInfo))
return FALSE;
Put the following in between:
if (cmdInfo.m_nShellCommand == CCommandLineInfo::FileNew)
cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;
Hope that helps!
Iain.
In the process of moving to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
It worked, thank you very much!
I've considered these lines of code while searching for the answer, but didn't care much because i don't know anything about command line parsing.
|
|
|
|
|