|
It sounds like it IS a server. If you want to only have one copy of the .exe running with multiple connections you have to specify it in the registration.
hRes = _Module.RegisterClassObjects(CLSCTX_LOCAL_SERVER,
/*REGCLS_MULTIPLEUSE*/REGCLS_MULTI_SEPARATE | REGCLS_SUSPENDED);
I thought REGCLS_MULTILEUSE (which is the wizards default) caused the app to be resused for each instance of its components. In fact, the correct option is REGCLS_MULTI_SEPARATE.
Good luck,
Bill
|
|
|
|
|
Yes, it is the server.
And no, it's not the correct option, because it keeps creating a new instance.
I think i'm gonna put the interfaces in some separated dll.
For your effort, thanx!
rechi
|
|
|
|
|
Probably a good idea, I don't know what else you might be doing wrong. that parameter changed fixed the problem for me. Sounds like in process components is a better architecture for what you want to do anyway.
Good Luck,
Bill
|
|
|
|
|
I have a situation with an edit box when the user types in an existing code, data is displayed in subsequent fields. If they type in a new number, I clear the data in the subsequent fields. The populating/clearing of the subsequent fields is triggered in the KillFocus callback of the edit box. The problem is, there are pushbuttons, like Save, Close, which now will clear the data, since moving focus out of the edit box by pressing the Close button invokes the KillFocus callback.
Is there a way in the KillFocus callback to know that a press of one of the pushbuttons is in the message queue so I can process this case differently?
Thanks in advance,
Bob
|
|
|
|
|
OnKillFocus provides also the CWnd to be given the focus. You can check whether this corresponds to one of your special buttons.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I tried to do this, but I don't understand what is happening. When tabbing off of the Edit box, CWnd is a value of 12b89c, CWnd hWnd is 180bd4. If I press one of the 3 pushbuttons, the values are 12b748 and 180bd4 respectively. None of these values match the CWnd value I get returned when calling GetDlgItem(PushButtonId) for each of the pushbuttons. So how do I match the CWnd value I get in the callback with the pushbuttons?
Thanks,
Bob
|
|
|
|
|
Oh well, I've tried in a small test app, and the CWnd passed to OnKillFocus seems to be that of the parent dialog. So I'm afraid this approach does not work. Sorry.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
OK, that explains what I was seeing. Is there anyway to get the ID of the control that is about to receive focus when in the OnKillFocus?
Thanks,
Bob
|
|
|
|
|
Have you tried seeing what GetFocus(...) and GetNextDlgTabItem(...) return?
Also, remember that if you call any functions that return a CWnd object, like GetFocus(...) , you will be getting a temporary CWnd (actually a CTempWnd ) object unless you have already "bound" a class to the control in question. What that means that when in doubt, compare the value of the m_hWnd member to see if you have a certain control.
Peace!
-=- James.
"Fat people are hard to kidnap."
(Try Check Favorites Sometime!)
|
|
|
|
|
GetFocus() does the trick, Thanks!
Bob
|
|
|
|
|
Hello,
i just wanted to ask if somebody can tell me how i can change the font size in a dialog box and in a textfield.
TIA
Charly
|
|
|
|
|
Use the visual dialog editor? First page of the properties dialog press the change font button?
Or use CWnd::SetFont or CWindow::SetFont
|
|
|
|
|
How can I use the hWnd of a property page?
I created a CPropertyPage object in a thread (using new) and then used PostMessage() in order to call AddPage(CPropertyPage) from the main app thread.
But then, I couldn't make any use of hWnd of that CPropertyPage,IsWindow(CPropertyPage->m_hWnd) returns false. PostMessage(msg,CPropertyPage->m_hWnd) and even CPropertyPage->UpdateData() fails (debug assertions).
I need to use it this way, because I just wanted to have a set of dialogs
groupped in property pages. I need to access the hWnd to use with PostMessage and WSAASyncSelect (as it will receive network notification) How can I do that? Maybe I am doing something wrong ?
thanks for any help
|
|
|
|
|
OK I know why it happens... it's because MFC postpones creation of a window until it's tab is selected by a user...
Is there any possiblity to overcome that ie. to force mfc to create that window earlier and not wait for user selection ?
|
|
|
|
|
lookig into source i see something like this used in another case but maybe it is what you need
t!
BOOL bResult = CPropertySheet::OnInitDialog();
int ActPage = GetActiveIndex();
for(int i = 0; i < GetPageCount(); i++)
SetActivePage(i);
SetActivePage(ActPage); //return back
|
|
|
|
|
This should work, but I'm afraid that the swap of active pages will be visible to the user (as this has to take place during runtime, and I think this code was used before the creation of CPropertySheet).
Why did they prevent that stupid window from creating during AddPage ?
anyway thank you, I will be trying...
|
|
|
|
|
Hi,
How can i get the total amount of memory used by a process at any given time?
I know about GetProcessWorkingSetSize, but this works only on Winnt and not
9x systems, also this function will give only the max and min usages.
|
|
|
|
|
Hello,
What should one use:
memset or FillMemory / ZeroMemory
memcpy or CopyMemory etc.?
I assume the Win32 memory functions are faster, but how much?
Best regards,
Alexandru Savescu
|
|
|
|
|
If you plan to port your code to other systems, use CRT functions else call the API as that's what CRT functions do eventually.
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Nish - Native CPian wrote:
else call the API as that's what CRT functions do eventually.
Not always, may I add
I was thinking of the thread functions mostly.
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Thanks Nish,
I do not plan to port my code (obviously), all I am interested in is the performance, especially speed. Any idea?
Best regards,
Alexandru Savescu
|
|
|
|
|
I assume the Win32 memory functions are faster, but how much?
Actually, FillMemory and colleagues are macros for memset These are not real Win32 functions, but rather they're resolved usually as inline code.
Apart from this, Mish wisely pointed out the convenience of not using platform-specific APIs if they're are so easily avoidable as these.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Ok, thanks, I thought there were somehow "more built in" in the OSs architecture.
Best regards,
Alexandru Savescu
|
|
|
|
|
Joaquín M López Muñoz wrote:
Mish wisely pointed out
Mish????
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Oh, forgive the typo I was talking about you, of course.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|