|
Apparently none of that worked out. I know there's a simple solution to this, I just don't know what it is.
Would it be possible to create a CRect object over the picture box and have that respond to the mouse instead of the picture control itself?
Please help... I hate getting hung up on simple stuff like this.
|
|
|
|
|
given a tcp connection and it's remote ip and port address, how do i disconnect a particular tcp connection?
i am trying to build a very simple connection manager/monitor that periodically grabs the tcp connection table (using AllocateAndGetTcpExTableFromStack) and compares it to a loaded list of "unwanted" ip's or hostnames. i've got it able to display the tcp connections (very similar to what netstat does), but not sure how to proceed with disconnecting the ones i don't want. can anyone help me with what function(s) i use to do this?
|
|
|
|
|
Good afternoon.
I have a DLL with a simple function that receives an array of double, the array is used as input/output, part of it I must fill, the rest ( the result ) is filled by the DLL.
the function looks like :
typedef int (__stdcall * CommandProc)(
long, double*, long, long );
I do the following.
m_Data = (double*) calloc( m_Rows * m_Columns, sizeof( double );
int iRes = ProcAdd( 1, m_Data, m_Rows, m_Columns );
The DLL is loaded properly, and the function is called without crashing.
I'm not sure if I'm calling the function with the "right kind" of values ( mostly the double* ; the simplistic documentation that I have tells me its a double* ; so that's what I pass.
I tried doing a simple DLL function with similar parameters to see if I screwed my call :
extern "C" _declspec(dllexport) int toto(
long ID,
double* data,
long rows,
long columns )
{
for ( int i = 0 ; i < rows*colums; i++ )
{
data[i] = 2;
}
return 1;
}
but that seems to work.
any ideas ?
I'm about to contact the DLL vendor to ask them for a working C example of their DLL.
Thanks.
Max.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
So what is ProcAdd() supposed to do with the second parameter?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I want my program to read the data that is coming from a Serail Port, and sort out the Data. Store 50 values in an array that I can edit. The Data comes in to the function as lpszData or szData. The Serial Program works fine, as it's been coded by a profesinal, but this function doesn't do what it's suppose to do.
Here's the code:
<br />
void CChildView::SortData(LPCTSTR pszData)<br />
{<br />
static int nPass=0;<br />
static TCHAR buffer[51];<br />
<br />
buffer[(nPass++)] = pszData[0];<br />
<br />
if (buffer[nPass] != '\n')<br />
{<br />
if (nPass >= 50)<br />
{<br />
buffer[50] = '\n';<br />
DisplayData(buffer);<br />
nPass=0;<br />
}<br />
}<br />
}
I have tried different ways of sending the data, but for some reason the program doesn't recognise that I only want to display without new lines.
Please help me out, I have been stuck on this for a whole last week.
Is it possible just store the data in a simple array, eg Data[10], and then Data[5] = "h"; Data[6] = '\n'; or something simular.
DisplayData will only accept buffer, and will not accept buffer[0] for example. Why? And why do I always get errors refering to converstions. eg. no conversion from char* to int.
Thanks in advance!
|
|
|
|
|
tomek18 wrote:
buffer[(nPass++)] = pszData[0];
if (buffer[nPass] != '\n')
Just a guess but shouldn't this be:
buffer[(nPass)] = pszData[0];
if (buffer[nPass++] != '\n')
tomek18 wrote:
Is it possible just store the data in a simple array, eg Data[10], and then Data[5] = "h"; Data[6] = '\n'; or something simular.
Isn't that what you are already doing?
tomek18 wrote:
DisplayData will only accept buffer, and will not accept buffer[0] for example. Why?
Because that's the way it was coded.
tomek18 wrote:
And why do I always get errors refering to converstions. eg. no conversion from char* to int.
Which lines are in error?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
The whole program works something like this. It's only my assumption, as I'm not an expert, and didn't program this code.
A character or a line of characters is recieved by the program, and passed as lpszData, UniCode (I think) or szData (don't know what format, ASCII?). To other functions.
So everytime a character is recieved, the character is passed to SortData, and that's where I am stuck.
You have seen how I'm trying to filter it out, and get rid of the new lines. But the if statement doesn't recognise \n or \r or even hex or oct or "x"!!! The only thing it recognises is if I write if (nPass == 50), which means recieved characters. But that doesn't even work correctly, I think it's got to do with the timing of the communication via serial, as it looses data when it goes into the if statment.
DavidCrow wrote:
And why do I always get errors refering to converstions. eg. no conversion from char* to int.
I can't remember now the exact error, but when I get it next will post it. Just woke up.
|
|
|
|
|
tomek18 wrote:
You have seen how I'm trying to filter it out, and get rid of the new lines. But the if statement doesn't recognise \n or \r or even hex or oct or "x"!!!
I showed you why this is. It's becasuse you are adding the incoming character to position x in the array but are looking at position x+1 .
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
1) ... buffer[(nPass++)] = pszData[0];
2) ... if (buffer[nPass] != '\n')
nPass is used to set an element of buffer (eg buffer[x]) in line
1 then incrmented so in line 2 you are testing an unitialized
element, buffer[x+1].
There are probably more errors (where is the loop that iterates
through the buffer?) but this is the first one you need to address.
Steve T
|
|
|
|
|
Hi,
I am looking for a C++ class for the Mersenne Twister random number generator that can be easily added to a Visual Studio .NET project without any error messages! All the ones I'm finding on the Internet are not compatible, and I'm getting link errors. Rather than try to dig into their code, does anyone have a library/class that will work that contains the MT?
The period required for my code is over 16 billion. If there is a RNG out there that also has a higher period than this, then that will work as well. Does anyone know the period for the Random class in .NET?
Thanks,
Jeff Robinson
JDR
|
|
|
|
|
just curious : what is in brief the Mersenne Twister Random number please ?
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
|
|
So why don't you just take the c source code from that website
and make a class yourself. There are no libraries to link.
It compiles and runs as is in a new console application project.
Steve T
|
|
|
|
|
|
Glad you found one that may do what you want but if not
it would be trivial to implement the few lines of code
on that website as a class.
No need to change any of the function bodies (excpet main() )
so not exactly re-inventing the wheel. Just re-packaging an
existing wheel.
Steve T
|
|
|
|
|
is there anyway to move mouse to any point?
|
|
|
|
|
|
Actually, i want to show a tooltip in certain situations. I can show whenever i want it, but it is shown in the last mouse message's position. So i guess if i move it maybe i can show it where i want.
is there a solution to show tooltip, in a certain position
|
|
|
|
|
I'm not sure I understand your question. Are you trying to display a tooltip that follows the mouse?
If so, create the tooltip window, handle WM_MOUSEMOVE , and position it to the mouse's current location. Alternatively, use a timer to query the mouse's current location and move the tooltip everytime it changes.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
OK. for example when an edit box sends EN_MAXTEXT i want to show "max text" as a tooltip. I can show tooltip whenever i want, but i cant show it wherever i want.
it shows just where the mouse is over.
|
|
|
|
|
forcing the move to be the place you want your tooltip to be is very irritating for the user...
if you cannot find how to display your tooltip where you want, then search again (or you're doing something wrong) !!
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
if that's the case, I suggest subclassing the CToolTipCtrl class or creating your own class that just makes a generic label window, but with colors to make it mimic a tooltip
My articles
www.stillwaterexpress.com
BlackDice
|
|
|
|
|
I think you'd have to subclass the edit control to alter this behavior. Perhaps there's a style you can set to disable the default tooltip? If so, you could handle the EN_MAXTEXT notification and display your custom tooltip at a specific location.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
As always the solution is thinking basicly
SendMessage(TTM_ADJUSTRECT, TRUE, (LPARAM)&rect);
SetWindowPos(this,(rect.left+rect.right)/2, rect.top-50,
0, 0,
SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE);
|
|
|
|