|
Use of GetSystemTime and the use of CString::Format .
|
|
|
|
|
|
|
<br />
CTime time;<br />
CString str;<br />
time=CTime::GetCurrentTime();<br />
str.Format("%d:%d:%d",time.GetDay(),time.GetMonth(),time.GetYear());<br />
See this, chandu004 give this to me.
I appreciate your help all the time...
Eranga
|
|
|
|
|
Hi,
Go with following code.
SYSTEMTIME t_time;
GetLocalTime(&t_time);
CString strLatesttime;
strLatesttime.Format("%.d-%.d-%.d %.d:%.d:00",t_time.wMonth,t_time.wDay,t_time.wYear,t_time.wHour,t_time.wMinute);
Rahul Vaishnav
|
|
|
|
|
hi,
you can get system current time in a string using this coding,
CTime curTime = CTime::GetCurrentTime();
int curDay = curTime.GetDay();
int curMnth = curTime.GetMonth();
int curYear = curTime.GetYear();
CString curDate = curTime.Format("%m/%d/%Y");
panthal
|
|
|
|
|
Hi all,
I want to update a SQL database on a click event as follows.
<br />
void CSRFDBDlg::OnBnClickedAdd()<br />
{<br />
UpdateData( TRUE ) ;
<br />
CString conStr ;
HRESULT hr ;<br />
_variant_t vtData ;<br />
<br />
conStr.Format ("SELECT * FROM RecordData") ;<br />
<br />
ADODB::_ConnectionPtr pConn ;<br />
ADODB::_RecordsetPtr pRecSet ;
<br />
try<br />
{<br />
if(GetADOCon (srf_SQL, pConn, pRecSet))<br />
{<br />
hr = pRecSet->Open ( _bstr_t(conStr), pConn.GetInterfacePtr(), ADODB::adOpenDynamic, ADODB::adLockOptimistic, -1);<br />
<br />
pRecSet->AddNew() ;<br />
<br />
int int_val = 345 ;<br />
vtData.vt = VT_INT;<br />
vtData.intVal = int_val ;<br />
pRecSet->PutCollect(L"Destination List", vtData) ;<br />
<br />
pRecSet->Update() ;<br />
pRecSet->Close() ;<br />
<br />
pConn->Close () ;<br />
}<br />
}<br />
<br />
catch ( _com_error &e )<br />
{<br />
PassComError ( e ) ;<br />
}<br />
}<br />
Here "Destination List" is one of the column of the table of database. Actually there are three more, but I set all of them allowed to NULL values. So need to worried about them, right? GetADOCon() also can be useful to you guys.
<br />
BOOL CSRFDBDlg::GetADOCon(CString ConStrTran, ADODB::_ConnectionPtr &pConn, ADODB::_RecordsetPtr &pRecSet)<br />
{<br />
HRESULT hr;<br />
BOOL bRet = FALSE;<br />
CString csErrMess;<br />
<br />
try <br />
{<br />
hr = pConn.CreateInstance(__uuidof(ADODB::Connection)); <br />
if (FAILED(hr))<br />
{<br />
return bRet;<br />
}<br />
<br />
hr = pRecSet.CreateInstance(__uuidof(ADODB::Recordset));<br />
if (FAILED(hr))<br />
{<br />
return bRet;<br />
}<br />
<br />
hr = pConn->Open((_bstr_t)ConStrTran, L"", L"", -1L);<br />
if (FAILED(hr))<br />
{<br />
csErrMess.Format ( "Open Database connection Failed ConnStr = %s\r\n" , ConStrTran );<br />
return bRet;<br />
}<br />
else<br />
{<br />
bRet = TRUE;<br />
csErrMess.Format ( "GetConnPtrs Successful for : %s" , ConStrTran );<br />
}<br />
}<br />
catch ( _com_error &e )<br />
{<br />
PassComError ( e );<br />
<br />
}<br />
return bRet;<br />
}<br />
I've try this now almost more than two days, the things is my code doesn't give any error, at compile time or at runtime. Can you guys tell me where I'm going wrong. Now I'm wried with this
I appreciate your help all the time...
Eranga
|
|
|
|
|
Software Engineer / Server (SES)
- bachelor (famous college prefer) or above degree in computer science, mathematics or relevant majors
- 3+ years C++ SW development experience.
- 1+ years IT system development experience (database, web, Internet)
- demonstrated experience of OOD / design pattern
- Strong learning and troubleshooting abilities, cooperative and self-motivate spirits
- Be able to communicate with foreign engineers in English.
CVs to: zhenjun.cao@elektrobit.com
Software Engineer / Client (SEC)
- bachelor (famous college prefer) or above degree in computer science or relevant majors
- 1+ years JavaScript/Java development experience.
- 1+ years IT system development experience (database, web, Internet)
- Good knowledge of regular expression.
- demonstrated experience of OOD / design pattern
- Strong learning and troubleshooting abilities, cooperative and self-motivate spirits
- Be able to communicate with foreign engineers in English.
CVs to: zhenjun.cao@elektrobit.com
|
|
|
|
|
Hi,
I want to add event on a picture using mouse click using vc++ .The picture is a button of a calculator and th ebutton should work as it is.
Hi, I am Joy .I am interested in doing software development based on .net platform(basicallly vc++,vb and asp)
|
|
|
|
|
You need a button with a picture inside it?
- NS -
|
|
|
|
|
You can use of a Derived CStatic and use of it for show image then you can declare WM_LBUTTONDOWN,WM_LBUTTONUP and other messages for it also we have a class on the MFC CBitmapButton Class .
|
|
|
|
|
I tried searching this up on Google but I couldn't find anything. Is there any way to prevent a process from showing up under the processes tab in Windows Task Manager, or is it possible to not allow the termination of a process? I've tried something like this already:
::SendMessage(hWnd,LVM_DELETEITEM,(WPARAM)23,0);
Where hWnd is the HWND of the Task Manager window, but what happens is that the list refreshes every half second (I think) and deleting a process once won't work. Deleting it multiple times within 500 milliseconds results in process #24, 25, 26, etc. being deleted. And what's worse, there is NO way I can get the location of my app's process in the listbox. I don't know if it's the 1st process displayed or the last one, or somewhere in between.
So, is there ANY way to not allow a user to terminate a process, or to make an "invisible" process?
Thanks in advance.
|
|
|
|
|
I think some times ago some people on this forum have this question and also if you search on the codeproject (I think I saw on the codeproject not sure) you can find an article that it hide process of Task Manager but you can hide your process of Task Manager but if some one use of other programs he/she can sees your process?
|
|
|
|
|
|
"He is the Devil. You've never seen anyone like Keyser Soze in all your miserable life, you idiot.
Keyser Soze. Do you at least understand that? Keyser Soze. The Devil himself.
Or are you American policemen so stupid that you haven't even heard of him?
Keyser Soze, you ridiculous man. KEYSER SOZE."
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi All,
I am using Win32 Application. In that I have created resource as Dialog and also in this Dialog I have added onr ListBox control. Now I want to insert data in to this Dialog.
In this I have added one C++ class in which I am using like below to open Dialog.....
<br />
void CCurrentWnd::Open()<br />
{<br />
DialogBoxParam(hAppInstance,MAKEINTRESOURCE(IDD_CURWND),NULL,(DLGPROC)CurrntWndDlgProc,(LONG)this);<br />
}<br />
As shown in above code my CurrentDlgProc is shown as below....
<br />
<br />
BOOL CCurrentWnd::CurrntWndDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)<br />
{<br />
CCurrentWnd * _this = (CCurrentWnd *)GetWindowLong(hwnd,GWL_USERDATA);<br />
switch(uMsg)<br />
{<br />
<br />
case WM_INITDIALOG:<br />
{<br />
HWND m_list1;<br />
<br />
m_list1 = GetDlgItem(hwnd,IDC_WNDLIST);<br />
<br />
}<br />
<br />
<br />
}<br />
}<br />
<br />
Here IDC_WNDLIST is the ID of the ListBox control.
Is there any method for ListBox control as in Tab control like TabCtrl_InsertItem().?
If you know any other alternative then plz reply me.
Thanks in Advance.
Ashish Bhatt
|
|
|
|
|
You can use of these messages LB_ADDSTRING or LB_INSERTSTRING .
|
|
|
|
|
Ya You are absolutely right. Using these messages I can add String to ListBox.
But my problem is that how to insert string in to ListBox??
Ashish Bhatt
|
|
|
|
|
Sorry,
I tried as you told and I got the solution.
If I will get some problem then I will contact you.
Thank you very much.
Ashish Bhatt
|
|
|
|
|
Hi,,
I got little much problem with same.I am using SendMessage() function to set the value for the ListBox using LB_ADDSTRING message.
But I got not perfect value as pass here in the parameter lParam of Sendmessage() function.
I am passing such like this.
<br />
char *str ="Desktop";<br />
SendMessage(m_list1,LB_ADDSTRING,NULL,(LPARAM)(str));<br />
And I got undefined value in listbox like square rectangles.
If you have any other way to pass then tell me.
Thanks.
Ashish Bhatt
|
|
|
|
|
TCHAR str[120] =_T("Desktop");
::SendMessage(GetDlgItem(IDC_LIST1)->m_hWnd,LB_ADDSTRING,0,(LPARAM)(str));
|
|
|
|
|
Hello all,
i want to make a dialog box in which i want to make a progress bar.....my problem is i want that as soon as exe is clicked dialog box should appear and progress bar should start running(without any click event). How should i do this....
Thanks in advance..
|
|
|
|
|
You can just put a progressbar in dialog through resource editor.
In the OnInitDialog set a timer and in the OnTimer you can call StepIt api of the progressbar.
- NS -
|
|
|
|
|
Hello All,
I am using one variable of type BYTE *
Now i want to allocate memory to it but at runtime.
The problem is that size will not remain fixed after intitalization, it may increase as i want to store element in it.
I had used malloc, GlobalAlloc , but it want work because it require size of memory to me initialize.
but i need when i am inserting an element to the variable then it shuld increase size by one?
Thanks in advance.
Manish Patel.
B.E. - Information Technology.
|
|
|
|
|
Can you use CArray ?
The CArray class supports arrays that are are similar to C arrays, but can dynamically shrink and grow as necessary.
Regards,
Paresh.
|
|
|
|