|
1. The notification is done only by window handle. For SendMessage, you should use something like
GetParent()->SendMessage(WM_COMMAND, wParam, (LPARAM)GetSafeHwnd());
2. It could examine the control ID, assuming you know at runtime which IDs are associated with each kind of button. The virtuality of OnTimer won't help. The sink (target) for the message must be able to work it out itself.
Steve S
|
|
|
|
|
Steve S wrote:
GetParent()->SendMessage(WM_COMMAND, wParam, (LPARAM)GetSafeHwnd());
I Initially had that, but figured sending a generic window handle to my parent wouldn't allow me to use RTTI Unless I has code in my parent class that would create the appropriate object (CSecond or CThird) and attach the windows handle. Not quite the solution I wanted. I think i'll just use command ID's
Thanks again
Cheers
I'm drinking triples, seeing double and acting single
|
|
|
|
|
There is a posibility that you can get the runtime class infromation and access that.
CWnd *pWnd = GetDlgItem(pMsg->wParam);
if (pWnd->GetRuntimeClass() == CFirst::GetRuntimeClass())
{
}
This will mean using the IMPLEMENT_DYNAMIC and DECLARE_DYNAMIC macros in yout CFisrt, CSecond and CThird classes
Roger Allen
Sonork 100.10016
Death come early, death come late,
It takes us all, there is no reason.
For every purpose under heaven,
To each a turn, to each a season.
A time to weep and a time to sigh,
A time to laugh and a time to cry,
A time to be born and a time to die.
Dust to dust and ashes to ashes,
And so I end my song.
|
|
|
|
|
Generally, this will only work if you have actual MFC objects corresponding to the windows themselves, since left to it's own devices, GetDlgItem() will return back either the permanent object associated with an HWND, or a temporary CWnd object. You don't, for instance, get a CButton* back if you use
GetDlgItem(IDOK)
unless you've associated one with the dialog item.
In the scenario outlined, of course, it should be OK.
Steve S
|
|
|
|
|
I have a app that I want to restore the state, like location and size.
Where can I find info on how to do this? I am saving the RECT from
GetWindowRect to the registry if not IsIconic. But what about Maximized?
And if it is Maximized how and where do I resotre this during startup?
Thank You
Bo Hunter
|
|
|
|
|
See CWnd::GetWindowPlacement() and CWnd::SetWindowPlacement() .
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
I need to invoke a common dialog so the user can select folder NOT files. Should I use the open common dialog or is there something else for this (some applications eg. Visual Studio) have these dialogs that list only folders.
|
|
|
|
|
|
Yep, that's what I was looking for. My problem is that I need to get the full path of the folder not just it's name and the BROWSEINFO struct doesn't have a member for that...what is the workaround here?
|
|
|
|
|
See this article and use the SelectFolder() method. And while you're there, rate Davide's article a 5. It deserves it.
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Perfect...it earned it's 5 star rating.
|
|
|
|
|
|
I need to take the letter A (in upper case) and increment it using ++ to B,C,D,E,F, etc. How do I do this?
"I am the First, the Last, the Alpha and Omega."--Jesus Christ
|
|
|
|
|
char cExample = 'A';
cExample++;
|
|
|
|
|
Thanks! I'm a dumb noob! I was using "A" instead of 'A'
"I am the First, the Last, the Alpha and Omega."--Jesus Christ
|
|
|
|
|
i'm surprised it compiled that way.
|
|
|
|
|
I need a CArray-compatible template for the GCC compiler. I've decided to rewrite an original CArray, but received a "corrupted stack" error during destruction of the array. Please help me.
|
|
|
|
|
My worst nightmare - a port of CArray. Why not convert to std::vector instead ? Or if you must attempt this atrocity, write a class that contains a vector and presents a CArray compatible interface.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Hi,
I wrote a console application.In this I want to read a file and write into another file.The first number in the input file gives the number of characters in the file.
My program is as follows:
char ch;
int i=0,n,j=0;
char data[9];
FILE *fp=fopen("input.txt","r");
FILE *fp1=fopen("output.txt","w");
fscanf(fp,"%d",&n);
while(j<=n)
{
j++;
ch=fgetc(fp);
fprintf(fp1,"%c",ch);
}
fclose(fp);
fclose(fp1);
Input file on which it is not working:--
160 e‘Ünýv¾§–yDBwŠÑûhŠ[ŠÑûhŠ[ŠÑûhŠ[ŠÑûhŠ[ŠÑûhŠ[ŠÑûhŠ[ŠÑûhŠ[±³~%IШƻѡ¸#M$=¹»z÷Ê‚ÉyÀ¨fza÷Aœ,®áÀŽ¥L”vP_üã†ÉÖU´¥šÁ×ÕVI¶÷kúÎEu„~:
†í•BØ
hmg¸
Output file given:--
e‘Ünýv¾§–yDBwŠÑûhŠ[ŠÑûhŠ[ŠÑûhŠ[ŠÑûhŠ[ŠÑûhŠ[ŠÑûhŠ[ŠÑûhŠ[±³~%IШƻѡ¸#M$=¹»zÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
Please help me in finding out the problem
Karteek
|
|
|
|
|
Change
FILE *fp=fopen("input.txt","r");
FILE *fp1=fopen("output.txt","w"); to
FILE *fp=fopen("input.txt","rb");
FILE *fp1=fopen("output.txt","wb");
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
How large should and exe file be. A have a program that's currently pushing 1.21 MB and will only get bigger. Is it better if I start putting some code into dll's for better load time at startup? What are the pro's and cons of using dll's?
|
|
|
|
|
Under Windows NT and its successors, the size of the .EXE really doesn't matter. Windows uses the processor's paging mechanism to load pages out of the .EXE as needed.
Also, unless you load your DLL's 'manually' using LoadLibrary and GetProcAddress , DLL's are loaded implicitly. This means that they essentially get loaded with you .EXE when it starts. For that reason, breaking code out into DLL's isn't going to help your startup time.
Given that your .EXE is only 1.21MB, I wouldn't bother worrying about the load time.
Software Zen: delete this;
|
|
|
|
|
For that reason, breaking code out into DLL's isn't going to help your startup time.
... unless you are using DELAYLOAD linker switch.
"...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
Me
|
|
|
|
|
True, but given the tone of the question, I didn't think delay loading was an issue.
Software Zen: delete this;
|
|
|
|
|
This time I don't make too many iterations or so through the array. Now in the first iteration it crashes when I delete:
for(int i = 0; i < m_nCount; i++)
{
char* lowercase = new char[strlen(m_pStack[i])];
strcpy(lowercase, m_pStack[i]);
_strlwr(lowercase);
if(strcmp(keyword, lowercase) == 0)
{
ret = i;
break;
}
delete [] lowercase;
}
Rickard Andersson
Here is my card, contact me later!
UIN: 50302279
Sonork: 37318
|
|
|
|