|
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
|
|
|
|
|
Well, ok, what if I have numerous threads? Let's say at least four? How to know if thread is paused or running? Any interesting approaches?
|
|
|
|
|
How about OpenThread and GetThreadContext.
Not sure what is in a CONTEXT, but I would suspect if it was the same from one call to the next, that the thread was suspended.
|
|
|
|
|
Howdy,
I am writing a client side MFC application. I would like to be able to display a scrolling window that renders simple html. The main tags I need are <font>, <center>, <strong> and maybe <img>.
I don't want to use the MS Internet explorer control. That's like using a locomotive to push a shopping cart. My client doesn't want the dependancies and security issues that come with IE. I don't blame him a bit.
I know I have seen light weight html rendering controls for simple html text rendering, but I can't remember where I saw them.
Anyone have any suggestions?
TIA
Jim H
|
|
|
|
|
Since IE is already available on the machine, why not use it? While other renderers probably exist, can you guarantee that they have been thoroughly tested and are fully HTML compliant? Have you considerd CHtmlView ? It's based on the IE server, but it plugs into an application almost seamlessly.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
I've deployed commerical apps that use CHtmlView. It can work, but it's a hellish nightmare to test all the possible permutations and combinations of operating systems and versions of IE. My client also has legitimate security concerns about using IE.
If you need the full power of IE then using the MS browser object is fine.
I don't need anything like the power of IE. I just need to be able to nicely render some text. IE is massive overkill for this task.
|
|
|
|
|
HTMEngine at http://www.terrainformatica.com/htmengine/
QHTM at http://www.gipsysoft.com/qhtm/
--
Joel Lucsy
|
|
|
|
|
Well it's not exactly an HTML rendering engine, but the following control has support for a bunch of tags. I haven't looked at the source that I can remember, but you may be able to rip out it's core and use it for your own purposes.
http://www.codeproject.com/miscctrl/pptooltip.asp[^]
Chris Richardson
|
|
|
|
|
Hey,
here's a good newbie question for everyone:
I'm currently using a 2d graph DLL that i got from codeproject:
CXGraph
And am running it on a split pane with a control panel the right. when the user clicks on the graph, i want to pull the value for that point on the graph out of the graph dll and access it in my project, but the click message seems to get caught in the graph function.
is there any way i can catch the mouseclick action in the main app?
Many Thanks,
Mike
"Facts are meaningless. You could use facts to prove anything that's even remotely true." --Homer J.
|
|
|
|