|
HI,
timeSetEvent() creates and works in a new thread. So your understanding is correct. But the documentation doesnt says anything about its priority. If the CPU has some other processes more prior to this logically it will not trigger at that moment. There other options like WaitableTimer().
regards,
Sankaran
|
|
|
|
|
He was asking about timeSetEvent(), not WM_TIMER.
|
|
|
|
|
yes, I am asking multimedia timer, which Microsoft claims an "accurate" timer
|
|
|
|
|
How to run db-library programs in Visual Studio?
what changes are required to DB Library in VS?
|
|
|
|
|
how to delete a directory which has sub-directories and files directly?
thanks
includeh10
|
|
|
|
|
Hi,
See this article in CP..
http://www.codeproject.com/file/removefiles.asp
all the best
anju
|
|
|
|
|
it is still to delete files first in a loop ...
includeh10
|
|
|
|
|
|
::SHFileOperation()
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
BOOL ClearDirectory(const char *path, BOOL recurs, BOOL deldirs)
{
if(!path)
return FALSE;
char xpath[512]="";
strcpy(xpath,path);
HANDLE hFile;
WIN32_FIND_DATA findData;
BOOL Go=TRUE;
char fullp[500]="";
char pattern[500]="";
if(xpath[strlen(xpath)-1]!='\\')
strcat(xpath,"\\");
if(!IsDirectory(xpath))
return FALSE;
strcpy(pattern,xpath);
strcat(pattern,"*.*");
hFile=FindFirstFile(pattern,&findData);
while((hFile!=INVALID_HANDLE_VALUE)&&(Go))
{
if((strcmp(findData.cFileName,".")!=0)&&(strcmp(findData.cFileName,"..")!=0))
{
strcpy(fullp,"");
sprintf(fullp,"%s%s",xpath,findData.cFileName);
if(IsDirectory(fullp))
{
ClearDirectory(fullp,recurs,deldirs);
strcat(fullp,"\\");
if(deldirs)
RemoveDirectory(fullp);
}
else
{
SetFileAttributes(fullp,128);
DeleteFile(fullp);
}
}
ZeroMemory((void*)&findData,sizeof(findData));
Go=FindNextFile(hFile,&findData);
}
FindClose(hFile);
if(deldirs)
RemoveDirectory(xpath);
return TRUE;
}
be nice an rate me !
be cool
I am the mighty keeper of the book on knowledge . Contact me to get your copy .
|
|
|
|
|
I have a USB device install procedure ready to go, but it relies on the user pressing cancel to the new hardware wizard when it comes up on insertion of the device.
Is there any way to stop the wizard coming up temporarily in code, or is there a way to grab onto the wizard handle and closing it via my program?
Cheers,
Dave
Cheers,
Dave
|
|
|
|
|
I know this isn't the best way of doing what your tring to do but it should work...
Note, I did't compile this so I may have mistyped something.. I think you get the idea.. Get a pointer to the other window and tell it to close (Only if you can find the window)...
CWnd *pOtherWnd = CWnd::FindWindow(NULL,_T("Window Title of the Wizard.."));
if(pOtherWnd)
pOtherWnd->SendMessage(WM_QUIT,0,0);
Rob
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
how to get directory of start menu programmatically?
the directory includes 'group name' as its sub-directory.
in win95, the directory is under windows directory.
in win2k, it is out of windows directory, i.e. c:\documents-and-settings.
my purpose is to add 'group name' and links to the directory vs install and delete them vs uninstall directly.
thanks
includeh10
|
|
|
|
|
Call SHGetSpecialFolderPath() and use CSIDL_COMMON_STARTMENU or CSIDL_STARTMENU depending on whether you want to add your group for all users or just the current user.
--Mike--
THERE IS NO THERE IS NO BUT THERE IS
MAGIC PIXIE DUST BUSINESS GENIE CODE PROJECT
Homepage | RightClick-Encrypt | 1ClickPicGrabber
|
|
|
|
|
|
I need to measure the execution time of my programs under DOS but I don't know how to do it with Borland C++ compiler. With Microsoft C++ compilers is easy to measure the running time using the function GetTickCount() that returns the time since windows started. But now I want to compile them with Borland C++ and run under DOS.Any ideas?
Thank you for your help.
|
|
|
|
|
by "running in DOS" do you mean the old DOS like 6.x or 7.x (or older) or simply a console mode program in win32?
If it's just a console mode program, then just #include "windows.h" and use the GetTickCount() function - GetTickCount() is part of the Win32 API and should work fine in Borland (assumming you are linking to Win32 libs). If this is not the case then try using the C run time's time() function
|
|
|
|
|
I don't know exactly wich version of DOS I am using.I have Windows 98 installed and what I am doing is just go to the shut down menu,sellect 'Restart under DOS' and then find my .exe file and run it. I tried to use GetTickCount() but I was taken link errors(not compiler errors) when building the .exe file.So the next thing I am going to try is to use time() function as you suggested. Thank you very much for your help.
|
|
|
|
|
The function is clock() in <time.h>. It returns the number of clock ticks since program start. To determine the execution time in seconds divide the value returned by clock by the value of the macro CLK_TCK which defines the number of
clock ticks per second.
|
|
|
|
|
int i;
char a[10][10];
for ( i= 0; ; i++) {
if (scanf("%s",a[i]) == -1) break;
}
//ctrl-d or z do not work!
|
|
|
|
|
Does it have to be scanf()? Otherwise you could gets(), which terminates at Ctrl+Z:
int i = 0;
char a[10][10];
while (gets(a[i]) != NULL) {
i++;
}
|
|
|
|
|
After ctrl+z, I have to use enter. Is it expected?
|
|
|
|
|
Yes. If you don't want to wait for enter, you should read one character at a time, e.g. getchar().
Example from MSDN:
<br />
<br />
#include <stdio.h><br />
<br />
void main( void )<br />
{<br />
char buffer[81];<br />
int i, ch;<br />
<br />
printf( "Enter a line: " );<br />
<br />
<br />
for( i = 0; (i < 80) && ((ch = getchar()) != EOF) <br />
&& (ch != '\n'); i++ )<br />
buffer[i] = (char)ch;<br />
<br />
<br />
buffer[i] = '\0';<br />
printf( "%s\n", buffer );<br />
}
|
|
|
|
|
ShowCursor can only hide cursor in caller window, how to hide cursor anywhere?
|
|
|
|
|
I've looked all over to try and find an example of how to place a graphic in the top right of a menu like Internet Explorer but haven't been too sucessful. The closest I came was an article on Code Project, Insert Your Logo between caption bar and menu bar http://www.codeproject.com/menu/menuicon.asp. I'm hoping someone can point me in the right direction or provide example code on how to do so.
Thanks
|
|
|
|