|
Very good answer. +5.
Thanks very much.
|
|
|
|
|
You are welcome.
Veni, vidi, vici.
|
|
|
|
|
Traitor.
"Real men drive manual transmission" - Rajesh.
|
|
|
|
|
Veni, vidi, vici.
|
|
|
|
|
Some compilers may complain (warning level of course) for the semicolon after the {}. do-while does not have that problem.
|
|
|
|
|
Hi I'm trying to get this to work, but I'm not sure how to get the right syntax.
template <int N>
double array_sum(double * var[N], int n, double (*f)(double var[N])) {
double ret 0.0;
for (int i = 0; i < n; ++i) {
ret += f(args);
}
return ret;
}
double mul(double var[3]) {
return var[0] * var[1] * var[2];
}
int main() {
double * length = new double[10];
double * width = new double[10];
double * height = new double[10];
array_sum({length, width, height}, 10, mul);
delete [] length;
delete [] width;
delete [] height;
return 0;
}
The function should give the volume of the described element, but vstudio says that no template matches the given data.
Thanks in advance,
G
Hah, ok I solved it, and yeah there are some syntax arguments in this, but I'll still leave this open to the group to have fun with.
modified 11-Apr-12 20:03pm.
|
|
|
|
|
Since you solved it I'm not going to try this out, but to me it seems the compiler has no way to figure out the value of the template parameter N in your code. It might work if you pass that parameter explicitely, as in
array_sum<10>(...);
Besides you don't pass the right arguments to that function pointer - and I'm not just referring to the unspecified identifier args , but also the parameter list.
On a sidenote, unless this is an exercise in learning the use of templates, that looks like an extremely complicated, awkward, and error-prone way to do some very simple calculations.
|
|
|
|
|
Say there are alot of rows and you only want to show the rows that meet a specific criteria. Is there a way to do that?
|
|
|
|
|
Are you asking something regarding the Ultimate Grid Tool. If yes, then please send a query to the Author of the article. You just go to the bottom part of the Article and you can click on new message. Ask your query there. The author will respond to your query.
Every new day is another chance to change your life.
|
|
|
|
|
I also want to know If I can Hide some rows. I did it by saving all data in a dynamic memory and adding only the desired row in to list
|
|
|
|
|
HI,
I need to migrate my Visualstudio 2008 win 32 Dll creation application to Visual Studio 6. Please suggest some tips or mention where i can get information to migrate it.
Thanks,
Krishna
|
|
|
|
|
|
|
I installed VC++ 6.0 on Windows 7 Ultimate x64.
Sometimes when I debug the MFC program, I press Shift+F5 to terminate the debug, but the program shows "not responding" and VC++ 6.0 IDE shows normally.
Then I want to kill the progress with Task Manager, but failed. I try to terminate the progress in CMD with administrator permission, still failed. Then, I download ProgressExplore.exe from Microsoft's site, and pskill.exe. I just can't terminate the disgusting progress.
When I log of Windows, the Progress can be killed and when I close VC++ 6.0 IDE, the progress automatically terminated. But as you know, it's miserable to debug programs in this way: debug one time, close the VC++ IDE one time.
Anyone can tell me how to force to kill the specific progress with overwhelming permission(just like Windows did when close or log off)?
Thank you in advance!
|
|
|
|
|
It might be better to look at your code and try to determine how your program gets into this state. Do you have a closed loop somewhere, or a process wait that cannot be stopped?
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
No, I think this is the issue of incompatibility(Win7 X64 and VC6.0).
|
|
|
|
|
Falconapollo wrote: No, I think this is
Fine, now you need to do some testing to confirm it.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
did you try
taskkill /f /t /im devenv.exe
to make sure you kill the child process/app?
|
|
|
|
|
It does't work. I only want to terminate the debugged app, not VC6.0 IDE.
Thank you all the same!
|
|
|
|
|
Falconapollo wrote: Sometimes when I debug the MFC program, I press Shift+F5 to terminate the debug, but the program shows "not responding" and VC++ 6.0 IDE shows normally.
When you are debugging, on process tree debugging app is the child of the MSDEV. could you please check at what exact location it is not responding is it any hardware call or IO call!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
When debugging program with VC6.0, the debugged app process attach VC6.0. And the process is the child of MSDEV.exe. But when I press Shift + F5 to stop debugging, VC6.0 CANNOT terminate the app.
ProcessExplorer can't terminate the app, either.
*.exe wWinMainCRTStartup(found by click properties in ProcessExplorer).
I want to terminate the app, not VC6.0!
Thanks for you reply! Any help?
|
|
|
|
|
Hi,
Visual Studio 6 is completely unsupported on Vista+ operating systems. There are literally dozens of incompatibilities so I do not know what is causing your IDE to hang. If I had to guess... I would guess that the operating system is waiting on an I/O request to complete. Probably because the VC6 IDE is calling DeviceIOControl after or during the termination/detachment of the debugger resulting in a race condition. In these hangs... TerminateProcess does not succeed because the system is infinitely waiting on an I/O cancellation. The I/O cancellation will never succeed because the process was partially deleted and no longer has any allocated address space (which contained the information required for I/O cancellation!).
Anyway it doesn't relly matter why it is hanging... you should be running VC6 in XP Mode[^] on Vista+ operating systems. If you don't want to run the VC6 IDE in XP mode... don't worry your not alone. I also do not run it in XP mode. Instead I use the IDE for writing code and then I use WinDbg[^] for debugging the code.
If the application you are building will be used on Vista+ operating systems... you should consider upgrading your compiler so you can take advantage of /GS stack cookies[^] , /SAFESEH[^] and integrity levels.
Best Wishes,
-David Delaune
|
|
|
|
|
Thank you very much!
You did solve my problem! And I think your suggestions are very good.
|
|
|
|
|
Nice answer
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
The following piece of code was working fine in VC++6.0 . When UAC was enabled/disabled , for an administrative user the IsUserAdmin was returning true. We are migrating VC++6.0 to VS2010. After this when UAC is enabled IsUserAdmin is returning false and when UAC is disabled IsUserAdmin is returning true. Why is this failing in VS2010 when UAC is enabled and what could be fix for this.
BOOL IsUserAdmin(VOID)
/*++
Routine Description: This routine returns TRUE if the caller's
process is a member of the Administrators local group. Caller is NOT
expected to be impersonating anyone and is expected to be able to
open its own process and process token.
Arguments: None.
Return Value:
TRUE - Caller has Administrators local group.
FALSE - Caller does not have Administrators local group. --
*/
{
BOOL b;
SID_IDENTIFIER_AUTHORITY NtAuthority = SECURITY_NT_AUTHORITY;
PSID AdministratorsGroup;
b = AllocateAndInitializeSid(
&NtAuthority,
2,
SECURITY_BUILTIN_DOMAIN_RID,
DOMAIN_ALIAS_RID_ADMINS,
0, 0, 0, 0, 0, 0,
&AdministratorsGroup);
if(b)
{
if (!CheckTokenMembership( NULL, AdministratorsGroup, &b))
{
b = FALSE;
}
FreeSid(AdministratorsGroup);
}
return(b);
}
Thanks in advance
|
|
|
|