|
Hello All-
I'm working on a SQL database application. The database contains a main table of information, and then each table has another set of data associated with it from another table. What I'd like to do is keep a maximized view of the main table of data open at all times (just like with SDI), and then be able to open up in MDI-like child views of each subset of data associated with an item in the main view.
Another way to describe what I want would be to say I want MDI with the root main frame window also containing a view in it.
Please give me any suggestions you can.
Thank You!
Caleb Peterson
|
|
|
|
|
I am doing a multi-column listbox,I set its styles:OwnerDraw-Fixed,Multi-column and "No integal height".Then I add virtual function MeasureItem and add code :
void CColorListBox::MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct)
{
// TODO: Add your code to determine the size of specified item
CRect rect;
GetWindowRect(&rect);
ScreenToClient(&rect);
lpMeasureItemStruct->itemHeight=rect.Height()/2;
lpMeasureItemStruct->itemWidth=rect.Width()/4;
}
I add a member function to initialize the data and call this function in PreSubclassWindow:
void CColorListBox::InitData()
{
SetItemData(0,RGB(255,0,0));
SetItemData(1,RGB(0,255,0));
SetItemData(2,RGB(0,0,255));
SetItemData(3,RGB(125,0,0));
SetItemData(4,RGB(0,125,0));
SetItemData(5,RGB(0,0,125));
SetItemData(6,RGB(125,125,0));
SetItemData(7,RGB(125,125,125));
}
The last I do DrawItem:
void CColorListBox::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
// TODO: Add your code to draw the specified item
CDC* pDC=CDC::FromHandle(lpDrawItemStruct->hDC);
UINT action=lpDrawItemStruct->itemAction;
UINT state=lpDrawItemStruct->itemState;
CRect rcItem=lpDrawItemStruct->rcItem;
//pDC->SetBkMode(TRANSPARENT);
if( !(state&ODS_SELECTED) )
pDC->FillSolidRect(&rcItem,(COLORREF)lpDrawItemStruct->itemData);
}
Is there something wrong in my operation?I set a breakpoint in MeasureItem and debug the program,but it don't run through the breakpoint?
I appreciate your comments~
|
|
|
|
|
The problem has been solved~
Thanks~
|
|
|
|
|
You can share your answer;)
|
|
|
|
|
Hi, I've created a new horz scroll in a CDialog with this:
wnd_hscroll.Create(WS_CHILD | WS_VISIBLE,rct_hscroll ,this,9999);
and set its range with:
wnd_hscroll.SetScrollRange(1,1000,TRUE);
However, the control is not willing to respond to SetScrollPos or sliding the gripper when the app is running.
Any suggestions? Thx.
Live long and prosper
johny74656@gmail.com
|
|
|
|
|
Maintaining .def file is obsolete with currect C++ compilers. Instead you can use __declspec(dllexport) .
|
|
|
|
|
|
Hi All,
I have some CEdit's in an CFormView and I can do copy&paste by using the contextual menu but I just cannot do that by using the keyboard combinations Ctrl+C, Ctrl+V and so on. Of course there is no such problem for a CEdit in a CDialog.
I suppose there are some keywords' related messages eaten by CFormView. Any tips on how to solve that? Thanks.
Regards,
Cosmin Unguru
|
|
|
|
|
does your app have accelerators defined for those keyboard combinations?
|
|
|
|
|
Yes it does, for copy, cut and paste. I tried to remove them but with no different results.
Regards,
Cosmin Unguru
|
|
|
|
|
hi iam doing a project to list <like dir=""> but only header files any good refrence for me?
|
|
|
|
|
arifliminto86 wrote: hi iam doing a project to list but only header files any good refrence for me?
Sorry?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
arifliminto86 wrote: hi iam doing a project to list but only header files any good refrence for me?
sorry dude.. this windows programing forum.. here linux is rare breed.. you have to search google for linux grp!
|
|
|
|
|
How the f*** this is sickening.
void fun(int);
void main()
{
int a ;
a=3;
fun(a);
}
void fun(int n)
{
if(n==0)
exit(0);<--If I put this the ouput is nothing, but if I remove it, the idiot compiler is bypassing the condition (0>0),(-1>0).
if(n>0)
{
printf("\nTHERE!");
fun(--n);
printf("\n%d",n);
fun(--n);
}
else
{
printf("\nHERE!");
}
}
How 0,-1 can be > than 0? sh*t. I'm not on drugs! but mark,led,jeron,toxcct,david someone help! help!
without exit(0),it prints
0
1
2
0
----------------------------
286? WOWW!
|
|
|
|
|
First off, what is the output you are expecting? With the recursive calls you are making the output you are getting makes perfect sense.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
Thanks Arends,
but why does it bypass this condtion when n =0, or -1
<br />
if(n>0)
{<br />
but still it comes here! why? <br />
}<br />
I still can't get that point. Recursion makes multiple copies of the function? may be I'm missing this? it gets into the stack everytime we call it, so the context of "n" changes? I can somehow come around the point but still need some help to understand it. Please help dude.
-- modified at 14:06 Saturday 31st March, 2007
----------------------------
286? WOWW!
|
|
|
|
|
_8086 wrote: but why does it bypass this condtion when n =0, or -1
It does not, the recursive function calls stop when n is zero or less.
I think your confusion is coming from what n is. You have to remember that a new n is created every time fun() is called, you are not using a single n .
I cleaned up your sample a bit, so lets step through it:
void fun(int n)
{
if (n > 0)
{
fun(--n);
+void fun(int n)
|{
| if (n > 0)
| {
| fun(--n)
|
| +void fun(int n)
| |{
| | if (n > 0)
| | {
| | fun(--n)
| |
| | +void fun(int n)
| | |{
| | | if (n > 0)
| | | {
| | | fun(--n)
| | | printf("%d\n", n);
| | | }
| | +}
| |
| | printf("%d\n", n);
| | }
| +}
|
| printf("%d\n", n);
| }
+}
printf("%d\n", n);
}
} and repeat ad infinitum.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
|
Of course the compiler is working fine. Please follow me in code inspection, to make analysis shorter, let's start with fun(2) :
fun(2){
if(2>0){
fun(1);
At the moment (no output yet produced) we have to stop considering fun(2) and, due to recursion, procede with the inspection of fun(1) :
fun(1){
if(1>0){
fun(0);
Again (no output yet), we have to suspend considering fun(1) and go deeper in recursion with fun(0) :
fun(0){
if(0>0){
Here, the compiler, that is a honest guy, correctly evaluates (0>0) as false and the function returns. Have we done? No, of course, there are (in the order) fun(1) and fun(2) waiting on the stack. So let's go back to fun(1) and reprise whereever we suspended:
printf("\n%d",0);
fun(-1);
}
As you can see, this is the first time we have a number on the console, and the number is 0 (you can also see that fun(-1) is called, but it will do nothing). Of course we could go on with code inspection, but I think it's enough: we have the zero , and we also have the demonstration that the compiler is not insane.
hope that:
(1) the analysis is correct.
(2) it helps.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
|
Hello,
From where can I get the parameters which are required for
CHttpConnection class.
I basiacally want to get data from a remote computer .I have the IP address of the computer .Both the computers have internet access.
I have been through all the MFC iternet classes.But I do't understand from where these parameters be available.
CHttpConnection* GetHttpConnection( LPCTSTR pstrServer, INTERNET_PORT nPort = INTERNET_INVALID_PORT_NUMBER, LPCTSTR pstrUserName = NULL, LPCTSTR pstrPassword = NULL );
Prithaa
|
|
|
|
|
Is this related to your ip address question below?
To get a file from a remote computer, the remote computer needs some kind of server to serve
you the file.
To use CHttpConnection there needs to be an HTTP server running on the remote computer.
To use CFtpConnection there needs to be an FTP server running on the remote computer.
etc.
Mark
"If you can dodge a wrench, you can dodge a ball."
|
|
|
|
|
Hello
Yes my problem is related to the ip address problem.
My remote computer is having an internet connection.
It does not have any server.
I thought ip address should be enough to recognize the PC on the Net.
If I am using a CDatabase class to access a remote computer's database then what kind of connection string should I provide.
Can you give me a link for the same.
I think there are many people on this site asking the same question.You can link me to that question if possible.
Prithaa
|
|
|
|
|
Without some kind of "server" running on the remote machine (HTTP,FTP,SQL Server, etc.) then
an IP address isn't useful. There needs to be some application waiting for connections at the
given address (IP/Port).
Connection strings vary between databases - what database are you connecting to?
Mark
"If you can dodge a wrench, you can dodge a ball."
|
|
|
|
|
Hello,
Right now I am connecting to access database but soon I will have to connect to SQl server.
I have created an ODBC driver for my PC for access database but if I have the database on a remote computer then I will have add something in the network connections option of ODBC driver and provide a proper connection string in my CDatabase class isn't it?
But I don't know how to do the changes?
Prithaa
|
|
|
|
|