They both work fine for me (Win/XP, Vstudio v6). What compiler/system are you using?
kochhar
Posts
-
rand ( ) -
How to open random files?OK, here's what you need to do: (1) Somewhere near the start of your program, seed the random number generator using time of day. This ensures that you don't get the same numbers every time:
srand((unsigned)time(NULL));
(2) Then, every time you need a random number (betrween 0 and iN)ifile=(rand() % (unsigned)(iN));
That should do it. -
connected to the network ????????I've been using the following function with success. It returns TRUE if a connection is available, and takes less than a sec in either case:
BOOL Online() { DWORD dwState = 0; DWORD dwSize = sizeof(DWORD); return InternetQueryOption(NULL, INTERNET_OPTION_CONNECTED_STATE, &dwState, &dwSize) && (dwState & INTERNET_STATE_CONNECTED); }
Credit: I got this from Paul Dilascia's column in MSDN mag a while back. -
How to open random files?(1) Read all song (file) names into an array (say N items) (2) Pick a random number between 1 and N and use that entry from your array.
-
How to play a specific buffer,not a file?The functions you need are: waveOutOpen() waveOutPrepareHeader() waveOutWrite() waveOutClose()
-
Thread Programming & MatlabTry replacing:
AfxBeginThread(THREADD1,NULL);
with:AfxBeginThread(THREADD1,NULL,0,0,0,NULL);
-
Beginer Visual C++ TutorialsHere are a couple of places to start: http://www.codeproject.com/script/articles/beginners.asp http://www.planet-source-code.com/vb/Tutorial/Default.asp?lngWId=3 http://devcentral.iftech.com/articles/MFC/default.php Good luck.
-
drive informationIf, by drive, you mean a disk partition, then you can use GetDiskFreeSpace or GetDiskFreeSpaceEx, or just get my routine GET_DISK_SPACE from: http://www.neurophys.wisc.edu/ravi/software/diskspace/
-
tolerance :o)Sure, you can try something like:
bool equal(double val) { if(fabs(val) < 0.00000000001) return true; else return false; }
-
Background color of DialogOne way is to override OnCtlColor(), as follows: (1) In your message map, add:
ON_WM_CTLCOLOR()
(2) Then, add the following function to your Dialog class: (replace CMyDialog with whatever is the proper name in your case)HBRUSH CMyDialog::OnCtlColor(CDC *pDC,CWnd *pWnd,UINT nCtlColor) { HBRUSH hbr = CDialog::OnCtlColor(pDC,pWnd,nCtlColor); if(nCtlColor == CTLCOLOR_DLG) { // Dialog background color (Blue) hbr = CreateSolidBrush(RGB(0,0,255)); return hbr; } return hbr; }
You can use this method to change the color of pretty much any element of your dialog. -
error C2065: 'GET_X_LPARAM' : undeclared identifierDid you remember to include: #define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp)) #define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp)) in your file?
-
Help with .EXE fileYou can't see the actual code, just the machine language binary numbers put out by the compiler/assembler/linker. To get a better understanding of what's inside an exe file, see the following article by Matt Pietrek: http://msdn.microsoft.com/msdnmag/issues/02/02/PE/default.aspx http://msdn.microsoft.com/msdnmag/issues/02/03/PE2/default.aspx