|
It is WM_NOTIFY, but you need the right sub-message:
afx_msg void OnEndtrackConcentrations(NMHDR* pNMHDR, LRESULT* pResult);
ON_NOTIFY(HDN_ENDTRACK, IDC_CONTROL, OnEndtrackControl)
void CYourClass::OnEndtrackControl(NMHDR* pNMHDR, LRESULT* pResult)
{
You may also need to add this line to your OnInitDialog() to get the message mapped correctly, as by default the header control would report a control ID of 0:
m_Control.GetHeaderCtrl()->SetDlgCtrlID(m_Control.GetDlgCtrlID());
Roger Allen - Sonork 100.10016
Roger Wright: Remember to buckle up, please, and encourage your friends to do the same. It's not just about saving your life, but saving the quality of life for those you may leave behind...
|
|
|
|
|
Thanks for your help.
It works, but I have one more little problem. This is list control from CListView class and I don't know its ID's. I checked this list's ID
by function GetDlgCtrlID() and I created resource symbol of its ID's value and I seted list's and header's IDs by function SetDlgCtrlID() in function OnInitialUpdate(). It works and I hope that it's a good way.
|
|
|
|
|
i wonder, at the moment, alot of text editors are created the same way. toolbars and menus on the top, on the left, treeview, on the right, tags and textarea for multidocuments (resizable) and status bar on the bottom.
how are those editors created? as a dialog based or doc/view multi documents?
thanks for all answers
|
|
|
|
|
.eh.. doc/view multi documents sounds good to me.
jhaga
---------------------------------
Every generation laughs at the old fashions, but follows religiously the new.
Henry David Thoreau, "Walden", 1854
|
|
|
|
|
|
thank you for your answer but i don't get it to work:
To build and run the MULTIPAD sample
1. Open the solution multipad.sln.
2. On the Build menu, click Build.
3. On the Debug menu, click Start Without Debugging.
1. i opened multipad.sln in the vc++,
2. i cannot use the build button. it's disabled!
|
|
|
|
|
Sorry, I am not sure what is wrong with your compiler. What version of VC++ are you using??
John
|
|
|
|
|
|
That is why... You must load the dsw file if it has one. You should have the same example on your help with a proper .dsw file. I know I do...
John
|
|
|
|
|
you mean, the msdn cd?
if so.. then, i'm on it and thanks
|
|
|
|
|
Hi,
Here's what I'm trying to do in my MFC application. Like MS WORD do when you save a document for the first time, you click Save and Word takes the first line of your text and wants to save your document to "My first line of text.doc". Me, I want to create my default file name with the current date, example: today is March 15, then when I click Save (or save as) I would like to see "March15.las".
The default save name is found in the string table under the IDR_MAINFRAME (ID 128).
My IDR_MAINFRAME STRING : LaserPlusBeta1\ndefaultsavename\nLaserPlusBeta1\nLaserPlusBeta1 Files (*.las)\n.las\nLaserPlusBeta1.Document\nLaserPlusBeta1.Document
Is it possible to modify the caption of IDR_MAINFRAME at runtime?
If not, how can I generate my own string every time I save and associate an ID to it? Because the CSingleDocTemplate takes a UINT as first parameter for the IDR_MAINFRAME string.
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CLaserPlusBeta1Doc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CLaserPlusBeta1View));
Thank you
Dave
|
|
|
|
|
Call CDocument's SetPathName() or SetTitle prior to showing the FileSave Dlg.
onwards and upwards...
|
|
|
|
|
If you take alook at the default MFC implementation of CDocument::DoSave():
BOOL CDocument::DoSave(LPCTSTR lpszPathName, BOOL bReplace)
{
CString newName = lpszPathName;
if (newName.IsEmpty())
{
CDocTemplate* pTemplate = GetDocTemplate();
ASSERT(pTemplate != NULL);
newName = m_strPathName;
if (bReplace && newName.IsEmpty())
{
newName = m_strTitle;
int iBad = newName.FindOneOf(_T(" #%;/\\"));
if (iBad != -1)
newName.ReleaseBuffer(iBad);
CString strExt;
if (pTemplate->GetDocString(strExt, CDocTemplate::filterExt) &&
!strExt.IsEmpty())
{
ASSERT(strExt[0] == '.');
newName += strExt;
}
}
if (!AfxGetApp()->DoPromptFileName(newName,
bReplace ? AFX_IDS_SAVEFILE : AFX_IDS_SAVEFILECOPY,
OFN_HIDEREADONLY | OFN_PATHMUSTEXIST, FALSE, pTemplate))
return FALSE;
}
CWaitCursor wait;
if (!OnSaveDocument(newName))
{
if (lpszPathName == NULL)
{
TRY
{
CFile::Remove(newName);
}
CATCH_ALL(e)
{
TRACE0("Warning: failed to delete file after failed SaveAs.\n");
DELETE_EXCEPTION(e);
}
END_CATCH_ALL
}
return FALSE;
}
if (bReplace)
SetPathName(newName);
return TRUE;
}
If you were to override this function in your MFC document copy/paste the above and replace the bold section with your own code to determine the default filename, it should do what you need.
Roger Allen - Sonork 100.10016
Roger Wright: Remember to buckle up, please, and encourage your friends to do the same. It's not just about saving your life, but saving the quality of life for those you may leave behind...
|
|
|
|
|
Thanks for your answer,
But I did what basementman suggested: I'm using SetTitle() and it's working fine.
Here's where I put the function, in my CLaserPlusBeta1Doc.cpp:
BOOL CLaserPlusBeta1Doc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
// TODO: add reinitialization code here
// (SDI documents will reuse this document)
CDocument::SetTitle("MyTitle");
return TRUE;
}
I don't need to specify a path name, so it's easier this way.
Dave
|
|
|
|
|
I need the code for opening a file in Microsoft Access from Visual C++. I want to create a button that when you click the button, the program will take you to a file in Microsoft Access.
|
|
|
|
|
You could put it into "Tools", just type in the full command line for Access.
My neighbours think I am crazy - but they don't know that I have a trampoline. All they see my head bobbing up and down over the fence every five seconds
|
|
|
|
|
maybe your neighbours are right
I think the poster meant from a program written using Visual C++, rather than the IDE.
Check out CDaoDatabase and related classes, although my preferred route would be OLE DB using the atldbcli.h templates.
Steve S
|
|
|
|
|
How about using ShellExecute(..., "open", "myfile.mdb", ...) ?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
For application that I'm making, I'm using VC+6/MFC and for help, I'm Using "Winhelp.exe"
To open help file from my application, I use command like following
:
:
::WinHelp(this->m_hWnd,"filename.hlp",HELP_CONTEXT,HELP_SEC_NOTATION);
:
:
My question is how to keep that help window remain on top (when I click other part of application)
What I want is keeping help window alaways visible until close help window.
I hope you suggest way for that
Thank you.
|
|
|
|
|
For dialog base applications all you have to do is to add this method to your dialog:
void CTopDlgDemoDlg::StayOnTop() const
{
CRect rect;
// get the current window size and position
GetWindowRect( rect );
// now change the size, position, and Z order
// of the window.
::SetWindowPos(m_hWnd , // handle to window
HWND_TOPMOST, // placement-order handle
rect.left, // horizontal position
rect.top, // vertical position
rect.Width(), // width
rect.Height(), // height
SWP_SHOWWINDOW // window-positioning options);
}
// add a control button and command handler for the button to your dialog.
// then invoke StayOnTop().
void CTopDlgDemoDlg::OnBtnClick()
{
// make this dialog always on top.
StayOnTop();
}
Hope this helps ya out
Win32newb
"Making windows programs worse than they already are"
|
|
|
|
|
I have a file that is trying to include the header file for MySQL. I have the file in the project folder and have added it to the project and I keep getting this error:
fatal error C1083: Cannot open include file: 'mysql.h': No such file or directory
Can anyone help?
If it's broken, I probably did it
bdiamond
|
|
|
|
|
What happens when you right-click on the #include <mysql.h> statement and select Open Document ... from the context menu? Does mysql.h open successfully?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
and can i ask...
why dont u use the mysql odbc connector?
"there is no spoon" biz stuff about me
|
|
|
|
|
I have the problem solved now. After I added the .lib files and set the additional include paths right everything is working fine now. By the way, I'm using code that I found on this site that are MySQL wrapper classes and another set of Dbase wrapper classes that I also found on this site. I have two different projects that I used just to make sure I could make them both work separately. Now I'm going to put them both in the same project to use them to do an export from a MySQL query result set to a .dbf file. When that's done, (hopefully today), I'm going to put them into a function that accepts the parameters for the connection to the MySQL database and prompts you with a Save As dialog for the .dbf file and put it in a dll so that it can be called from other applications as well. I was thinking about putting this DLL and source up on the site as well (of course with proper acknowledgements to the writers of the other 2 packages I'm using as well). I'm not sure if this is really simple for some of you, but anyone expresses interest, I'll gladly post it on the site.
If it's broken, I probably did it
bdiamond
|
|
|
|
|
I have created an MFC CPP console process and redirected the stdin/stdout/stderr to a windows application. This is so the windows application can send console commands and process the output from the commands. The problem I am having is finding out the status of each command that I send (ie ERRORLEVEL or command result codes).
My implementation at this point creates a new console process, redirects the I/O and then commands can be issued with a printf to the new stdin pipe and reads from the new stdout pipe the results. However, there is no feedback to know when "CMD.EXE" has fininshed the last command so I can send the next one. I would like to keep the console process open and pipes in place, and simply send console commands and accumulate the output from stdout until the command is complete. Then send the next command ASAP.
I wind up having to use hard delays to wait for the last command to finish before I send the next one. I have searched high and low for the proper way to handle this functionality but I am finding no solutions. I assume a make utility does exactly what I am needing to do since it must shell and get the ERRORLEVELS/Result codes. Can anyone point me in the right direction?
|
|
|
|