|
Software_Specialist wrote: No it was working ...So i guess its right
So what of your "And error i got is none of the 2 overloads could convert all the arguments type." comment? That does not sound like it is working, or right, to me.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
oh by that i meant to say it was working like this...
<br />
<br />
CString strFilter;<br />
const TCHAR *strSource= _T("All Files (*.*)|*.*||");<br />
_tcscpy_s(strFilter, strSource);<br />
<br />
<br />
So Parameter isn't a problem in that...
|
|
|
|
|
Software_Specialist wrote: CString strFilter;
const TCHAR *strSource= _T("All Files (*.*)|*.*||");
_tcscpy_s(strFilter, strSource);
How is this not generating a compiler error? I would have expected it to be:
_tcscpy_s(strFilter.GetBuffer(128), strSource); In any case, why would you want to use _tcscpy_s() with a CString object? That makes no sense.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Sorry... my brain is nt workin enough nw....need lil break..
actually it was
TCHAR strFilter[1000];
const TCHAR *strSource=_T("All Files(*.*)|*.*||");
_tcscpy_s(strFilter, strSource);
And this was definately working....i tested it aswell
Rest ill find out after i finish writing these functions ....hoping for the best...
|
|
|
|
|
Software_Specialist wrote: TCHAR strFilter[1000];
const TCHAR *strSource=_T("All Files(*.*)|*.*||");
_tcscpy_s(strFilter, strSource);
So why introduce an unnecessary variable (i.e., strSource ) when
TCHAR strFilter[1000];
_tcscpy_s(strFilter, _T("All Files(*.*)|*.*||")); would have sufficed? Since you are using MFC, why bother with wchar_t variables at all?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
may be u are right...But i tried that way but it was not working ..yeh i didnt included _T at that time...So ill check out if it works without const TCHAR variable...
Thanks for pointing me out...
|
|
|
|
|
i guess i got some cause due to which its giving me these error...ill make those changes n will see if it works or not...
i would post wtever i get in a bit...
|
|
|
|
|
Hi,
These errors or not due to TCHAR or wifstream. Have you included the file with the definition for hide_in_text::hide_file, secret_file_class::get_secret_file, ...
I think the definition for these are missing.
Best Regards
Raj
|
|
|
|
|
Yeh you are right...thats what i am doing now.. declaration was missing...by mistake it got deleted...
I am rewriting those 2 functions now.....ill update whatever i get by the end...
Thanks a lot for all your help...
|
|
|
|
|
Hello all,
I have used AddTimer() function in my application like this
AddTimer(test_interval);
<\pre>
i want to show count down in my application. for example if i have set time as 1 min then it should show 60,59.58.......
how to do this? Because i have seen while debugging the application no where remaining time is shown ....
Can anybody help me in this
thanks in advance
|
|
|
|
|
do you wrote this function ? is your application console or windows ?
|
|
|
|
|
i have made a windows application. yes the code is written by me but
AddTimer() is API given...
|
|
|
|
|
Sorry for the questions, I have searched in MSDN and cannot find this AddTimer API so I don't know what it does. BTW as you are using windows you can use SetTimer API and handle the WM_TIMER message. you can set a one second time interval and decrement a member variable ex:
<br />
m_nCountDown = 60;<br />
SetTimer(hwnd, 1, 1000, (TIMERPROC) NULL);<br />
case WM_TIMER: <br />
TRACE("%d\n", --m_nCountDown);<br />
if(m_nCountDown == 0) KillTimer(hwnd, 1); <br />
|
|
|
|
|
yes i m sorry i have used SetTimer function only.....Can you please elaborate this example of yours because i am not getting exactly how to implement this. If there is any source code then it'll be of great help....
|
|
|
|
|
neha.agarwal27 wrote: If there is any source code then it'll be of great help....
It's more than plentiful. Google for it, or search here at CP.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
take a look:
<br />
#include <stdio.h><br />
#include <windows.h> <br />
#pragma comment(lib, "user32.lib")<br />
<br />
HINSTANCE hInst; <br />
TCHAR szTitle[] = "timer sample"; <br />
TCHAR szWindowClass[] = "timersampleapp"; <br />
int nCountDown = 0;<br />
<br />
<br />
BOOL InitInstance(HINSTANCE, int); <br />
void ErrorExit(LPTSTR lpszFunction); <br />
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); <br />
<br />
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) <br />
{ <br />
UNREFERENCED_PARAMETER(hPrevInstance); <br />
UNREFERENCED_PARAMETER(lpCmdLine); <br />
<br />
MSG msg; <br />
WNDCLASSEX wcex; <br />
<br />
wcex.cbSize = sizeof(WNDCLASSEX); <br />
wcex.style = CS_HREDRAW | CS_VREDRAW; <br />
wcex.lpfnWndProc = WndProc; <br />
wcex.cbClsExtra = 0; <br />
wcex.cbWndExtra = 0; <br />
wcex.hInstance = hInstance; <br />
wcex.hIcon = LoadIcon(NULL, IDI_APPLICATION); <br />
wcex.hCursor = LoadCursor(NULL, IDC_ARROW); <br />
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); <br />
wcex.lpszMenuName = NULL; <br />
wcex.lpszClassName = szWindowClass; <br />
wcex.hIconSm = (HICON)LoadImage(hInstance, MAKEINTRESOURCE(5), IMAGE_ICON, <br />
GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR); <br />
<br />
if (RegisterClassEx(&wcex) == 0) <br />
{ <br />
ErrorExit("RegisterClassEx"); <br />
return FALSE; <br />
} <br />
<br />
<br />
if (!InitInstance (hInstance, nCmdShow)) <br />
{ <br />
ErrorExit("InitInstance"); <br />
return FALSE; <br />
} <br />
<br />
while (GetMessage(&msg, NULL, 0, 0)) <br />
{ <br />
TranslateMessage(&msg); <br />
DispatchMessage(&msg); <br />
} <br />
<br />
return (int) msg.wParam; <br />
} <br />
<br />
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) <br />
{ <br />
HWND hWnd; <br />
hInst = hInstance; <br />
<br />
hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, <br />
CW_USEDEFAULT, 0, 640, 480, NULL, NULL, hInstance, NULL); <br />
<br />
if (!hWnd) <br />
{ <br />
return FALSE; <br />
} <br />
<br />
nCountDown = 60;<br />
SetTimer(hWnd, 1, 1000, (TIMERPROC) NULL);<br />
<br />
ShowWindow(hWnd, nCmdShow); <br />
UpdateWindow(hWnd); <br />
<br />
return TRUE; <br />
} <br />
<br />
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) <br />
{ <br />
PAINTSTRUCT ps; <br />
HDC hdc; <br />
<br />
switch (message) <br />
{ <br />
case WM_TIMER:<br />
<br />
--nCountDown;<br />
if(nCountDown == 0) <br />
KillTimer(hWnd, 1);<br />
else<br />
{<br />
TCHAR msg[20] = {0};<br />
sprintf(msg, "%d", nCountDown);<br />
SetWindowText(hWnd, msg);<br />
}<br />
<br />
break;<br />
case WM_PAINT: <br />
hdc = BeginPaint(hWnd, &ps); <br />
EndPaint(hWnd, &ps); <br />
break; <br />
case WM_DESTROY: <br />
PostQuitMessage(0); <br />
break; <br />
default: <br />
return DefWindowProc(hWnd, message, wParam, lParam); <br />
} <br />
return 0; <br />
} <br />
<br />
void ErrorExit(LPTSTR lpszFunction) <br />
{ <br />
TCHAR szBuf[80]; <br />
LPVOID lpMsgBuf; <br />
DWORD dw = GetLastError(); <br />
<br />
FormatMessage( <br />
FORMAT_MESSAGE_ALLOCATE_BUFFER | <br />
FORMAT_MESSAGE_FROM_SYSTEM, <br />
NULL, <br />
dw, <br />
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), <br />
(LPTSTR) &lpMsgBuf, <br />
0, NULL ); <br />
<br />
wsprintf(szBuf, <br />
"%s failed with error %d: %s", <br />
lpszFunction, dw, lpMsgBuf); <br />
<br />
MessageBox(NULL, szBuf, "Error", MB_OK); <br />
LocalFree(lpMsgBuf); <br />
} <br />
|
|
|
|
|
This is not the recommended way of doing a countdown using timers. The correct approach is to use the current time to do the countdown.
For instance when the countdown should start the current time is: 04:00:00.
If you want a 1 minute countdown you set the End time to 04:01:00.
Then you set up a timer with the interval set to 1000ms. In the WM_TIMER handler you get the current time and calculates the time remaining.
The reason that it is wrong to decrement by 1 sec each time the WM_TIMER handler get called is that there is no guarantee that the handler will be handled after 1sec. Only guarantee is that it will not happen before 1 sec. Might not be that big deal in this case, but it is good habbit to do it correct way!
|
|
|
|
|
i have two modes in my application - ONLINE, OFFLINE
WHen i run my program in DEBUG MODE and change my application from ONLINE to OFFLINE mode i get an error-
" THE EXCEPTION BREAKPOINT"
ABreak point has been reached.
(0x80000003) occured in the application at location 0x7c901230
But when running in RELEASE MODE , its running fine..
why is it so
Proud To Be an Indian
|
|
|
|
|
vivekphlp wrote: ABreak point has been reached.
And what does call stack tell you ?
Prasad
MS MVP - VC++
|
|
|
|
|
What happens when you set a breakpoint in the routine that handles the changing from ONLINE to OFFLINE, and single-step from that point?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
THe stack says - NTDLL! 7c901230() here the error comes
When i put breakpoint it comes to a function call and then a error msg pops out User Exception at xxxxxxx.
Proud To Be an Indian
|
|
|
|
|
vivekphlp wrote: When i put breakpoint it comes to a function call and then a error msg pops out User Exception at xxxxxxx.
So are you going to tell us what that function call is?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
its a user defined function ....
Proud To Be an Indian
|
|
|
|
|
hi,everyone
I'm failed to install vc6.0
an error occured while I'm installing vc6.0:
error messagebox title: error while configuring ODBC drivers
error information: odbc's sqlInstallDriverManager failed.
who help me?
|
|
|
|
|
If you do not need that specific driver, just opt to not install it.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|