|
Can you show all the code around your CreateWindowEx() ?
It's time for a new signature.
|
|
|
|
|
RECT r;
x -= ::GetSystemMetrics(SM_CXFIXEDFRAME);
y -= ::GetSystemMetrics(SM_CYCAPTION)+::GetSystemMetrics(SM_CYFIXEDFRAME);
r.right = width;
r.bottom = height;
AdjustWindowRect(&r,0,0);
obj.handle = CreateWindowExA(WS_EX_TRANSPARENT|WS_EX_TOPMOST,"CONTEXT",title,0,x,y,width,height,0,0,::GetModuleHandle(0),0);
The WndProc associated with it is crafted to make it as though the non-client area does not exist; it is not drawn, it does not recieve input, hit tests return true only if the point is inside the client area, and WM_NCCALCSIZE returns WVR_VALIDRECTS|WVR_REDRAW (for now, I will do some custom checking later).
For getting the size and position, I use GetClientArea, as the client is effectivly the entire window. The window is filled with a rectangle of its width and height when redrawing. Looking it over it might be that I should use SM_CXBORDER insead of SM_CXFIXEDFRAME, but that would not account for all the missing space.
|
|
|
|
|
Despite your previous comment, the above does not use SM_CXSCREEN/SM_CYSCREEN, thus the final values you are using to create your window may not be the full screen size. I also cannot see the point of your call to AdjustWindowRect() in the above. Nor do you show what are the values of width and height . Also what are the initial values of x and y ?
It's time for a new signature.
|
|
|
|
|
It is an inline function; x, y, width, and height are values passed to it.
In the case this thread refers to: x = 0, y = 0, width = GetSystemMetrics(SM_CXSCREEN), height = GetSystemMetrics(SM_CYSCREEN).
AdjustWindowRect causes the bottom and right member variables to be adjusted such that if you create a window using them, the height and width of the client area will be equal to the original values of those variables. This is simpler and less error prone than figuring it out myself.
Do to the nature of the redraw code as it stood at the time I was doing this, everywhere that was not drawn to would be filled with black. I know this because I am doing the drawing with OpenGL and when I had a matrix out of place (it was the default matrix, so only the upper right was being drawn). So that is not an issue.
|
|
|
|
|
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.
|
|
|
|
|