|
yes it is the same.the value of command is "netsh interface ip set address name="Local Area Connection" satic 192.168.168.110 255.255.255.5 192.168.168.168. but it havent set the ipaddress
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
deeps_cute wrote: netsh interface ip set address name="Local Area Connection" satic 192.168.168.110 255.255.255.5 192.168.168.168
Can you issue this at a command prompt?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I need to make my toolbar active by default in explorer after setup.
Johny
|
|
|
|
|
In single-thread application
------------------------------
SetTimer(hwnd, 1, 10, (TIMERPROC) NULL); <br />
<br />
... OnTimer(...)<br />
{<br />
Fun();<br />
}<br />
<br />
void fun()<br />
{<br />
......<br />
} ------------------------------
If fun() run slow, fun() will read write global variable, need like multiple-thread add read-write lock? This example use EnterCriticalSection, LeaveCriticalSection or which API function best?
If fun() not read write global variable, when it will use lock and unlock?
thanks.
|
|
|
|
|
mfc_dialog wrote: In single-thread application
...
need like multiple-thread add read-write lock?
I don't really understand what you mean, it's not clear to me whether your application is single-threaded or multi-threaded.
As always when different threads are accessing the same data the threads have to be synchronized. Using ::EnterCriticalSection() and ::LeaveCriticalSection() is a good choice.
If your application is single-threaded there's no need for thread synchronization since all data will be both read and written by the one and only thread.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Is it true that VS6 doesn't allow you to use template member functions in a non-template class? I keep getting a "C2893: Failed to specialize function template" error.
|
|
|
|
|
Steve_Harris wrote: C2893:
I think, this error is part of post VS6 compilers. Can you show code, causing this error ?
This error occurs if, compiler cannot instantiate any of template type.
|
|
|
|
|
the VS6 compiler is far from beeing a recent compiler, and I would not be surprised that it will not support some more modern constructs like those.
|
|
|
|
|
I believe MSVC6 allows this. Can you post the code in question?
Steve
|
|
|
|
|
HI all
I have a piece of code in C which fails . This function tries to open a .wav file ..
The function is
int audio_file =open(filename,flag,AUDIO_PERMISSION);
if(audio_file<0)
{
\\ ...failure to open file so restart the CPU
}
The return value as defined in errno.h is EMFILE=24 => "Too many files opened"
What could be the reason for this failure and how to prevent it ? This problem has not been reproduced by me but only at a customer's site .
Can anyone please help me ?
redindian
|
|
|
|
|
dharani wrote: The return value as defined in errno.h is EMFILE=24 => "Too many files opened"
What could be the reason for this failure...
Too many open files.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
dharani wrote: What could be the reason for this failure and how to prevent it ?
Are you sure you close the file in all code paths after you are done with it?
|
|
|
|
|
You could possibly prevent it by using CreateFile and tracking window handles instead of using open, which has a smaller number of open files constraint on it.
Also, does the customer have any kind of quotas in force? Perhaps 'too many open files' is in response to some other error the process encountered while trying to open the file?
|
|
|
|
|
Hi Blake
I can not use CreateFile as the code is done in a linux environment - we use GCC.
What do you mean by 'open file constraint' ? Can you please eloborate it ?
Blake Miller wrote: Also, does the customer have any kind of quotas in force?
What do you mean by 'quotas' - this is the first time I hear this , please tell me more
redindian
|
|
|
|
|
This is the Visual C++ / MFC discussion board, which implies a Windows environment!
Why didn't you tell us you are working i Linux? Here, people has been trying to figure out a reason why this happens in a Windows machine!
A guick google search[^]gave me 84000+ responses.
Try it.
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
I had assumed Windows operating system. An administrator can enforce quotas on user accounts - how much disk space used, how much memory allowed for process, etc. Any one of these could have caused your files to fail to open.
Typically, there is an interna table int he C runtie libraries that has a limited number of entries for mapping 'c' file handles to the OS internal data. Once you use up all these entrries - no more open files!
|
|
|
|
|
Have you tried scaling this down to a more manageable problem? Something like:
char szFile[256];
for (int x = 0; x < 100; x++)
{
sprintf(szFile, "Test%03d", x);
if (open(szFile, ...) == -1)
{
printf("Failed after opening %d files\n", x);
break;
}
} Now when open() fails, note the value of x .
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi
How will i disable CD drive. some code would be helpful.
with regards
RYK
|
|
|
|
|
You can disable/enable CD drive by editing registry.
In order to disable CD drive:
RootKey=HKEY_LOCAL_MACHINE
Key to open: "SYSTEM\\CurrentControlSet\\Services\\cdrom"
WriteInteger("Start",4)
Start is the name of REG_DWORD value, and 4 is the proper data for that value
In order to enable CD drive:
RootKey=HKEY_LOCAL_MACHINE
Key to open: "SYSTEM\\CurrentControlSet\\Services\\cdrom"
WriteInteger("Start",1)
Start is the name of REG_DWORD value, and 1 is the proper data for that value
Your application has to have administrator privileges
I've tried it with Windows 2000 and it worked
|
|
|
|
|
Through code you can do this way,
HANDLE hfile;
PREVENT_MEDIA_REMOVAL pm;
DWORD inBytes=sizeof(pm),retBytes=0;
hfile=CreateFile("\\\\.\\E:",GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL); //assuming E: is CD Drive
if(hfile!=INVALID_HANDLE_VALUE)
{
pm.PreventMediaRemoval=TRUE; //set it to FALSE when u want to enable ejection
if(DeviceIoControl(hfile,IOCTL_STORAGE_MEDIA_REMOVAL,&pm,inBytes,NULL,0,&retBytes,NULL))
printf("CD Locked");
else
printf("Failed to lock\n");
CloseHandle(hfile);
}
else
printf("Failed to open handle,Errorcode=%d\n",GetLastError());
|
|
|
|
|
By this way we can lock the CD-Rom(ejection dont work)but i want, ejection work as it is and when i put CD then CD contains should not be read.
some source code would be appreciable
Thanks in advance
RYK
|
|
|
|
|
i need to display ipaddress gateway dns and subnetmask details in a dialog. is there any program to display this.
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
deeps_cute wrote: is there any program to display this
Yes, you can get to it from the Network control panel applet (ncpa.cpl on XP) and Start->Settings->Network Connections on XP.
Are you trying to ask about the APIs to use to get the values so you can show them in your own application in its own dialog?
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
yes i have to use the APIs to get the values and then displaying in corresponding edit box in dialog
-- modified at 8:14 Tuesday 6th March, 2007
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
There are several ways to obtain this information. See here for one such way.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|