|
Chris Hafey wrote:
Just because there is no one algorithm that meets everyones needs doesn't mean there shouldn't be one selected as the default for strings.
True. But it also doesn't mean any algorithm should be selected. It would in a sense be like providing some "black box" less<T> for any type imaginable. Not a pretty sight, especially since less<t> for a hash-value for a string is with almost certainty not the same as its case-sensitive string comparison strcmp() .
Besides, if someone has a need to use a different algorithm, it is just a matter of specifying it at as the third parameter.
A third parameter to ... what?
I'm sure you are aware that predicates are by convention types, and they are given as template arguments at compile time to the class template using them. I've got a "prototype" hash_map implementation from Dinkumware here (the revision before VC7 release I believe). It has got four template parameters. There is also the problem that many implementations (of whatever standard template it might be) are given (or have taken) the freedom to append (default) template parameters to the template parameter list.
I understand the point that for usability there should possibly be a default string-hashing std function, but I also see that this is such a controversial subject that the standard perhaps is better off by not providing a "demo" implementation (remember that many of the std:: techniques are really "demonstrations" of how to do stuff).
Challenging me to proove that 90% of hash tables use strings makes you look like a fool.
It does?
You who stated "especially since >90% of hash tables use strings as keys". Are you really surprised that someone challanged that statement and asked you to back it up? Either you have proof and your statement holds, or you don't have proof.
It might be that I'm a fool sometimes, but I leave it up to you to figure out who can and who can't back their statements up in this case...
Can you honestly say that this is not a reasonable estimation?
Yes. I could also say No and it would possibly be equally true. I just don't know, and neither do you - that's my point.
From my experience it's not true. From your experience it apparently is true, but without some figures to back it up I'd still say "south end of north going 'ru".
Finally I urge you to think about how you responded to this thread.
You're right. I was having a bad day and unfortunately that showed up in my post. It was uncalled for and I apologize.
(Thanks for having a cooler head and not creating a flame-fest of it.)
|
|
|
|
|
I need the code on how to turn my computer off in C++ base programming which the can run on any DOS base system.
|
|
|
|
|
You cannot turn it off, but you can reboot.
From a 16 bit DOS program you can do this :-
void (far* reboot)() = (void (far*)())0xFFFF0000;
(*reboot)();
Hope that helped
Nish
Check out last week's Code Project posting stats presentation from :-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
|
|
|
|
|
You're obviously using new "PC"'s. You'll have to look deeper into ACPI AFAIK.
Best of luck. I don't envy your quest. Should you however find out something useful I hope you'll post a small CP article about it (even that it's not Win32 per se).
|
|
|
|
|
Will WinExec only execute executable files ?
Is there any other function that would call the C++ program when a button is pressed and also will allow me to pass data to the function ?
I am designing a screen in Visual C++. Any help would be appreciated.
Thank you in advance
|
|
|
|
|
All arguments have to be passed in the command line.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Hey Tim , off topic and besides the normal CSTringT discussion that we and others are having at WTL discussion group, I thank you about the tip that interlockedincrement translates to a nop instruction in ST , and I want to ask you where you learned that, you checked the assembly or you did took knowledge by other means ?
Cheers,
Joao Vaz
The Most Unhappy and Frustrated TCL programmer,besides that a Happy guy
|
|
|
|
|
Hey, that was you over there.
I looked at the machine code. Used the debugger to step into the routine.
But it isn't that it is NOPed in a ST program, it is that it is NOPed on a single processor system.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Tim Smith wrote:
But it isn't that it is NOPed in a ST program, it is that it is NOPed on a single processor system.
, I wanted to write that, but my head on this monday isn't at 100% after the weekend
Tim Smith wrote:
Hey, that was you over there
, didn't you discovered ??? The 2nd and further posts have my name and I exchanged some posts with you about this same issue on CP ! Are you joking or are you serious ?
Cheers,
Joao Vaz
The Most Unhappy and Frustrated TCL programmer,besides that a Happy guy
|
|
|
|
|
Heh, I will claim the same weekend clouded brain.
No, actually, I am very very bad with names. I could have sworn your name was spelled differently. But I thought it was you.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Tim Smith wrote:
I will claim the same weekend clouded brain
Tim Smith wrote:
I am very very bad with names
You are not alone on this
Tim Smith wrote:
But I thought it was you
Nice thought .
Cheers,
Joao Vaz
Frustrated TCL programmer,good c++ programmer wannabe
|
|
|
|
|
Along wih the name of the program itself, WinExec can pass an arbitrary number of commandline parameters --these parameters the program has be to be designed to accept. Check CCommandLineInfo for further info on commandline parms, or have a look at standard argc and argv parameters for main -based console apps.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
To pass data to an already running (Windows) program, post the target program a WM_COPYDATA message. See the online docs for more info.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
If you want a window to pop up when you click a button, you need not create a separate program for that. You can add a new dialog to your program and pop that up instead.
But if you insist on having a separate program pop up you can use ShellExecute to pop it up. Or ShellExecuteEx if you want to keep track of your spawned app.
See:- http://www.codeproject.com/useritems/newbiespawn.asp
Passing arguments to the new program is quite easy with ShellExecute/Ex
Nish
Check out last week's Code Project posting stats presentation from :-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
|
|
|
|
|
You must pass data in the command line. you can use 'system' insted of 'winexec'
E.g:-
system ("myapp.exe data1 data2")
Gaurika Wijeratne. // www.gaurika.com
|
|
|
|
|
Hi,
I'm using IVideoWindow to play a video, but I want the video to stop playing as soon as any key is pressed on the keyboard. I read somewhere that you need to use put_MessageDrain() to do this, but I can't get it to recognise my other window to take messages (the other window has been registered but not shown yet)...
Any ideas on how I can get the ActiveMovie Window to close on any key press?
Many thanks for any suggestions,
Keith
|
|
|
|
|
Anybody? This has me totally stumped. Incidentally, I have based my code on the "playit" sample that comes with the Dshow SDK for Directx 6.1.
Thanks,
Keith
|
|
|
|
|
Ambit wrote:
I want the video to stop playing as soon as any key is pressed on the keyboard
If you want it to stop for any key pressed, then I see but two possibilities:
- Implement it as an application that takes care of all keyboard input.
- Hook the global keyboard input handling.
I'm sure you'd be hated for doing the latter.
|
|
|
|
|
Can anyone, give set of instructions to setup a button on a visual screen to execute a (.exe) program. I already have built a .exe.
Couple of questions
1) how to let the button execute this program
2) also how will the button know where the .exe program is. In other words, how do u let the button know the path for this program.
Thank you
M
|
|
|
|
|
Read the FAQ. ShellExecute is what you're after.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
|
|
|
|
|
See http://www.codeproject.com/useritems/newbiespawn.asp
Nish
Check out last week's Code Project posting stats presentation from :-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
|
|
|
|
|
Learning wrote:
a button on Visual C++ to execute a pgm
If you just want some entry on the "IDE" of Visual C++ to execute other executables, here's the instruction:
1) Click the menu of VC++ [Tools]->[Customize...], you would see a dialog "Customize".
2) Choose the third tab "Tools", here it manages what you see in the sub-menu of Tools, like : "Register control", "Visual Component Manager", "Error lookup", etc.
3) There's a "New" button beside the "Delete" button, click it to add a new entry. Just give a name for what you want to execute, ex. "My application 003". Remember the sequence you add.
4) Then you see "Command", that's for specify the target path and filename.
5) Then you switch back to the first tab "Command", choose category "Tools", drag the icon hammer-N out. Thus you get your button!
Maxwell Chen
|
|
|
|
|
try this
void CTestdlgDlg::OnButton1()
{
// Two commands here , Both are working.
// TSys.exe is in applicatin path
WinExec("TSys.exe",SW_SHOWNORMAL);
//In a defferent path
WinExec("F:\\GauShare\\TSys.exe",SW_SHOWNORMAL);
//C++ Command
system("F:\\GauShare\\tsys.exe");
}
Gaurika Wijeratne. // www.gaurika.com
|
|
|
|
|
Hi everybody,
I'm trying to change the frame layout dynamically. But I always get
ASSERT_VALID fails with illegal vtable pointer.
ASSERT_VALID fails with illegal vtable pointer.
HEAP[CADSplitterTest.exe]: Invalid allocation size - C02740D0 (exceeded 7ffdefff)
Warning: Uncaught exception in WindowProc (returning -1).
Warning: Window creation failed: GetLastError returns 0x00000578
Warning: couldn't create client pane for splitter.
by the second call trying a CreateView.
Here's my actual code:
BOOL Im_FrameWnd::SetViewLayout(ViewArrangement NewLayout, CCreateContext* ActContext)
{
if ((NewLayout != m_ViewLayout) || (m_Initialize))
{
if (ActContext == NULL)
{
ActContext = &m_Context;
}
if (!m_Initialize)
m_MainSplitter.DestroyWindow();
int HalfWidth, HalfHeight, ThirdWidth, ThirdHeight;
HalfWidth = HalfHeight = ThirdWidth = ThirdHeight = 10;
switch (NewLayout)
{
case TWOVIEWSVERT:
{
m_MainSplitter.CreateStatic(this,1,2, m_Style, AFX_IDW_PANE_FIRST);
/* CalcSizes(HalfWidth, HalfHeight, ThirdWidth, ThirdHeight);
m_MainSplitter.SetColumnInfo(0, HalfWidth, 10);
m_MainSplitter.SetColumnInfo(1, HalfWidth, 10);
*/
m_MainSplitter.CreateView(0,0, m_ViewClass, CSize(HalfWidth,HalfHeight), ActContext);
m_MainSplitter.CreateView(0,1, m_ViewClass, CSize(HalfWidth,HalfHeight), ActContext);
}
break;
case TWOVIEWSHOR:
{
m_MainSplitter.CreateStatic(this,2,1, m_Style, AFX_IDW_PANE_FIRST);
/* CalcSizes(HalfWidth, HalfHeight, ThirdWidth, ThirdHeight);
m_MainSplitter.SetRowInfo(0, HalfHeight, 10);
m_MainSplitter.SetRowInfo(1, HalfHeight, 10);
*/
m_MainSplitter.CreateView(0,0, m_ViewClass, CSize(HalfWidth,HalfHeight), ActContext);
m_MainSplitter.CreateView(1,0, m_ViewClass, CSize(HalfWidth,HalfHeight), ActContext);
}
break;
/* case THREEVIEWSTWOLEFT:
SplitColumn(myRect.Width()/2);
DeleteView(0,0);
BuildChildSplitter(2,TRUE);
/*
m_HelpSplitter1 = new CSplitterWnd();
m_HelpSplitter1->Create(this,1,2, CSize(10,10), NULL,WS_CHILD | WS_VISIBLE, AFX_IDW_PANE_FIRST+10);
CreateView(0,0, NULL);
break;
case THREEVIEWSTWORIGHT:
break;
case THREEVIEWSTWOTOP:
break;
case THREEVIEWSTWOBOTTOM:
break;
*/ case FOURVIEWS:
{
m_MainSplitter.CreateStatic(this,2,2, m_Style, AFX_IDW_PANE_FIRST);
/* CalcSizes(HalfWidth, HalfHeight, ThirdWidth, ThirdHeight);
m_MainSplitter.SetColumnInfo(0, HalfWidth, 10);
m_MainSplitter.SetColumnInfo(1, HalfWidth, 10);
*/
m_MainSplitter.CreateView(0,0, m_ViewClass, CSize(HalfWidth,HalfHeight), ActContext);
m_MainSplitter.CreateView(0,1, m_ViewClass, CSize(HalfWidth,HalfHeight), ActContext);
/* m_MainSplitter.SetRowInfo(0, HalfHeight, 10);
m_MainSplitter.SetRowInfo(1, HalfHeight, 10);
*/
m_MainSplitter.CreateView(1,0, m_ViewClass, CSize(HalfWidth,HalfHeight), ActContext);
m_MainSplitter.CreateView(1,1, m_ViewClass, CSize(HalfWidth,HalfHeight), ActContext);
}
break;
/* case FOURVIEWSTHREELEFT:
break;
case FOURVIEWSTHREERIGHT:
break;
case FOURVIEWSTHREETOP:
break;
case FOURVIEWSTHREEBOTTOM:
break;
*/
default:
{
DWORD TempStyle = WS_CHILD|WS_VISIBLE|WS_BORDER|SPLS_DYNAMIC_SPLIT;
m_MainSplitter.Create(this,2,2, CSize(10,10), ActContext, TempStyle, AFX_IDW_PANE_FIRST);
if (!m_Initialize)
{
m_MainSplitter.CreateView(0,0, m_ViewClass, CSize(HalfWidth,HalfHeight), ActContext);
m_MainSplitter.CreateView(0,1, m_ViewClass, CSize(HalfWidth,HalfHeight), ActContext);
m_MainSplitter.CreateView(1,0, m_ViewClass, CSize(HalfWidth,HalfHeight), ActContext);
m_MainSplitter.CreateView(1,1, m_ViewClass, CSize(HalfWidth,HalfHeight), ActContext);
}
}
break;
}
m_ViewLayout = NewLayout;
RecalcLayout();
}
if (m_Initialize)
m_Initialize = FALSE;
return (TRUE);
}
BOOL Im_FrameWnd::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
m_Context.m_pNewViewClass = pContext->m_pNewViewClass;
m_Context.m_pCurrentDoc = pContext->m_pCurrentDoc;
m_Context.m_pNewDocTemplate= pContext->m_pNewDocTemplate;
m_Context.m_pLastView=NULL;
m_Context.m_pCurrentFrame=this;
m_ViewClass = pContext->m_pNewViewClass;
return SetViewLayout(m_ViewLayout, pContext);
}
Since this is my first trial with CSplitterWnd I don't find the error exactly (I'm afraid it's
my CRuntime Class - but I'm not sure.
Studying the examples brings no help because they only create the layout at generation.
Best regards,
Patrik Müller
|
|
|
|
|
OK - I've found my errors!!
Best regards,
Patrik Müller
|
|
|
|
|