|
|
what if i want to do datetime comparison?
as what i am required to do is to let the user input his/her birthday and output how old he/she is currently.
so i am confuse as in what kinda datetime type i should use and variable.
most tutorial i seen so far only shows how to view the current datetime
|
|
|
|
|
neodeaths wrote: what if i want to do datetime comparison?
You can either compare the individual members of the tm structure, or look at difftime() . If you are using MFC, check out CTimeSpan and COleDateTimeSpan .
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi,
In one of my coding,i found the coding for bitmap button in the dialog.
it shows as
//mainfrm.h
public:
CMainFrame();
CSysWindow m_SysWnd;
CBitmapButton bmSCopy;
//mainfrm.cpp
m_SysWnd.SetBarStyle( m_SysWnd.GetBarStyle()| CBRS_ALIGN_TOP|CBRS_BORDER_TOP | CBRS_FLOAT_MULTI );
bmSCopy.AutoLoad(ID_SCOPY,((CWnd* ) ((CDialogBar *)((CSysWindow*)&m_SysWnd)) ) );
I dont know here where the bitmap image is get loaded in the button.
ID_SCOPY is the ID for button.
CSyswindow is CDialogBar class.
ANd it perfectly working.After executing, the button has the bitmap image what i made the image for that particular button.
I dnt know how its get loading.Pls clear me.
Anu
|
|
|
|
|
For load bitmaps on the a control of CBitmapButton it uses of LoadBitmaps.
|
|
|
|
|
In that coding, i didnot find Loadbitmaps function anywhere.
Anu
|
|
|
|
|
For the button caption “MYIMAGE,” for example, the IDs would be “MYIMAGEU,” “MYIMAGED,” “MYIMAGEF,” and “MYIMAGEX.” You must specify the ID of your bitmaps within double quotes.
|
|
|
|
|
Yes, I found that. Thank u so much
Anu
|
|
|
|
|
|
Anu_Bala wrote: Pls clear me.
See here.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi All,
I want to press a button in another application. I got that window handle using FindWindow(). I don't know how to post a message for press a button in that application. If u know please help me.
Thanks
Sethuraman.k
Sethuraman.K
|
|
|
|
|
See shortes code for notepad if helpfuls
CWnd *pwnd=FindWindowW(_T("NotePad"),NULL);
HMENU h=::GetMenu(pwnd->m_hWnd);
HMENU h2=GetSubMenu(h,0);
::SendMessage(pwnd->m_hWnd,WM_COMMAND,(WPARAM)3,(LPARAM)h2);
|
|
|
|
|
Thanks for ur reply.
My reqest is not selecting a submenu. I want press a button control in another apllication Dialog
Sethuraman.K
|
|
|
|
|
Yeah I understood it was for example.
if you have handle to that program you can use of this code for get handle to other controls on that forum and then send your message to a control.
for(CWnd* pWnd = needsto handle; pWnd;pWnd = pWnd ->GetNextWindow())
{
pWnd ->GetWindowTextW(str);
}
|
|
|
|
|
you must get the control id first. to get control id, you can use FindWindow and GetDlgCtrlID()...
then:
HWND hWnd = FindWindow(....);
::SendMessage( hWnd, WM_COMMAND, nButtonID, 0 );
|
|
|
|
|
Send WM_COMMAND message to the parent of the button, and set the WPARAM and LPARAM as follows
wparam = MAKEWPARAM( <id of="" the="" button="">, BN_CLICKED );
lParam = (LPARAM)<handle of="" the="" button="">;
|
|
|
|
|
Hi all,
There is a api which is used to find files inside the folder/Directory. Can anybody please tell me that api name.
Thanks in advance
|
|
|
|
|
Use CFile .
Make object of CFile and using that object open a file with file name. If File exist than it returns nonzero otherwise it will return zero.
Regards,
Manish Patel
|
|
|
|
|
You can use CFileFind(MFC) or WIN32_FIND_DATA(WIN32).
Amar
|
|
|
|
|
FindFirstFile .
Regards,
Paresh.
|
|
|
|
|
|
if u want to find exact file in a folder,
CFileFind finder;
finder.FindFile(_T("c:\\test.txt"));
if u want to find all file in a folder,
CFileFind finder;
BOOL bWorking=1;
while(bWorking)
{
bWorking=finder.FindNextFile();
TRACE("\n%s",(LPCTSTR)finder.GetFileName());
}
Sethuraman.K
|
|
|
|
|
Hello All,
I am developing Client server based Application.
for accepting multiple clients i am using CreateThread method.
Now problem is that if it accept connection from one client and doing nothing then also it requires some memory. But when client disconnects it is not freeing up that memory so as a result if multiple client connects multiple times then application will go in large memory usage and it is not reliable.
Anybody tell me what can i do so that i can free that memory.
Thanks in advance
Manish Patel
|
|
|
|
|
This isn't a problem we can solve for you. It seems obvious that you're not shutting down your thread and it's related data when the connection is terminated.
What are you doing when the connection is terminated?
But, I'll add another comment unrelated to your question. People often think that creating a thread for each connection is a good thing. It's OK if you want to handle a few connections... But if you want actual performance, you should find a way of aggregating your many connections to a small pool of threads....
The best performance for this -- is something called I/O completion. It's a method which let's you treat network communications as events. It's not simple, but it will maximize your performance in a server. You can handle a few hundred connections with just a few threads....
Though, one more thought. Servers based on windows suck....
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.soonr.com">SoonR Inc -- PC Power delivered to your phone</A>
|
|
|
|
|
How can i create hundred connections with few thread?
Provide any example. I dont know how to create it.
Manish Patel
|
|
|
|