|
Umm... where did you see that?
Theres no include files on the same line.
Does anyone know how I could cast the CString to a regular string?
Or how I could put the using namespace std somewhere without receiving an error?
Thanks.
|
|
|
|
|
CString objects can be casted down to LPCTSTR strings by using an (LPCTSTR) casting operator in front of the object name. You can't cast any lower than this, so if you need a stream of char -characters, you need to create the char -string manually from the LPCTSTR by using strcpy or similar.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Hello.
I am developing an FTP client. Some FTP servers request an identity server. I am not familiar with an Identity Server protocol.
Please post any information or link. Basically I need to know the protocol from beginning to end.
- connect to FTP server
- server wait for Identity response
...
// now what?
...
...
If I am not mistaken, the FTP client needs to create a socket, bind it to the identity port set by the user, and listen for an identity request from the FTP server.
Thanks,
Kuphryn
|
|
|
|
|
This may help.....
http://www.faqs.org/rfcs/rfc2228.html
Rob.
|
|
|
|
|
|
How do i send a simple print job (using c++) of any file on my PC to a printer (among a couple others) connected to my pc?
|
|
|
|
|
Have you looked at....
http://www.codeproject.com/printing/printing_wo_docview.asp?target=print%7Cmfc
and
http://www.codeproject.com/printing/printingmadeeasy.asp?target=print%7Cmfc
|
|
|
|
|
Hello; I'm using Visual C++ 6
1)I need a way to link 225 edit boxes as one group and give each one of them an index and call them individually by their indices instead of their IDs. after that i will take their inputs to fill up a matrix 15*15.
2)the above technique i have made to make a matrix 15*15 of user defined inputs. if anyone has another elegant technique which enables me to fill a matrix 15*15 with the user inputs , i'll be glad to hear from him.
i don't want to use the excel spread sheet active X control !!
thx
Eliyah
|
|
|
|
|
Hello;
1)I need a way to link 225 edit boxes as one group and give each one of them an index and call them individually by their indices instead of their IDs. after that i will take their inputs to fill up a matrix 15*15.
2)the above technique i have made to make a matrix 15*15 of user defined inputs. if anyone has another elegant technique which enables me to fill a matrix 15*15 with the user inputs , i'll be glad to hear from him.
i don't want to use the excel spread sheet active X control !!
thx
Eliyah
|
|
|
|
|
Oriented wrote:
i don't want to use the excel spread sheet active X control !!
How about a grid control, then?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Two possible approaches:
1) Make sure the IDs are in cosecutive order then access them like so
HWND hCtrl = GetDlgItem(ID_EDIT1+nIndex), or something like that.
2) Create an array containing the IDs of the controls then access them like so HWND hCtrl = GetDlgItem(idArray[nIndex]).
These are simple methods that do not require any external controls other than the edit boxes.
INTP
|
|
|
|
|
maybe you think something like this:
for(i = 0; i < 15; i++)
{
for(j = 0; j < 15; j++)
{
nIndex = i*15 + j; // calculate matrix like arrow
M[j][i] = X(ID_EDIT1 + nIndex); // fill up matrix
}
}
rgrds
|
|
|
|
|
HELP! I am having a strange problem with Win32TimerQueue based timers on Windows2000. I am creating a periodic timer of 100ms. On a single processor machine I am seeing a fairly accurate 100ms timer. However, on a DUAL PROCESSOR machine I am getting 110ms and sometimes 150ms. Does anyone know how to resolve this on DUAL PROCESSOR machines?
<br />
#include "stdafx.h"<br />
#include "stdlib.h"<br />
#include "stdio.h"<br />
#include "memory.h"<br />
#include "windows.h"<br />
#include "time.h"<br />
<br />
typedef BOOL ( CALLBACK CreateTimerQueueTimerProc ) ( PHANDLE, HANDLE, WAITORTIMERCALLBACKFUNC, PVOID, DWORD, DWORD, ULONG );<br />
typedef BOOL ( CALLBACK DeleteTimerQueueTimerProc ) ( HANDLE, HANDLE, HANDLE );<br />
<br />
<br />
VOID CALLBACK Win32TimerQueueProc(PVOID lpParameter, BOOLEAN TimerOrWaitFired)<br />
{<br />
SYSTEMTIME myWin32SystemTime;<br />
<br />
::GetSystemTime(&myWin32SystemTime);<br />
<br />
ULONG currentMilliseconds = myWin32SystemTime.wSecond * 1000 + myWin32SystemTime.wMilliseconds;<br />
<br />
SYSTEMTIME* myLastWin32SystemTime = (SYSTEMTIME*)lpParameter;<br />
<br />
ULONG lastMilliseconds = myLastWin32SystemTime->wSecond * 1000 + myLastWin32SystemTime->wMilliseconds;<br />
::printf("%d\n", currentMilliseconds - lastMilliseconds );<br />
<br />
*myLastWin32SystemTime = myWin32SystemTime;<br />
}<br />
<br />
<br />
int main( int argc, char** argv)<br />
{<br />
HMODULE hKernel32 = ::LoadLibrary("kernel32.dll");<br />
<br />
CreateTimerQueueTimerProc* pCreateTimerQueueTimerProc = (CreateTimerQueueTimerProc*) ::GetProcAddress( hKernel32, "CreateTimerQueueTimer" );<br />
<br />
if( !pCreateTimerQueueTimerProc )<br />
{<br />
::printf( "timer code will not function - system must be W2K or later" );<br />
return 1;<br />
}<br />
<br />
DWORD timeDelta = 100;<br />
<br />
SYSTEMTIME myLastWin32SystemTime;<br />
<br />
HANDLE myTimer;<br />
(*pCreateTimerQueueTimerProc)( &myTimer, <br />
NULL, <br />
Win32TimerQueueProc, <br />
&myLastWin32SystemTime, <br />
timeDelta, <br />
timeDelta, <br />
0 );<br />
<br />
::Sleep(50000);<br />
<br />
return 0;<br />
}<br />
<br />
|
|
|
|
|
From MSDN Library: "Callback functions are queued to the thread pool. These threads are subject to scheduling delays, so the timing can vary depending on what else is happening in the application or the system."
If you need a more accurate timer, look at the multimedia timer functions such as timeSetEvent .
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Mike,
The multimedia timers do exactly the same thing on multiprocessor machines. When I ask for a 100ms MM timer I get about 110 to 150 ms depending. There is another insiduous bug with MM timers on MP machines and that is that after a while, on certain chipsets, the windows clock starts to DRIFT, about 10 seconds per minute! Horrible. I have some code that can demonstrate that one too!
Gavin
|
|
|
|
|
I assume you've already tried calling timeBeginPeriod with a suitable period of time?
I've just noticed how you're measuring the difference. The 'wall clock' time gets updated with a system timer interrupt and only has that resolution, which isn't nearly as accurate as the actual clock time. To accurately measure how long you're waiting, use QueryPerformanceCounter in combination with QueryPerformanceFrequency . You may see a difference.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Yes, the timeBeginPeriod is being set with suitable time. Both it and the TimerQueueTimer behave the same way.
IN the code I posted I'm using wall clock, but in my real application I am using both IRIG-B-AM time codes which should give me down to the several microsecond accuracy and the same time delta is exposed. So it is not a wall clock issue, etc.
Thanks,
Gavin
|
|
|
|
|
What is the point of function objects? Are these a leftover from the primitive days of STL? In case you haven't seen these they look like this:
class PrintInt {
public:
void operator() (int elem) const {
cout << elem << ' ';
}
};
My neighbours think I am crazy - but they don't know that I have a trampoline. All they see my head bobbing up and down over the fence every five seconds
|
|
|
|
|
Functors allow you to specialize standard algorithms. Imagine an algorithm that said "Perform X on the collection Y". X in this case would be the functor. Thus you can change the specifics of the algorithm without having to change the algorithm itself.
It is very powerful and can also lead to some HORRIBLE abuses. (i.e. algorithms converted to functor capable even though the resulting code is more complicated and harder to manage than the original code. Foreach "can" often fall into this category.)
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
They're useful for providing callbacks out of some generic algorithm. You can provide any object that offers a suitable operator() .
They're often used for things like the predicate in find_if .
You'd use one in preference to a regular function if you needed to preserve some state.
If you need to conjure up a suitable function object from something that doesn't quite fit, you can use mem_fun , mem_fun_ref , ptr_fun , bind1st , bind2nd , and the other members of the <functional> header.
The Boost library has a similar concept (http://www.boost.org/doc/html/function.html[^]).
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
What is this www.boost.com? Is it like CodeProject for STL?
My neighbours think I am crazy - but they don't know that I have a trampoline. All they see my head bobbing up and down over the fence every five seconds
|
|
|
|
|
From the home page:
"The Boost web site provides free peer-reviewed portable C++ source libraries. The emphasis is on libraries which work well with the C++ Standard Library. The libraries are intended to be widely useful, and are in regular use by thousands of programmers across a broad spectrum of applications.
"A further goal is to establish "existing practice" and provide reference implementations so that Boost libraries are suitable for eventual standardization. Ten Boost libraries will be included in the C++ Standards Committee's upcoming C++ Standard Library Technical Report as a step toward becoming part of a future C++ Standard."
A list of components can be found at http://www.boost.org/libs/libraries.htm[^].
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
How can I know, in a multi-threaded application, the state of certain thread? Let's say, I need to know if it's paused or running.
Greetings,
D.
|
|
|
|
|
Try setting a bool value bool isrunning;
And have it set itself to true while the thread is running then after the thread stops right before the AfxEndThread(0); set it back to false.
or you could have something like this.
1) make an edit box
2) give the edit box a member variable of type CEdit call it m_example
3) under OnInit() or whatever function is called to initialize your dialog or window that you are using put m_example.SetWindowText("NOT RUNNING");
4) then inside the run() of your thread make the first line before it does its while statement. m_example.SetWindowText("IS RUNNING");
5) after the while statement and before AfxEndThread(0); put m_example.SetWindowText("NOT RUNNING");
I hope this makes sense. There might be a better way since i'm just starting Visual myself, but anyway this should work.
Win32newb
"Making windows programs worse than they already are"
|
|
|
|
|
win32newb wrote:
4) then inside the run() of your thread make the first line before it does its while statement. m_example.SetWindowText("IS RUNNING");
You should not make calls to editbox that is owned by another thread from the new thread... it will crash.
MSN Messenger.
prakashnadar@msn.com
|
|
|
|