|
I use VFP98 open a database named abc.dbf,only spend 5 second include show all the data in database.
But,when I use ODBC API (VC++6.0)open the abc.dbf,and show all the data ,It spend much more times,and make the computer shutdown!!(There is not enough memory!!)
Thanks!
hi
|
|
|
|
|
I have this Date and Time display in my window. Im using the Ontimer() / SetTimer() routine to update it... but the problem is the "second" display's interval is not consistent. It is not actually noticeable but when you compare it with the computers clock you can see it ticking ahead sometimes. what can i do to solve this?
Hope you can help me guys.
Thank You!
Rachel Sy
|
|
|
|
|
How about a second thread that uses Sleep() or SleepEx() instead.
Then every, let's say, 15 seconds, you could do a sync with the computer clock, checking the clock, and checking that your thread is on the right time...
Anyway, just an idea, there may be smarter ways...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Don't rely on intervals between WM_TIMER messages that your program receives. They're just a chance for your program to update date/time display - you should call ::GetSystemTime or CTime/COleDataTime methods in the handler, then output the text if string representing current time changes.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
here is what my program looks like
LONG xxxxxx::OnPageChange(UINT lPageNo, LONG lValue)
{
.
.
//Timer
SetTimer(1, 400, NULL);
.
.
}
void xxxxxx::OnTimer(UINT nIDEvent)
{
TimeDisplay();
CWnd::OnTimer(nIDEvent);
}
void xxxxxx::TimeDisplay()
{
SYSTEMTIME osTime;
GetLocalTime(&osTime);
//YEAR
.
.
//MONTH
.
.
//DAY
//HOUR
//MINUTE
//SECOND
if(oldtime[5] != osTime.wSecond){
oldtime[5] = osTime.wSecond;
//Display second here//
}
}
i tried making a new thread and call TimeDisplay(). But created a while loop inside the TimeDisplay because i dont know a way to update the clock(since i cant use the WM_TIMER here or i can?) i just dont know how....
whats the problem with my program? thanks to everyone who replied to this question. sorry for takign your time... i really appreciate your help....
Rachel
|
|
|
|
|
You can't rely on WM_TIMER messages arriving at exactly the interval you ask for. That's just how PC hardware works. Also, if a WM_TIMER message is in your queue, and the timer expires again, another WM_TIMER message is not placed in your queue. So if, say, you start formatting a floppy, or open Word and Excel so your system suddenly starts swapping, that will hog CPU time and may prevent WM_TIMER message from being sent to you for the reason I just stated.
So, whenever you get WM_TIMER, you pretty much need to reread the system time. You can't just increment a counter by 1 sec.
--Mike--
http://home.inreach.com/mdunn/
#include "buffy_sig"
|
|
|
|
|
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
|
|
|
|
|