|
Iam getting count(data type is DWORD) in milliseconds .I have to convert into Date and Time format (dd:mm:yy hours:min:sec:milliseconds) and display it in a List view.Iam unable to get a function which serves my purpose in vc++.
|
|
|
|
|
Hi
Have a look at the COleDateTime class
Martin
|
|
|
|
|
Unless this count is the number of milliseconds that have elapsed since a certain period of time, what you are after does not exist. Otherwise, have a look at FileTimeToLocalFileTime() , FileTimeToSystemTime() , LocalFileTimeToFileTime() , et al.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hi all,
I got a problem when I use NetUserGetInfo(...), can anyone help me?
There's a Domain and a WorkGroup in LAN, a client in Domain wants to get user info from a server in WorkGroup by NetUserGetInfo(). The client loged in with Domain user ID:"MyName".
When I call NetUserGetInfo, the following cases appear:
Server also has a Local user id: "MyName", but its psw diff from Domain user "MyName":
NetUserGetInfo fail!
Server also has a Local user id: "MyName", and its psw is same with Domain user "MyName":
NetUserGetInfo success!
Server does not have Local user named "MyName":
NetUserGetInfo success!
I'm wondering that how does these take place. Will a domain user ID and a same ID in a workgroup cause any trouble?
thanks a lot.
|
|
|
|
|
I am creating a 2x2 spllitter window in a SDI application.
// OnCreateClient of SDI Frame Window
...
VERIFY(m_wndSplitter.CreateStatic(this, m_rows, m_cols));
...
I want every pane to be of the same size (plus-minus 1 pixel). In
OnSize I do something like:
// OnSize of Frame Window
...
m_wndSplitter.GetClientRect(rect);
int row_height = rect.Height();
int col_width = rect.Width();
row_height /= 2;
col_width /= 2;
m_wndSplitter.SetRowInfo(0, row_height, 100);
m_wndSplitter.SetRowInfo(1, row_height, 100);
m_wndSplitter.SetColumnInfo(0, col_width, 100);
m_wndSplitter.SetColumnInfo(1, col_width, 100);
m_wndSplitter.RecalcLayout();
...
HOWEVER probably due to the "splitting margin" or border
between panes, the pane(0, 0) is larger than the other panes
with a difference of about 11 pixels in size. Other than
"manually" accounting for the border thickness, is there
a better way of making the panes same size.
Thanks in anticipation.
|
|
|
|
|
There is no way for a frame to get its splitters internal dimensions.
But you could write a new class inheriting from CSplitterWnd, and
use that instead...
Be warned, this not debugged (or even compiled code), so check it out
yourself. If omitted *loads* of error checks.
class CSymetricalSplitter : public CSplitterWnd
{
public:
BOOL ArrangeSymmetrically (int nMinX, int nMinY)
{
CRect rcClient;
GetClientRect (&rcClient);
int nCols, nRows, nSize, n;
nCols = GetColumnCount ();
nRows = GetRowCount ();
if (!nRows || !nCount)
return FALSE;
nSize = rcClient.Height ();
nSize -= (nRows - 1) * m_cySplitterGap;
nSize /= nRows;
for (n = 0; n < nRows; n++)
SetRowInfo (n, nSize, nMinY);
....
RecalcLayout ();
}
};
Hopefully that should help!
Iain.
|
|
|
|
|
Thanks. This is probably the only way out. Here is a fragment from
Q & A: C++ (Periodicals 1998) from MSDN Library 1999 that does something
similar:
After calculating the heights of the toolbars, the next troublesome task is calculating the height and width of all the splitter window components: the border with which it surrounds each pane and the splitter bar itself. All these magic numbers are contained within data members in CSplitterWnd, but naturally the data is protected, which means you can’t access it! Sigh. So what do you do? Simple: just derive a new class with public functions to export the protected data, and use it instead of CSplitterWnd in your main frame.
class CMySplitterWnd : public CSplitterWnd {
public:
CSize GetBorderSize()
{ return CSize(m_cxBorder,m_cyBorder); }
CSize GetSplitterSize()
{ return CSize(m_cxSplitter,m_cySplitter); }
};
|
|
|
|
|
(To be complete) this is what can be done:
CRect rect;
m_wndSplitter.GetClientRect(rect);
CSize splitter_size = m_wndSplitter.GetSplitterSize();
CSize border_size = m_wndSplitter.GetBorderSize();
int row_height = rect.Height() - ((splitter_size.cy * (m_rows - 1)) + (border_size.cy * 2));
int col_width = rect.Width() - ((splitter_size.cx * (m_cols - 1)) + (border_size.cx * 2));
row_height /= m_rows;
col_width /= m_cols;
for (int i = 0; i < m_rows; i++) {
m_wndSplitter.SetRowInfo(i, row_height, 100);
}
for (int j = 0; j < m_cols; j++) {
m_wndSplitter.SetColumnInfo(j, col_width, 100);
}
m_wndSplitter.RecalcLayout();
Regards
Mahendra
|
|
|
|
|
I have added a new ATL class in the project but now I want to remove this class from the project. How can I remove the class because If I remove the class manually then i need to remove other settings of the class also as it is an ATL class so it must be having enteries in the coclasses of the project.
Thanks in advance for ur help
Rits
|
|
|
|
|
Hm, not so easy work.
1st - remove the class .h and .cpp files (and delete/rename on HDD)
Then you'll have probably corresponding .rgs file in the project tree.
Then you need to remove corresponding parts in the projects .idl file - these should be probably the interface declaration IYourClass somewhere on the beginning of the .idl file. Then remove the coclass definition from .idl (should be somewhere at the end of the file).
Then last thing should be the OBJECT_ENTRY macro in the yourProject.cpp file.
Then rebuild the project and compiler will remind you about missed includes or macros.
|
|
|
|
|
Yes, u r right
I had to remove entries from the idl file also.
Thanks
Rits
|
|
|
|
|
Hi,
I'm not sure but i think that removing "class.h" and "class.cpp" files from the project will do the job.
Regards,
Eli
|
|
|
|
|
Hello,
How can I find out what program is running my program
by OpenWith... Dialog?
For example a user right-clicks on a file and chooses OpenWith...
and then my program.What is the address?How can my program knows
the address?
Please help me on this...
Thanks.
|
|
|
|
|
I'm not exactly sure what you are asking, but does AssocQueryString() or FindExecutable() help?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hi All,
I' m writing a Visual C++ MFC dialog-based program. I added a Menu bar uisng Insert->Resource-> Menu, not by writing code. Then, I tried to show and hide the Menu bar of a modal dialog dynamically but didn't succeed? Could anyone kindly help me?
Cheers,
hmc
|
|
|
|
|
I don't know any direct command that show/hide menu but the following will work too.
For removing menu bar at run time use following code
CWnd* pMain = AfxGetMainWnd();
if (pMain != NULL)
{
CMenu* pMenu = pMain->GetMenu();
while(pMenu != NULL && pMenu->GetMenuItemCount() > 0)
{
pMenu->DeleteMenu(0, MF_BYPOSITION);
pMain->DrawMenuBar();
}
}
For adding menu items again, use
AppendMenu
|
|
|
|
|
Hi Freind,
Thanks. But I only successfully hide the Menu, but not showing it again. Do I just need to replace "pMenu->DeleteMenu(0, MF_BYPOSITION);" to
"pMenu->AppendMenu(0, MF_BYPOSITION);" without changing other code?
Cheers
|
|
|
|
|
Can anyone help me find three different C++ statements for a source code that will print out the ASCII value of a character and only the ASCII value?
Thank you
|
|
|
|
|
#1
for(int i=65;<120;i++)
printf("\nASCII of %c is %d",i,i);
#2#3
I forget
"I Think this Will Help"
<h5
alok gupta="" <br=""> visit me at http://www.thisisalok.tk
|
|
|
|
|
There are 256 values in the ASCII table. If you are only wanting to print out the ASCII value, then you simply need to print out the numbers 0 through 255.
for (int x = 0; x < 256; x++)
cout << x << endl; It would be a little more useful if you printed out the ASCII character and its value:
for (int x = 0; x < 256; x++)
cout << (char) x << " = " << x << endl;
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Another option:
#include <iostream><br />
<br />
using std::cout;<br />
using std::endl;<br />
<br />
int main() {<br />
<br />
char character = 'A';<br />
cout << character << " " << (int) character << endl;<br />
<br />
return 0;<br />
}
|
|
|
|
|
I need help to make a simple application using Embedded Visual c++ 3.0
It's just a simple application that enables me to read and write files.
Write a file - save it - then retrieve it within the application.
Can anyone help to give me the codes needed for me to make the application work?? Thanks.
|
|
|
|
|
Using Win32 or MFC?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Using MFC. I need to do a simple Open/Save Dialog application. I'm a beginner and i ain't sure how to link the menu to the dialog.
Help please! Thanks.
|
|
|
|
|
CT Menot wrote:
Using MFC.
Ok, then you should check out the CFile and CStdioFile classes. They allow you to read from and write to a file.
CT Menot wrote:
I need to do a simple Open/Save Dialog application.
See if the CFileDialog class is what you are after.
CT Menot wrote:
...i ain't sure how to link the menu to the dialog.
What menu? While they can co-exist, menus and dialogs are not necessarily related.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|