|
The message is a diagnostic telling you that there is a buffer overrun or a problem with an out-of-range index into a buffer. If you're doing strcpy or sprintf it might be that the buffer 'sDataParse' is too small. Are you also passing a string length, assuming that you're passing the LPSTR as a destination of some kind?
Steve S
|
|
|
|
|
that's not a problem of .NET studio, it's one of your software!
this error is caused by a call(in debug mode) at the end of a function, which checks if the stack layout has been modified!
Don't try it, just do it!
|
|
|
|
|
Hi again:
Another problem, I am able to maximize the main window and the tabctrl that is on it, but what it is inside the tabcontrol doesn't change the size. Any idea?
Thanks
|
|
|
|
|
Hi, I've developed a NT Service in C++. This service receives requests, and do some processing depending on these. One kind of request is displaying a DialogBox, but this never shows up. In the DialogBox procedure, the WM_INITDIALOG never arrives. If I try to launch a graphic app like calc.exe, the process runs, but never display it's interface. It looks like any GDI operation it's not available in my service. Any idea?
Tnx
|
|
|
|
|
Posting a dialog from a service isn't really a great thing to do. And there's issues around doing such things. Issues about how the service is installed, and which user this service is bound to:
First question: when you install this service, are you installing it using CreateService() and are you specifying the SERVICE_INTERACTIVE_PROCESS flag in dwServiceType parameter?
<br />
SC_HANDLE CreateService(<br />
SC_HANDLE hSCManager,<br />
LPCTSTR lpServiceName,<br />
LPCTSTR lpDisplayName,<br />
DWORD dwDesiredAccess,<br />
DWORD dwServiceType,<br />
DWORD dwStartType,<br />
DWORD dwErrorControl,<br />
LPCTSTR lpBinaryPathName,<br />
LPCTSTR lpLoadOrderGroup,<br />
LPDWORD lpdwTagId,<br />
LPCTSTR lpDependencies,<br />
LPCTSTR lpServiceStartName,<br />
LPCTSTR lpPassword<br />
);<br />
The moral is -- you should first scrutinize how your service is installed on your machine.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.santacruznetworks.com">Santa Cruz Networks</A>
|
|
|
|
|
|
Hi
How could i set up a scroll bar inside a tab control. That's it: I created a tab control, one of the window that I want to show inside is going to be huge, so I want to be able to scroll on it. I tried to set up the dialog shown with the option of vertical scroll but doesn't work.
What am I mising?
Thanks.
|
|
|
|
|
void CTabOne::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
if (pScrollBar-> GetDlgCtrlID()==IDC_SCROLLBAR1)
{
int nCurrentPos = pScrollBar-> GetScrollPos();
switch(nSBCode)
{
case SB_PAGEUP:
pScrollBar->SetScrollPos(nCurrentPos-5);
break;
case SB_PAGEDOWN:
pScrollBar->SetScrollPos(nCurrentPos+5);
break;
}
}
CDialog::OnVScroll(nSBCode, nPos, pScrollBar);
}
One problem is that I have no idea what the IDC_SCROLLBAR1 is, because I am not able to set up the IDC of the scroll bar
Other is that when I get rid of the if condition, I get an error and the program ends.
Any comment?
Thanks, Ruben
|
|
|
|
|
My BMP image is mainly green in colour. I want to change to red but I can't get even Paint Shop Pro to do this simple operation!
If I wrote code to do it, I would simply swap values of each pixel's green and red values.
For example (50, 150, 50) would become (150, 50, 50). This would not affect white or black pixels.
Can anyone help?
|
|
|
|
|
To do it in windows code is easy.
1) If you only need to swap the values, and speed is not a problem, you could just select it into a Device Context and do something like this
ClrRef = GetPixel(x,y);
ClrRef = SwapRG(ClrRef); // user defined func.
SetPixel(x,y);
Saving it back to disk is where life gets difficult.
1) Read the articles at code project, and other sights to find out how.
*2) Read "Programming Windows" by Charles Petzold.
INTP
|
|
|
|
|
Actually this is related to my last post about gethostaddress. I got as a result of putting in my machine IP adress , the name of my pc.........MyPC, but there was no other identifying info about the network etc. The sample code I am using takes "ftp.microsoft.com", so my "MyPC" is obviously not enough for the GetFTPConnection and it fails.....
m_pFtpConnection = InternetSession.GetFtpConnection (name1 );
where I got name1 from my gethostbyaddr. So how shall I get around this? My goal is to download some files off an IP address. The machine with this IP address will be physically connected to the machine requesting the files (my application), but I cant hardcode the machine name, and have to use the ip address.
Thanks,
ns
|
|
|
|
|
I presume, you are missing some basics.
CFtpConnection* GetFtpConnection(
LPCTSTR pstrServer,
LPCTSTR pstrUserName = NULL,
LPCTSTR pstrPassword = NULL,
INTERNET_PORT nPort = INTERNET_INVALID_PORT_NUMBER,
BOOL bPassive = FALSE
);
Here you dont need to give the target machine's IP address, ftp server name is enough.
but there was no other identifying info about the network etc
I didn't get this point!!!
You dont need to use gethostbyaddr(...). just give the machine name as the first parameter, and thats it.
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
Problem is I dont have the server name ...just the IP address. THe gethostbyaddr gives me the server name except in this case its not adequate since it just gives me back "myMachine" with no other specifics............
Thanks,
ns
|
|
|
|
|
I almost got this program to work but i always get two or more errors. Please help me.
Run a program that will ask the user for two floating point numbers. The second number asked for should be the percentage the user wants to find of the first number. It should then display the result of finding the percentage in this format:
Example: Enter a number: 25
What percent of 25 would you like to find? 3
3% of 25 is 0.75
So far I got this:
#include "conio.h"
#include "stdio.h"
void main()
{
clrscr();
float number;
float number2;
float answer;
answer=number*number2/100;
printf("Enter a number");
scanf("%f",& number,number2);
printf("What percent of %f would you like to find?",number);
printf("%f% of %f is %f",number2,number,answer);
getch():
}
and by the way what is the best c++ compiler? i have turbo c++ now and how do you add computer voice to c++ programs? Thanks
|
|
|
|
|
You need to do the calculation after you've entered the numbers.
void main()
{
clrscr();
float number;
float number2;
float answer;
printf("Enter a number");
scanf("%f",& number);
printf("What percent of %f would you like to find?",number);
scanf("%f",& number2);
answer=number*number2/100;
printf("%f% of %f is %f",number2,number,answer);
getch():
}
Michael
'War is at best barbarism...Its glory is all moonshine. It is only those who have neither fired a shot nor heard the shrieks and groans of the wounded who cry aloud for blood, more vengeance, more desolation. War is hell.' - General William Sherman, 1879
|
|
|
|
|
colin21 wrote:
I almost got this program to work...
I don't see how. answer is being computed with two uninitialized variables, number and number2 . I suspect you'll not get the correct answer simply dividing by 100. In order for the math library to work correctly, it needs to know that floating-point numbers are being used. Therefore, divide by 100.0. scanf() only has only field, yet two variables are provided. Luckily, the second one is ignored. Had it been scanf("%f %f", &number); instead, you'd indeed have problems. There does, however, need to be another call to scanf() for number2 .
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
i get 6 errors when i do that expression syntax errors and undefined symbol errors
|
|
|
|
|
Please post the code that produces these errors, or if it's the same code you've already shown, please indicate the error and line number.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Colin, I have a feeling you are really hating programming right about now! I didn't test what I did, I just took your code and rearranged it so it made sense. I thought this might help.
#include "conio.h"
#include "stdio.h"
void main()
{
clrscr();
float number;
float number2;
float answer;
printf("Enter a number: ");
scanf("%f",&number );
printf("What percent of %f would you like to find? ", number);
scanf("%f",&number2 );
answer=number*(number2/100.0);
printf("%f% of %f is %f\n",number2,number,answer);
getch():
}
colin21 wrote:
by the way what is the best c++ compiler? i have turbo c++ now and how do you add computer voice to c++ programs?
Before I started using the Visual Studios I used the Bloodshed DevCpp. I think you can get it at www.bloodshed.net It uses the Gnu compiler, which is the same compiler at Linux systems, which most schools have...so if your programs compile in the DevCpp, it should compile for your professor.
About the computer voice. I think at your level perhaps you should forget about doing anything fun in your programs for quite a while, especially voice. If you want your program to make sounds, put \a in your output statements, it'll create a feeble sounding beep.
Good luck!
Douglas A. Wright
dawrigh3@kent.edu
|
|
|
|
|
I'm using windows sockets in an application. On both the client and server I use WSAEventSelect() to register the events I'm going to handle. My question is when do the FD_READ and FD_WRITE events get triggered in relation to send() and recv()? I'm confused. Any help is appreciated.
Thanks,
Melinda
|
|
|
|
|
See if either of these two links help:
http://tangentsoft.net/wskfaq/intermediate.html#asyncreliable
http://tangentsoft.net/wskfaq/newbie.html#wouldblock
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
I recommend Network Programming for Microsoft Windows, Second Edition
by Anthony Jones and Jim Ohmund.
Kuphryn
|
|
|
|
|
I tried with the microsoft IP address, and neither call to gethost.... is successful.......the longPtrHostEnt is 0, and result is 11004 error which means valid address but no data record found..........
try {
HOSTENT* lngPtrHostEnt ;
char* strHostName ;
unsigned long Addr = inet_addr("207.46.197.102");
lngPtrHostEnt = gethostbyaddr((char*)&Addr, 4, AF_INET);
int result = WSAGetLastError();
or
lngPtrHostEnt = gethostbyaddr("207.46.197.102", 4, AF_INET);
int result = WSAGetLastError();
Thanks,
ns
|
|
|
|
|
There's nothing wrong with your code, other than not checking the return value of inet_addr() . 11004 is a valid return value and means the host could not be found. To verify, try pinging that IP address from a command prompt.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Thanks. Didnt get there with ping. I got that number off the web.
I tried the code with my secondary machines IP address, and it indeed gives me a nonzero pointer to the hostent, but then it crashes at the copymemory where I am trying to get the name....
char* strHostName ;
so I did
CString name (lngPtrHostEnt->h_name);
which worked. But why did the copy mem fail?
Thanks,
ns
|
|
|
|
|