|
how can I remove a button's edge...my button is flat and I want to remove the white edges around it.
|
|
|
|
|
You'll need to subclass CButton and handle its drawing.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
I'm tryingt to automate some things and I want control of another program from within my program. For example, I want my C++ program to be able to open Microsoft Excel and print some data into a cell. Or I want my program to open a database application we use and export a query into a text file. Does anyone know how to gain this kind of control of another application from within my C++ program?
Yesterday is history
Tomorrow's a mystery
Today is a gift
That's why they call it the present
Danny
|
|
|
|
|
bugDanny wrote:
I want my C++ program to be able to open Microsoft Excel and print some data into a cell.
You can do this easily with Excel Automation. See MSDN article Q178749 for an example.
bugDanny wrote:
Or I want my program to open a database application we use and export a query into a text file.
I would use ODBC (or ADO) for this. Check out these two MFC classes: CDatabase and CRecordset .
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I am building a simple dialog box based program in Visual C++. I want to allow the user to open a picture in a picture control. If the user clicks inside the picture box, I want it to draw a small circle on the picture where the user clicked.
One problem I am having is that picture controls don't handle mouse events... that is, there are no control events listed for the picture control. How do I add a mousedown event? As you may have noticed, I am a beginner, so please give as much detail as possible.
Thanks!
|
|
|
|
|
Have you used Spy++ to verify that no messages are sent to the picture control?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I don't have Spy++.
Isn't there some way to just add a mouse handling event to the picture control?
|
|
|
|
|
MALDATA wrote:
I don't have Spy++.
How do you know?
MALDATA wrote:
Isn't there some way to just add a mouse handling event to the picture control?
Sure, but if you don't know what messages, if any, are being sent to the control, what's the point? Even if you did add a mouse-handling function, what if it does not work?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Spy++ is not listed in the Visual Studio Tools menu, and I have to assume that's where it would live. If it's somewhere else, please let me know.
I'll see if I can wrangle a copy of spy++... outside of that, what should I do?
|
|
|
|
|
MALDATA wrote:
Spy++ is not listed in the Visual Studio Tools menu, and I have to assume that's where it would live. If it's somewhere else, please let me know.
Could it have been overlooked during installation?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I have an old copy of VC++ 6 somewhere... I know that had Spy++ with it, I'll see if I can find that. Assuming I do, what should I do to make this work?
|
|
|
|
|
MALDATA wrote:
what should I do to make this work?
See this[^] link.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
I've used Spy++ before, I just don't see how it helps in this particular case.
I found my old copy and ran it, the picture box doesn't respond to anything.
I've seen stuff like this... is this anything like what I have to do?
PictBox->add_MouseUp(new MouseEventHandler(this, PictureMouseUp));
If so, where does it go?
|
|
|
|
|
MALDATA wrote:
PictBox->add_MouseUp(new MouseEventHandler(this, PictureMouseUp));
Is this VC++ v6?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
No, I'm using Visual C++ in Visual Studio 2005
|
|
|
|
|
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
|
|
|
|