|
How to order the Queue in C++
tamer hassan
|
|
|
|
|
What queue class are you using ? The STL includes sort methods.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
What do you mean? Can you explain more clearly?
Steve
|
|
|
|
|
the SHBrowseOfFolder() dialog just give option to directory, i want to give a file list box alongside of directory tree box in the dialog to show the files of selected folder .
How to do?
Or are there any component to use direct? If make it myself, i have to make a tree view, it is a nightmare because i use pure C and API.
|
|
|
|
|
When you add this listbox to the dialog, will users be allowed to select files from the listbox?
If so, then there's another common dialog for that - See GetOpenFileName[^]
If you need to modify the SHBrowseForFolder dialog, then the "Remarks" section of
SHBrowseForFolder Function[^] explains how to get a HWND for the dialog which you can
use to manipulate and/or add controls. You'll probably need to subclass the window to get
notifications when the selected folder changes so you can populate your file list.
zhongwenjia wrote: i have to make a tree view, it is a nightmare because i use pure C and API.
What other way is less of a nightmare? You can wrap the APIs in all the C++ classes you want
but you still end up having to do the same operations on a tree control
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
how to differenciate the empty value (. . . .) and 0.0.0.0 in ip address control.
I used
CWnd* pwndCtrl = GetFocus();
int ctrl_ID = pwndCtrl->GetDlgCtrlID();
if (!((CIPAddressCtrl*)pwndCtrl)->IsBlank())
but it treat the . . . . and 0.0.0.0 values as same.
|
|
|
|
|
You are not initializing the control. Use ClearAddress() function in OnInitDialog(). It will display 0.0.0.0 from start.
|
|
|
|
|
after calling the Clearaddress() also its not displaying the 0.0.0.0
CWnd* pwndCtrl = GetFocus();
((CIPAddressCtrl*)pwndCtrl)->ClearAddress();
could you please suggest
|
|
|
|
|
Hello all
I have an information on a hard disk with unknown format which the windows cannot recognize it. and it is very urgent now for me to make a backup. so I am asking for a very low level tool to make a backup for my drives.
|
|
|
|
|
try this
http://www.freedownloadscenter.com/Best/hex-disk-editor.html
|
|
|
|
|
Hi,
I have a C#.net application in which i have read the datas from excel sheet and displayed in a datagrid in my Aspx form.
The code is here
private void Button2_Click(object sender, System.EventArgs e)
{
try
{
string strConnection = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\Salary.xls;Extended Properties=""Excel 8.0;HDR=YES;""";
OleDbConnection conn = new OleDbConnection(strConnection);
//conn.Open();
OleDbCommand command = new OleDbCommand("SELECT * FROM [Sheet1$]", conn);
// command.Connection = conn;
// command.CommandType = CommandType.Text;
// command.CommandText = "SELECT * FROM [Sheet1]";
OleDbDataAdapter da = new OleDbDataAdapter(command);
DataSet ds = new DataSet();
//DataTable dt = new DataTable();
conn.Open();
da.Fill(ds, "EmpSal");
DataGrid1.DataSource=ds;
DataGrid1.DataBind();
//da.Fill(dt);
conn.Close();
lblError.Text="The Excel sheet has been read";
//return dt;
}
catch (Exception ex)
{
Response.Write( ex.Message);
//return null;
}
}
the thing is that i have to upload the datas into the mysql database table. can anybody pls help me with the C#.net code. i need to use only mysql database.(coz we r using mysql db in our project)
Regards
Vijay.
|
|
|
|
|
Posting a C# .NET question in the Visual C++ forum will end in tears. - Chris Maunder
Anything I will say you will bring it down to whatever you want.
|
|
|
|
|
Sorry chris, i didn't intentionally do it. i was in a puzzly mood at the time of posting this question and it ended up mismatched. once again I apologize for my mistake.
Vijay.
|
|
|
|
|
Dear friends,
I am new to vc++. I am writing an application that executes a dos command which generates some files. I can user CreateProcess methid to call the dos command. But I want to exit the function only after the completion of dos command. Is it possible? I heared that I can use WaitForSingleObject. Could any body teach me how to write this?
thanks
|
|
|
|
|
Something like this...
PROCESS_INFORMATION ProcessInformation;
if (::CreateProcess(..., &ProcessInformation))
{
::WaitForSingleObject(ProcessInformation.hProcess, INFINITE);
::CloseHandle(ProcessInformation.hProcess);
::CloseHandle(ProcessInformation.hThread);
}
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I want to store a bunch of MD5 strings computed from username/password. Have any storage class to facilitate this?
Thanks
|
|
|
|
|
whats wrong with std::vector<std::string> ?
it really depends on what you wish to do with the results
'g'
|
|
|
|
|
I have a CDialog derived class (CColorSliderDlg) that has three scroll bars on it.
CColorSliderDlg doesn't have a border and so uses the SetCapture to detect when the mouse has been clicked outside it.
Because I'm using SetCapture the child controls will not get any mouse messages. So in the PreTranslateMessage I check if the message should go to a child and forward it to it.
BOOL CColorSliderDlg::PreTranslateMessage(MSG* pMsg)
{
POINT pnt = pMsg->pt;
ScreenToClient(&pnt);
CWnd *child = ChildWindowFromPoint(pnt,CWP_SKIPINVISIBLE);
if (child != 0 )
{
pMsg->hwnd = child->GetSafeHwnd();
}
return CDialog::PreTranslateMessage(pMsg);
}
When the mouse is released for the slider I set the capture back.
void CColorSliderDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
if (nSBCode == SB_ENDSCROLL)
SetCapture();
CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
}
This works great on the first slider on the dialog.
When I added the other two only the first one will respond.
If I tab and use the keys or the wheel mouse the slider will move. But click and drag just won't.
If I remove the SetCapture everything works great again but I can't close the dialog.
Thanks
Mark
|
|
|
|
|
mtwombley wrote: This works great on the first slider on the dialog.
When I added the other two only the first one will respond.
According to the docs:
"Only one window at a time can capture the mouse."
mtwombley wrote: CColorSliderDlg doesn't have a border and so uses the SetCapture to detect when the mouse has been clicked outside it.
I'm not sure what you're trying to do. If the mouse moves outside the slider then you'll get
WM_LBUTTONDOWN, WM_MOUSEMOVE, etc. messages at the underlying dialog.
Maybe another solution would be to use TrackMouseEvent() on the sliders to tell the system they
should receive WM_MOUSEHOVER and WM_MOUSELEAVE notifications. Then you don't have to fight the
mouse capture stuff.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Thanks Mark for the reply.
I'm not doing the SetCapture on the slider. I'm doing it on the dialog so it knows when the user clicks outside of it and can then close.
My dialog is based on a Color Picker by Luis Ortega http://www.codeguru.com/cpp/controls/buttonctrl/article.php/c2089/.
Luis showed a grid of buttons for the colors and then had an other button.
For my application I wanted to have three sliders for color selection.
I placed one slider on the dialog and got that working which was great. But as soon as I added the other two they stated to act funny. If SetCapture is on the dialog the first slider is the only one that responds.
Hope this clears up my question.
Thanks
|
|
|
|
|
Thanks for more info!
mtwombley wrote: I'm doing it on the dialog so it knows when the user clicks outside of it and can then close.
Maybe this works but here's another line from the docs:
"SetCapture captures mouse input either when the mouse is over the capturing window, or when the
mouse button was pressed while the mouse was over the capturing window and the button is still
down."
I would think when you drag a slider, the slider control is going to capture the mouse so the
dialog will lose the capture anyway.
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Actually that does happen.
But only on the first slider on the dialog. For some reason the other sliders will not accept the first message. I say the first because if you click it twice then it starts working.
Mark
|
|
|
|
|
I tested your code.
I can't move any trackbars until I click on the cancel button but drag the cursor off it before
releasing - that releases capture from the dialog. Then I can drag a trackbar thumb.
I think the PreTranslateMessage() needs to really only pass certain mouse messages to the child
under the cursor, not all messages. I would guess that WM_SETFOCUS and WM_PAINT, at the very
least, are going to be a problem in the current implementation.
I'm still playing with it but I'm about to be interrupted for dinner.
I shall return.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Thanks Mark for looking into this. I was just trying to build on some existing code not realizing I would have so much trouble.
I've got a deadline I need to meet so I'm just going to put a tool window on the dialog and the user can close it when they are done.
Later I might come back to this or just create a CWnd that contains the sliders and don't use the DoModel().
So many ways too do something.
Thanks again
Mark
|
|
|
|
|
Oh it's modal too? I was testing modeless
There should be an easier alternative with a modeless dialog. You can use focus or activate
messages to close the dialog when the user leaves it.
Good luck!
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|