|
You need to set a status indicator when you hit the button. Then, you need to handle the UPDATE_COMMAND_UI message.
for example:
void CSomeClass::OnButtonClick()
{
m_bEnableMenuItem = false;
}
void CSomeClass::OnUpdateUI(CCmdUI* pCmdUI)
{
pCmdUI->Enable(m_bEnableMenuItem);
}
|
|
|
|
|
This might be wrong board for this question but was just trying my luck to see whether anyone here had a suggestion..
I have a situation which I am trying to solve just by creating SQL's without programming because of some installation requirements. I did not have any luck with it. Was wondering whether anyone knows of a solution :
Here is the situation-
DB2 Table 1:
------------
FirstName LastName DateOfBirth History Begin Date
--------- -------- ----------- -----------
Joe Smith 01/01/95 05/25/1997
Joe Smith 01/01/95 11/01/1997
Bob Smith 05/07/55 10/01/1998
Sherri Gaston 11/11/73 11/15/1999
Sherri Gaston 11/11/73 12/20/1999
Sherri Gaston 11/11/73 05/05/2000
Primary Key in the above table is FirstName, LastName, DateOfBirth.
From the above table I am trying to create a "daily" level table which will have a record for every primary key starting from the first history Begin Date record date to the next history Begin date.
So for example the result for "Joe Smith" will be
Joe Smith 01/01/95 05/25/1997
Joe Smith 05/26/1997
Joe Smith 05/26/1997
Joe Smith 05/26/1997
Joe Smith 05/26/1997
.........until 11/01/1997 (his last record's history begin date).
I don't mind building intermediate temporary tables. Can anyone help or thing of something?
Thank you
M
|
|
|
|
|
One way I could suggest doing this is to...
1) Create a new table for dates (say -re-generate dates out 5-10 years).
2) As part of the date table have a DUMMY_COLUMN which has a value of say 1.
3) Add a DUMMY_COLUMN to your name table again with a value of 1.
4) Now you can do a join against the 2 tables and get the date range you want at any time.
This method should work in just about any database product you might use.
Another way is to write a stored procedure to build the target table. Depending on what version/platform of DB2 you are using this can be easy or very difficult. It could be written in JAVA, COBOL or whatever other language DB2 SPs support.
|
|
|
|
|
But how do u do a join to let the date range start in the first record and go until the next records history date if the keys are the same.
Thank you
M
|
|
|
|
|
At me some libraries are not created for VC.NET!
Whether I can establish VC.NET and VC ++ 6.0 simultaneously?
Best regards,
Eugene Pustovoyt
|
|
|
|
|
Eugene Pustovoyt wrote:
Whether I can establish VC.NET and VC ++ 6.0 simultaneously?
Yes.You can.
Mazy
"The path you tread is narrow and the drop is shear and very high,
The ravens all are watching from a vantage point near by,
Apprehension creeping like a choo-train uo your spine,
Will the tightrope reach the end;will the final cuplet rhyme?"Cymbaline-Pink Floyd
|
|
|
|
|
Thank you Mazdak!
Best regards,
Eugene Pustovoyt
|
|
|
|
|
If the libraries use STL, you might run into some problems as STL is different between 6 and .NET.
Michael
Communication is the first step towards enlightenment.
|
|
|
|
|
Thank you Michael!
Best regards,
Eugene Pustovoyt
|
|
|
|
|
In VC6 there was an option to show all the keyboard binds. Does that exist in VC7?
Todd Smith
|
|
|
|
|
Is this what you're looking for?
Tools->Options->Environment->keyboard
I don't see a way to see the bindings listed by key. Instead they're listed by command.
Cheers,
Tom Archer
Author - Inside C#, Visual C++.NET Bible
|
|
|
|
|
There is an addin called KeyMap available here
Click here
There are lots of other useful addins
Rama Krishna.
Also known as Master of VS.NET
|
|
|
|
|
Rama Krishna wrote:
Also known as Master of VS.NET
This is exactly what I was going to call you and then I saw your sig! Great links and thanks!
Cheers,
Tom Archer
Author - Inside C#, Visual C++.NET Bible
|
|
|
|
|
I have come unstuck trying to do some basic file saving stuff. I want the user to be able to open a file, and then save the filepath for prosperity. The code below works sometimes. When it works it will overwrite the existing file or create a new file (if none exists already) and write the correct path. More often then not though it will not write to file. I have confirmed that it is retrieving the correct filepath each time.
CFileDialog* fdlg;
CStdioFile* file;
// Construct file to write to
file = new CStdioFile();
file->Open("test.dat", CFile::modeCreate | CFile::modeNoTruncate | CFile::modeReadWrite);
// Construct open file dialog
fdlg = new CFileDialog(TRUE);
fdlg->m_ofn.lpstrTitle = "Open Database";
fdlg->m_ofn.lpstrFilter = "MS Access db (*.mdb)\0*.mdb\0\0";
if (fdlg->DoModal() == IDOK)
{
file->WriteString(fdlg->GetPathName());
}
file->Close();
I have been tearing my hair out now for about 30 straight hours so I will sing the praises of anyone who can help (even a little).
Cheers big ears
|
|
|
|
|
#include <iostream>
#include <fstream>
std::ofstream file("test.dat.");
file << (char*)fdlg->GetPathName();
file.close();
You MAY need to get out the CString pathname and use GetBuffer/ReleaseBuffer to pass it to a stream, or you can write a stream handler for CString - I think an article I have on CP does this.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
<i>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.</i> - <b>Christopher Duncan - 18/04/2002</b>
|
|
|
|
|
In_Way_Too_Deep wrote:
file->WriteString(fdlg->GetPathName());
Make that :-
file->WriteString(fdlg->GetPathName()->GetBuffer());
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
What happens if you call GetBuffer without a size ? What happens if ReleaseBuffer is never called ?
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
|
|
|
|
|
Christian Graus wrote:
What happens if you call GetBuffer without a size ? What happens if ReleaseBuffer is never called ?
In this case it doesn't matter. Because WriteString expects a LPCTSTR
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
|
Hi.
I am getting closing to completing a simple messaging program. I will use the WSAAsyncSelect I/O mode. The design is simple, but I have found a major problem. The WSAAsyncSelect is not the best I/O mode, but it is easy to implementing for MFC based applications.
WSAAsyncSelect uses the winproc as a way to update the program about sockets including send, receive, close, accept, etc. So basically, the WSAAsyncSelect I/O mode turns an otherwise blocking socket into a non-blocking socket. It uses the WPARAM and LPARAM to store errors and data structures required to, for example, create a new socket linked to the user that is trying to connect to the server.
Now comes the problem. I declared all program data such as the socket, listening socket, sockaddr, etc. in the doc. However, WSAAsyncSelect sends a message with the WPARAM and LPARAM to main frame. I have no idea how to pass WPARAM and LPARAM from main frame to doc so I can process the data.
I see two possible solutions.
1) pass WPARAM and LPARAM from main frame to doc
2) redirect WPARAM and LPARAM from main frame to doc view SendMessage(). However, doc cannot process WM_USER message, can it? I cannot find the SendMessage() for doc.
Please post if you have a working solution for the WSAAsyncSelect I/O mode.
Thanks,
Kuphryn
|
|
|
|
|
Store the pointer to your document class in a member variable of CMainFrame. Now you can access all the CDocument members you've added, from the main frame class.
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Thanks.
Oh oh. MFC and Winsock is only beginning to get interesting. If I have pointer to doc, that would break the OOP encapsulatiion standard, would it not???
Kuphryn
|
|
|
|
|
Okay. I believe I have a solution. However, I am debugging another problem, so I am not completely sure that the solution works.
The solution I implemented compiled, but I have not fully tested it. The solution is to pass the a reference of wParam to doc.
I like this solution because I do not have to use a pointer to doc just to access its private data. This solution keeps the OOP encapsulation standard intact.
Kuphryn
|
|
|
|
|
I'm making a MFC dialog based program and I would like to change between two different bitmaps in a picture box. I assigned a static control to it and found a function called SetBitmap(HBITMAP hBitmap). Is this the right one? And if I want to change it to a resource bitmap how should i do? It's called IDB_BITMAP.
|
|
|
|
|
tordyvel wrote:
Is this the right one?
Yup.
tordyvel wrote:
And if I want to change it to a resource bitmap how should i do? It's called IDB_BITMAP.
HBITMAP hNewBmp = static_cast<HBITMAP>(::LoadImage(AfxGetResourceHandle(),
MAKEINTRESOURCE(IDB_BITMAP), IMAGE_BITMAP, 0,0,
LR_DEFAULTCOLOR|LR_SHARED));
--------
Higher education helps your earning capacity. Ask any college professor. --Shog9 --
|
|
|
|