|
May be its problem with controls (especialy when using CustomCtrl) in your dialog.
|
|
|
|
|
Create the dialog with the DS_NOFAILCREATE style. If that works, then you know there is a control-related issue. This is normally because an ActiveX control is being used that does not exist, or has not been registered, on the target machine.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
hiho@ll
i'm using this http://www.codeproject.com/library/lyoulhttpclient.asp http client to upload a file (like the example)
what i do:
i'm uploading a few text files, not very big, 1 or 2kB
the problem:
i can upload (to my self programmed php script) 2 files
the third file doesn't work
HttpSendRequestExA (on line 639 in the http client above) throws a exception after a few minutes! (i get error code 12002 ERROR_WINHTTP_TIMEOUT)
The Apache doesn't get a request! in the access.log i only see the first two requests
the flags for the connection are NTERNET_FLAG_HYPERLINK | INTERNET_FLAG_KEEP_CONNECTION | INTERNET_FLAG_NO_UI | INTERNET_FLAG_RESYNCHRONIZE | INTERNET_FLAG_NO_CACHE_WRITE | INTERNET_FLAG_PRAGMA_NOCACHE | INTERNET_FLAG_RELOAD
1. anybody else had similar problems with HttpSendRequestEx (and what solved/caused the problem?)
2. anybody has an idea what's causing the problem
3. solutions/workarounds?
4. i don't know how to analyze the problem, so know what causes the problem
how can i analyze what HttpSendRequestExA does to know what causes the problem?
5. may it helps if anyone explains how to use HttpSendRequestExA (i mean, making a connection, working with the connection, closing the connection (just like a function list/ maybe the connection isn't closed and i don't know which function does this))
thx@ll
|
|
|
|
|
i tried the example from the msdn and i get an error 997 Overlapped I/O operation is in progress
the code:
BOOL UploadToURL::Test(TCHAR *upFile){
INTERNET_BUFFERS BufferIn = {0};
DWORD dwBytesRead;
DWORD dwBytesWritten;
BYTE pBuffer[1024]; // Read from file in 1K chunks
BOOL bRead, bRet;
HINTERNET hConnect=NULL,hInternet=NULL;
hInternet=InternetOpen("User Agent",INTERNET_OPEN_TYPE_PRECONFIG,NULL,NULL,INTERNET_FLAG_ASYNC);
hConnect=InternetConnect(hInternet,"127.0.0.1",INTERNET_DEFAULT_HTTP_PORT,NULL,NULL,INTERNET_SERVICE_HTTP,0,NULL);
BufferIn.dwStructSize = sizeof( INTERNET_BUFFERS );
HINTERNET hRequest = HttpOpenRequest (hConnect, "PUT",
"/upload.php", NULL, NULL, NULL, 0, 0);
if (!hRequest)
{
printf("Failed to open request handle: %lu\n", GetLastError ());
return FALSE;
}
HANDLE hFile = CreateFile (upFile, GENERIC_READ, FILE_SHARE_READ,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile == INVALID_HANDLE_VALUE)
{
printf("\nFailed to open local file %s.", upFile);
return FALSE;
}
BufferIn.dwBufferTotal = GetFileSize (hFile, NULL);
printf ("File size is %d\n", BufferIn.dwBufferTotal );
if(!HttpSendRequestEx( hRequest, &BufferIn, NULL, HSR_INITIATE, 0))
{
DWORD d=GetLastError();
printf( "Error on HttpSendRequestEx %lu\n",d);
return FALSE;
}
DWORD sum = 0;
do
{
if (!(bRead = ReadFile (hFile, pBuffer, sizeof(pBuffer),
&dwBytesRead, NULL)))
{
printf ("\nReadFile failed on buffer %lu.",GetLastError());
break;
}
if (!(bRet=InternetWriteFile( hRequest, pBuffer, dwBytesRead,
&dwBytesWritten)))
{
printf ("\nInternetWriteFile failed %lu", GetLastError());
break;
}
sum += dwBytesWritten;
}
while (dwBytesRead == sizeof(pBuffer)) ;
CloseHandle (hFile);
printf ("Actual written bytes: %d\n", sum);
if(!HttpEndRequest(hRequest, NULL, 0, 0))
{
printf( "Error on HttpEndRequest %lu \n", GetLastError());
return FALSE;
}
return TRUE;
}
but this time i get the error in the first try!
|
|
|
|
|
|
|
Hi,
Or is there any way to get the IP address of a computer in a local network using the MAC address?
Cheers,
Thanks.
|
|
|
|
|
i'm not the network expert, but try to search for RARP (reverse address resolution protocol) maybe you find a rarp client or something
|
|
|
|
|
Hi every one,
Is there any way to send a string to a computer in a local network?
But the network hasn't any configurations.
And I have not the computer name or IP address to send.
Or is there any way to send a string to a computer using mac address?
(In VC++ or other labguages?)
Cheers,
Thanks.
|
|
|
|
|
My goal is to prevent any navigation on any browser different than IE.
Hence, I'm trying to deny the use of port 80 to any programs different than Iexplorer.exe
Any advice or help would be greatly appreciated as I have some hard time finding samples covering that kind of functionnality.
PS: yes it is dracstic but that's the way it is lol
PSS: ThatsAlok you're a guru man!! I'm a fan
|
|
|
|
|
I want to set color of string and move that string in cosole but i don't know.Who know to help me.
Thank you.
|
|
|
|
|
Hello
We Believe in Excellence
|
|
|
|
|
Go to "The Soapbox".
Don't try it, just do it!
|
|
|
|
|
how do i sense ctrl+C in a dialog based application?
|
|
|
|
|
|
Sorry Heman!
RegisterHotKey function never register Hotkey for Ctrl+c as it is previously register by window for system wide Clipboard usage!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
theerkanamai wrote:
how do i sense ctrl+C in a dialog based application?
If your just looking to handle the Ctrl-C key while your dialog is in focus, you can easily add an accelerator key.
In the resource view locate the Accelerator folder.
Double click to open it, right click and scroll down to “New Accelerator”
-------------------------------
|
|
|
|
|
I have a question on setting the application window size. I'm trying to do something non-standard. I want to increase the size of an application's window to be greater than the desktop size. I've tried to use the Cwnd class functions (SetWindowPos and MoveWindow), but none of them allow me to increase the size beyond the desktop's window size. I can increase any application's window size; just not bigger than the desktop. Is there a way around this? Can I use the graphics interface to get around this; or would it just create a stretched image with no real application functionality?
|
|
|
|
|
Anonymous wrote:
I've tried to use the Cwnd class functions (SetWindowPos and MoveWindow), but none of them allow me to increase the size beyond the desktop's window size
I have tried this too! and it works well for me!, Could you show your code snippet!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
I get the application window's Cwnd handle. Then, I do something like this:
pWnd->GetWindowRect(&Rect);
pWnd->SetWindowPos(pWnd, 0, 0, Rect.right + size_inc, Rect.bottom +size_inc, SWP_NOZORDER | SWP_SHOWWINDOW);
It will increase the size of the app window. At a certain point size_inc does not matter.
|
|
|
|
|
try this
<br />
::SetWindowPos(this->m_hWnd,HWND_TOP,0,0,850,650,SWP_SHOWWINDOW);
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
hiho@ll
i'm searching a part of the file system for files to upload to a server
i'm using FindFirst and FindNext to search for the files
in my WINXP home directory i have a subfolder which i use to search through
the problem is, FindFirst and FindNext just find "." or ".."
if i set the path to another dir it just finds the first entry!
what's the problem?
anybody please post a simple example prog?
thx@ll
|
|
|
|
|
WIN32_FIND_DATA fd = { 0 };
HANDLE hFind = FindFirstFile( filespec, &fd );
if ( hFile != NULL )
{
do
{
}
while( FindNextFile( hFind, &fd ) );
CloseHandle( hFind );
} Note that filespec should contain wildcards (e.g. "C:\\Windows\\*") if you want multiple files to match.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
You'll miss the last file and you won't properly read the first one with the above example.
WIN32_FIND_DATA fd = { 0 };
HANDLE hFind = FindFirstFile( filespec, &fd );
if ( hFile != NULL )
{
BOOL MoreFilesFollow;
do
{
MoreFilesFollow = FindNextFile( hFind, &fd );
}
while(MoreFilesFollow);
CloseHandle( hFind );
}
|
|
|
|
|
hmm
i tried the code from the msdn documentation
and a code (which looks like yours and the same from msdn) from a website
the website code works, msdn not, but all look very similar
thx@ll
|
|
|
|
|