|
I've choosen to store multidimensional indeces of all possible combinations
see my topic hackers delight, ....
9ine
|
|
|
|
|
Hi,
Is there any way to Increase the Height of the status Bar?
|
|
|
|
|
|
RockyJames wrote: Is there any way to Increase the Height of the status Bar?
you have to subclass the statusbar and implement Subclassed statusbar there
|
|
|
|
|
Hi everyone,
I have a doubt regarding setting and getting of menus. I change the menu of my frame using:
pMainFrame->MDISetMenu(ptrToAValidMenuTobeLoaded);(pMainFrame = this is the pointer to my Valid Frame)
But when i say :
CMenu* pSetMenu = AfxGetMainWnd()->GetMenu();(GetMenu function of CWnd class)
iam not getting the menu.(pSetMenu is NULL)
Does MDISetMenu of MDIFrameWnd Class and SetMenu of CWnd class, sets menus at different places?
How can i Get my menu attached with my Main window.(is there any other method of doing the same)
Note:
After my application loads iam able to see that the menu is set properly and iam able to see it also.
Thanks a lot for replies and/or reading the same,
thnx
KAB
|
|
|
|
|
I am trying to use the WaitCommEvent function to listen for a signal coming through pin 6 on an RS232. Before i listen i want to send two signals out on different pins. I can already send the signals succesfully, however, does anyone have an example of using WaitCommEvent to listen for a signal that i can view ?
|
|
|
|
|
|
That site is great.. Thanks for that. However here is my delimma
On the 9 pin rs232, i am suing 5 pins to set and monitor.
Pins 2 and 3 are in use continuosly (Recieve and Transmit data)
Pins 4 and 7 (DTR and RTS) are used on occasion and are set high , then set low afterwards.
Pin 6 (DSR) , i need to monitor the input after i set Pin 4 and 7(DTR and DTS)
Can i monitor Pin 6 without using WaitCommEvent?
If so, how will i syncronize all this with just one handle to the COM port?
|
|
|
|
|
Taken from the MSDN :
#include <windows.h>
#include <assert.h>
#include <stdio.h>
void main( )
{
HANDLE hCom;
OVERLAPPED o;
BOOL fSuccess;
DWORD dwEvtMask;
hCom = CreateFile( "COM1",
GENERIC_READ | GENERIC_WRITE,
0,
NULL,
OPEN_EXISTING,
FILE_FLAG_OVERLAPPED,
NULL
);
if (hCom == INVALID_HANDLE_VALUE)
{
printf("CreateFile failed with error %d.\n", GetLastError());
return;
}
fSuccess = SetCommMask(hCom, EV_CTS | EV_DSR);
if (!fSuccess)
{
printf("SetCommMask failed with error %d.\n", GetLastError());
return;
}
o.hEvent = CreateEvent(
NULL,
FALSE,
FALSE,
NULL
);
o.Internal = 0;
o.InternalHigh = 0;
o.Offset = 0;
o.OffsetHigh = 0;
assert(o.hEvent);
if (WaitCommEvent(hCom, &dwEvtMask, &o))
{
if (dwEvtMask & EV_DSR)
{
}
if (dwEvtMask & EV_CTS)
{
}
}
else
{
DWORD dwRet = GetLastError();
if( ERROR_IO_PENDING == dwRet)
{
printf("I/O is pending...\n");
}
else
printf("Wait failed with error %d.\n", GetLastError());
}
}
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Is there any utility which tells C,C++ prgrams performace...? in terms of CPU utilization like..
|
|
|
|
|
what do you want to know exactly ??
|
|
|
|
|
I have code like
int array[10]={10 elements}
int *ptr=array;
int value=0;
here are 2 code fragments
1) for(int i=0;i<10;i++)
value=*(ptr+i);
2) for(int i=0;i<10;i++)
value=*ptr++;
I want to check performance of (1) against (2)
|
|
|
|
|
CString sError="QueryPerformanceCounter() failed for unknown reason";
BOOL bResult=FALSE;
CString sResult="";
LARGE_INTEGER largeStart;
LARGE_INTEGER largeEnd;
LARGE_INTEGER largeFrequency;
_int64 qwordResult=0;
_int64 qwordFrequency=0;
SetThreadAffinityMask(GetCurrentThread(),1); // Prevent multiple CPU's from messing the benchmark up
QueryPerformanceFrequency(&largeFrequency);
bResult=QueryPerformanceCounter(&largeStart); // Get initial counter. Start the test
if (bResult) {
PerformTask(); // Run the test
bResult=QueryPerformanceCounter(&largeEnd); // Get the final counter. End the test
qwordResult=(largeEnd.QuadPart-largeStart.QuadPart); // The elapsed time for the test in counter ticks
qwordFrequency=largeFrequency.QuadPart; // How many times per second the counter ticks
sResult.Format("Ticks = %I64d\nTicks per second = %I64d",qwordResult,qwordFrequency);
if (bResult)
AfxMessageBox(sResult);
else
AfxMessageBox(sError);
} else
AfxMessageBox(sError);
|
|
|
|
|
you already asked this some days ago, and the answer have been saying that 1) was a little bit faster (less assembler instructions) than 2).
why do you re ask it ??
-- modified at 9:15 Tuesday 4th April, 2006
|
|
|
|
|
I used one software for performance measurement.
It says exactly oppsite of what we concluded last time.
|
|
|
|
|
2 questions :
1) how does that tool measure the perf ? (consider spoting the accuracy)
2) why do you need that much precision ? can't you refer to the assembler code generated by the compiler ? 
|
|
|
|
|
for small values (10) there will not be a significative difference.
Try with 1000000 or more iterations; maybe at this size you will be able to use a simple chronometer.
or try this simple class CProfiler[^] which works well to profile simple functions.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
HI,
The link u have mentioned is really helpful..Sooner I will publish the results...Thanx a lot for valuable input !
Vikrams
|
|
|
|
|
yes, it's called a Profiler.
it used to be bundled with Visual Studio 6. in newer version ( VS2003 and VS 2005 ( i think ) ) it's not there, you have to go to a 3rd party ( devparter profiler ).
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
|
what was wrong with THIS[^] ? 
|
|
|
|
|
hi
i have a vc++6 MFC app. in my main i start a thread that connects to the wmi of a host, it uses
IWbemLocator *pLoc
IWbemServices *pSvc
back in the main, once the thread has finished connecting to the wmi of the host, it is queryied but the two global variables above are "empty", this is because you cannot use COM interfaces on multiple threads and each thread must initialize COM itself and onyl use local COM objects afaik.
so i think marshalling will have to be used but i dont know where to start on how to implement it
please help
|
|
|
|
|
Whenever you cross apartment boundaries you have to marshal the interface.
An apartment is, in simple words, a thread that has made a successful call to ::CoInitialize() or similar. Each thread that will use COM in any way have to initialize COM by calling ::CoInitialize(), which tells the COM subsystem that this-apartment-is-a-single-threaded-apartment (STA). If you want your thread to be added the the multithreaded apartment of the process (MTA), because there can be only one, you have to call ::CoInitializeEx() with COINIT_MULTITRHEADED.
The easiest way to marshal an interface is to use ::CoMarshalInterThreadInterfaceInStream()[^] and ::CoGetInterfaceAndReleaseStream.
Hope this helps
--
Roger
It's supposed to be hard, otherwise anybody could do it!
|
|
|
|
|
so will i get away with using CoInitializeEx() with COINIT_MULTITRHEADED and not having to use marshalling?
|
|
|
|
|
no!
the CoInitializeEx() with COINIT_MULTITRHEADED tells what type of apartment do you wishes to use in yourcase MTA.
unfortunately, you will have to do marshaling yourself,use the 2 methods suggested above
hope it helps
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|