|
It's not the hardware. It's the fact that WM_TIMER messages are the lowest priority messsage, and there's a chance they can get ignored on an otherwise busy machine. Using a separate thread to run a timer that is *not* based on WM_TIMER is a better course of action than what he's already tried.
|
|
|
|
|
Hi folks,
I'm having problems when using the _execl() and _spawnl() functions - the compiler/linker can't find their definitions (undeclared identifier, i.e. not seeing the function prototype). Basically, what I hope to do is to run a simple DOS application via my app without having the MS-DOS prompt popping up.
I've looked in the MSDN help and have included all the correct headers (process.h and errno.h). As far as I can tell I'm doing it correctly.
My application is an MFC App (for an OpenGL app) running on Windows 98.
Hope you can help and thanks for your time.
Cheers,
Stephen McGeown.
|
|
|
|
|
It works on my machine (VC6 SP5). Check if your include paths are set correctly. BTW: you may want to call ::CreateProcess instead of exec/spawn if you don't want visible console window - this call gives you much more control over child process. exec/spawn are implemented using CreateProcess.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
Thanks for your help Tomasz. I'm *pretty* sure my include paths are correct. Just wondering whether it makes a difference because it's a *.cpp file, not *.c ?
Anyway, the CreateProcess call looks better so I'll give it a bash.
Cheers!
|
|
|
|
|
hi..i have a question.
How to set the focus back to the formview(main windows??) when its focus is on a textbox on the toolbar????
Thx
|
|
|
|
|
I am developing a activex control in Visual C++ that manages the windows
sound with the apis mm. I use the file mmsystem.h (#include mmsystem.h) and
in the Settings section of my project makes a link to the file winmm.lib.
All works well in Windows NT 4.0.
My problem is that this control doesn't work correctly in Windows 2000 and
in Windows 98 because the file winmm.dll (in the system directory) possesses
different numbers of versions in these.
Windows 2000: 5.0.2161.1
Windows 98: 4.03.1998
Windows NT: 4.0.1371.1
Is somebody able to tell me how to solve this?
Thanks in advance and Best Regards
|
|
|
|
|
Different version numbers of DLLs on different platforms are *normal* thing. What exactly does not work? Are you using some functions that are not present on older Windows versions?
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
I need to download a resource from a server using HTTP in chunks. But the function HttpSendRequestEx() function always fails returning error code 87. If anyone has done anything of this kind, please help.
I have tried all sorts of parameters in INTERNET_BUFFER which is passed in this function, but does'nt work.
Kaivalya Vishnu
|
|
|
|
|
The following code is from MSDN, hope it helps you...
BOOL UseHttpSendReqEx(HINTERNET hConnect, TCHAR *upFile)
{
INTERNET_BUFFERS BufferIn = {0};
DWORD dwBytesRead;
DWORD dwBytesWritten;
BYTE pBuffer[1024];
BOOL bRead, bRet;
BufferIn.dwStructSize = sizeof( INTERNET_BUFFERS );
HINTERNET hRequest = HttpOpenRequest (hConnect, "PUT",
"/test/page.htm", 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))
{
printf( "Error on HttpSendRequestEx %lu\n",GetLastError() );
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;
}
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Who can explain me exactly how to add vertical scroll that works to my dialog window???
|
|
|
|
|
What do you mean by 'vertical scrollbar that does not work'?
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
hi,
I have a SDI application, and I like to load a bmp file,
I got two functions in CView class.. but it just doesn't work.
can anyone see what the problem is..
void CTestEdgeView::OnFileOpen()
{
// TODO: Add your command handler code here
//build a filter to use in the file open dialo
static char BASED_CODE szFilter[] = "Bitmap Files (*.bmp) | *.bmp ||" ;
//Create the File open dialog
CFileDialog m_ldFile(TRUE, ".bmp", m_sBitmap,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
szFilter);
//show the file open dialog capture the result
if (m_ldFile.DoModal() == IDOK )
{
Invalidate();
//get the filename selected
m_sBitmap = m_ldFile.GetPathName();
ShowBitmap( m_sBitmap);
}
}
void CTestEdgeView::ShowBitmap(CString file)
{
//check if we have a valid file
if(file !="")
{
HBITMAP hBitmap = (HBITMAP) ::LoadImage(AfxGetInstanceHandle(),
file, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_CREATEDIBSECTION);
if (hBitmap)
{
// Delete the current bitmap
if (m_bmpBitmap.DeleteObject())
// If there was a bitmap, detach it
m_bmpBitmap.Detach();
// Attach the currently loaded bitmap to the bitmap object
m_bmpBitmap.Attach(hBitmap);
}
Invalidate(FALSE);
}
}
I appriciate your help.
Ehsan Behboudi
|
|
|
|
|
Ehasan,
It's been ages since I hacked MFC, but I think I can steer you in the right direction.
Your doc class should contain an HBITMAP member. This bitmap will be displayed in your view's OnUpdate() method. Your app's OnFileOpen() handler should free the doc's existing bitmap (if any) and load a new one from the selected file.
Your view's OnUpdate() method should paint the bitmap in the supplied DC. Remember, you don't "display the bitmap". Instead, you "respond to a request - from Windows - to display the bitmap".
Hope this helps.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I want to do a Install to my program. The default install path have to be the Programs Files Folder and the name of my application (ie. 'C:\PROGRAM FILES\MyApp'). But when i call the function SHGetSpecialFolderLocation with the argument CSIDL_PROGRAM_FILES she didn't workes. There is other way to do it? Note that the use of SHGetFoldLocation cannot be used because some computers with win95 don't have thist function (shfolder.dll and bla bla bla...). Thanks.
Daniel Barcelos
|
|
|
|
|
What do you mean "it doesn't work"? Does it return a failure code? Crash? Format your hard drive?
Post your code so we can check out what you're doing.
--Mike--
http://home.inreach.com/mdunn/
#include "buffy_sig"
|
|
|
|
|
I have the following code that I'm having problems understanding.
WHO_RU_API int GetNetUserLoginId(char* pBuffer, int nBufferSize)
{
int nCharCount = 0;
WKSTA_USER_INFO_1 UserInfo;
if ( NERR_Success == NetWkstaUserGetInfo(NULL, 1, (LPBYTE*)&UserInfo) )
{
int nCount = WideCharToMultiByte(CP_ACP, NULL, (LPCWSTR)UserInfo.wkui1_username, -1, NULL, NULL, NULL, NULL);
if ( nCount > 0 )
{
char Buffer[32];
int nCountAgain = WideCharToMultiByte(CP_ACP, NULL, (LPCWSTR)UserInfo.wkui1_username, -1, Buffer, nCount, NULL, NULL);
if ( nCountAgain > 0 )
{
nCharCount = strlen(strncpy(pBuffer, Buffer, min(nBufferSize, nCountAgain)));
}
}
}
return ( nCharCount );
}
I have this function inside a DLL and I'm calling it from a console program. Eveuntually it will be a windows app calling it. The part I don't understand, is that following the second call to the WideCharToMultiByte() function, my 'Buffer' contains a string of 8 illogical characters and the 8 characters of my Lan Id. I know I'm missing something important here, but I'm too lost to see the forest for the trees at the moment . Any help would be appreciated. Thanks.
Chris
|
|
|
|
|
try to type as followed...
TCHAR myBuf[256];
wcstombs( myBuf, UserInfo.wkui1_username , 255 );
...
by
by Peng_you
|
|
|
|
|
Does anybody here have any experience utilizing DirectX/DirectShow in order to create capture devices/encoding devices? If so, could you please let me know, I have some questions that I cannot find the answer to and am hoping someone here can help. Thanks in advance.
Roger Printy
Software Engineer
TeraNex
Orlando, FL
|
|
|
|
|
Hi
Can some one tell me, how I can get the HTML-Code of a page, when i use a CHtmlView to show this page.
thank's
|
|
|
|
|
First, use CHtmlView::GetHtmlDocument to get IDispatch interface. Then call QueryInterface to get IHtmlDocument2 interface pointer. Finally, use IHtmlDocument2::toString method.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
You can get an idea here
http://www.codeproject.com/useritems/chtmlview_search.asp
Carlos Antollini.
|
|
|
|
|
Hello, the codegurus around the world.;)
In order to get the source code of html on CHtmlView, you can use GetHtmlDocument and IPersistFile.
Since we can get IDispatch from GetHtmlDocument, we use QueryInterface passing IPersistFile's IID.
After this, we can use Save function of IPersistFile to save the source code at the local drive and check it NotePad executed
by ShellExecute.
Have a nice day!
-Masaaki Onishi-
|
|
|
|
|
Hello,
I just converted an article at the "other" site (http://www.codeguru.com/listview/VirtualListControl.html) from CArray to std:vector. The performance increased 5 times! The only section that I didn't like was the column sorting method. It uses the qsort() function to sort the columns. It seems there would be a more elegant (STL) method of doing this. There is a class defined for a row of data similar to this (shortened for clarity):
class CRowData {
CString col1;
int col2;
}
The qsort function calls the appropriate comparison function to sort on the desired member. It seems like there should be a way to do this using the STL. I would like to expand this example to include sorting on more than two columns as well.
Any ideas?
Thanks,
Derek
Doble Engineering
|
|
|
|
|
Are you also getting 500% performance improvement in Release build?
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
Actually it's not as high as I thought. I was comparing debug build to debug build. Using the metrics (GetTickCount) the original author already had in the code (approximate tick values):
CArray:
Debug: 2000
Release: 250
STL:
Debug: 600
Release: 90
List Control InsertItem():
Debug: 15000
Release: 12000
STL Improvement:
Debug: ~ 3.3x
Release: ~ 3.3x
These are after a few runs, but there was definitely an improvement. Either was an improvement over the InsertItem method! I know all of these results are completely subjective (compiler settings, computer speed, etc.), but try it yourself to see the difference!
Also, any ideas on converting the sorting to STL?
Thanks,
Derek
DP
|
|
|
|
|