|
I suspect this may have something to do with your values of x and y which look like they may be negative. As I said earlier using values of x=0, y=0, cx=SM_CXSCREEN, cy=SM_CYSCREEN the window will fill the monitor. The values you are using are different from this, thus your results are different.
It's time for a new signature.
|
|
|
|
|
What are you actually trying to do? Made a window go fullscreen? If so read this[^] and this[^].
Steve
|
|
|
|
|
Yes and no, I am doing this because I had once tried to create a fullscreen window and I found an upper limit on the size of a window. This was to see if I had found how to work around that, which I seem to have done. The question is about the possible cause of an oddity I noticed in the process.
Thanks for the links, I think they will be useful soon.
|
|
|
|
|
Is their any functions to merge two wchar_t* into one wchar_t?
|
|
|
|
|
|
Merge two pointers to wchar_t into one wchar_t? This does not exactly make sense, can you try to explain what you are trying to achieve?
It's time for a new signature.
|
|
|
|
|
This is a function receiving a CDownload class structure.
WSADATA WS2Info;
if (!WSAStartup(MAKEWORD(2,2), &WS2Info))
{
MessageBox(g_hWindow, L"WinSock2 Initialized", L"Tracing", NULL);
SOCKET IPv4 = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (IPv4 != INVALID_SOCKET)
{
hostent *ResolveHost;
char *HostName = new char[wcslen(Download->HostName)];
wctomb( HostName, (wchar_t)Download->HostName);
ResolveHost = gethostbyname(HostName);
MessageBox(g_hWindow, L"Resolving Host", L"Tracing", NULL);
if (ResolveHost)
{
MessageBox(g_hWindow, L"Connecting", L"Tracing", NULL);
SOCKADDR_IN Host;
Host.sin_family = AF_INET;
Host.sin_addr.s_addr = (ULONG)ResolveHost->h_addr_list[0];
if (Download->ConnectionProtocol == Download->HTTP)
Host.sin_port = htons(80);
if (!connect(IPv4, (SOCKADDR*) &Host, sizeof(Host)))
{
MessageBox(g_hWindow, L"Connected", L"Tracing", NULL);
char *HostFileLocation = new char[wcslen(Download->HostFileLocation)];
wctomb(HostFileLocation, (wchar_t)Download->HostFileLocation);
char TCPsend[DEFAULT_BUFLEN];
sprintf(TCPsend,"GET %s\r\n\r\n",HostFileLocation);
send(IPv4,TCPsend,strlen(TCPsend),0);
TotalBytesToDownload += Download->BytesToDownload;
TotalBytesDownloaded += Download->BytesDownloaded;
ofstream DownloadFile ( Download->FileName, std::ios::out );
int ReceivedBytes = 0;
char TCPrecv[DEFAULT_BUFLEN];
do
{
MessageBox(g_hWindow, L"Downloading", L"Tracing", NULL);
ReceivedBytes = recv(IPv4, TCPrecv, DEFAULT_BUFLEN, 0);
TotalBytesDownloaded += ReceivedBytes;
Download->BytesDownloaded += ReceivedBytes;
DownloadFile << TCPrecv;
}
while (ReceivedBytes && Download->DownloadState == Download->ACTIVE);
DownloadFile.close();
MessageBox(g_hWindow, L"Download Finished", L"Tracing", NULL);
closesocket(IPv4);
}
}
}
}
WSACleanup();
Some files are not 0kb in size, but appear to be corrupted and some files appear to have 0kb in size.
It's more file extension related.
I started thinking if it might be a Windows Firewall related problem, but if it connects I think everything is ok with the Windows Firewall. Or if Windows Firewall abrupt's connection pathway during recv, well need an opinion.
Thanks in advance.
|
|
|
|
|
You haven't gotten a response so far because your question is quite cryptic. What exactly is wrong? What opinion do you need?
|
|
|
|
|
Fareed Rizkalla wrote:
do
{
ReceivedBytes = recv(IPv4, TCPrecv, DEFAULT_BUFLEN, 0);
TotalBytesDownloaded += ReceivedBytes;
Download->BytesDownloaded += ReceivedBytes;
DownloadFile << TCPrecv;
}
while (ReceivedBytes && Download->DownloadState == Download->ACTIVE);
First without a protocol you don't know if the complete content data was transferred or the connection was interrupted. Second you do not have any error handling in the loop, recv() can return -1 in error cases. Third your receive buffer TCPrecv is used to insert data with ostream::operator<< but the text data is never null terminated (or otherwise indicated how long it is). Could that be a problem?
Hope this helps,
M
Webchat in Europe Now with 26% more Twitter
modified on Monday, April 19, 2010 4:58 AM
|
|
|
|
|
char *HostFileLocation = new char[wcslen(Download->HostFileLocation)];
wctomb(HostFileLocation, (wchar_t)Download->HostFileLocation);
char TCPsend[DEFAULT_BUFLEN];
sprintf(TCPsend,"GET %s\r\n\r\n",HostFileLocation);
send(IPv4,TCPsend,strlen(TCPsend),0);
I have been tracing the problem all night, and I even started adding MessageBox functions to help me get to the roots of the problem. It seems the problem is in the wide-char to multi-byte conversion!?
After the conversion I used MessageBox to return the new string and it's all jebrish. 
|
|
|
|
|
Don't know. I would start a new forum question with a new code snippet that isolates your text conversion problem. Just as a side note, the dynamically allocated memory is never deleted = memory leak.
|
|
|
|
|
Check out RFC 2616 too. You are defaulting to HTTP 1.0 so you could be having problems with the target machine not being compliant.
Always test the command you want to use by using Telnet to issue the command to the web server. If it works then you will see and us Wireshark/Microsoft Network Monitor (both are free) to check what is on the wire.
Alan
|
|
|
|
|
Everyone has to claim a lot of things, first of all I'm using HTTP 1.1.
And I've been using the RFC, did I put any code that says HTTP 1.0.
All I did is put some file management function and say I have some problems.
I've been using Network Monitor 3.3 and I can tell you it can identify my HTTP protocol is HTTP 1.1.
|
|
|
|
|
I hate to do this but..
http://www.rfc-editor.org/rfc/rfc2068.txt[^]
3.1 HTTP Version<br />
<br />
Applications sending Request or Response messages, as defined by this<br />
specification, MUST include an HTTP-Version of "HTTP/1.1". Use of<br />
this version number indicates that the sending application is at<br />
least conditionally compliant with this specification.<br />
<br />
The snippet you posted does not contain this which means the request will be treated as if it is HTTP 1.0.
Alan
|
|
|
|
|
Hello
i love for some help with my project in C++ BUILDER
i have a previous and next button and a form for my images above with a starting image
i want when a click on the next button to show the next image
and for the previous the previous image
something like a slide show
thanks a lot it's really urgent!!
|
|
|
|
|
When is the assignment due?
|
|
|
|
|
thanks for caring
it;s a whole project but i;m stack here!
it's till friday
|
|
|
|
|
Handle the click event of the buttons and load the appropriate images. Until you post your program here we probably can't help much.
|
|
|
|
|
I did that, since i;m new in programming i'm kind of confused
i have to create a loop so that in each click it;s uploads a new image?
thanks anyway
|
|
|
|
|
The loop you mentioned is not needed. The event handlers are called only when the event happens.
You need to maintain a list for all the images, and an index marking the current image. When the event handlers are called, change the index accordingly, and call the image loading routine.
|
|
|
|
|
You know how to display an image ?
I assume you should have documentation and/or course texts to help you do that ?
depending on how you images are stored, you need an array of something (image path, bitmap data, ...), and an index that will be increased/decreased with the next/previous button and that the index will loop back when at the first/last valid value so you will not access the array out-of-bound
anyway, think a little bit about it and come back to us with specific questions.
M.
Watched code never compiles.
|
|
|
|
|
taouki wrote: i want when a click on the next button to show the next image
and for the previous the previous image
So what do you need help with: responding to a button click, or displaying an image?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
hello everyone
i think i find it finally
thanks everyone for all help !!
|
|
|
|
|
Hey everybody
I have a YES/NO dialog, which the buttons are windowless controls.
I want to click YES or NO buttons programmaticly.
Does does anyone have any idea how to do that?
btw, I don't mean sending VK_RETURN message...
Thanks a lot in advance!
p.s.
If you want to see what I mean, open a "print" dialog in your office and use spy++ to check out the controls.
You'll notice most controls don't have HWND.
Thanks again! 
|
|
|
|
|
Hello,
Use SendMessage() Win32 API. This will solve your problem.
Happy Programming.
|
|
|
|