|
I have an SDI app where the CMainFrame is broken up with static CSplitterWnds. When I create the view (CKeypadView) with CreateView() it properly passes in the pointer to the CDocument.
m_splRightCol.CreateView( 2, 0, RUNTIME_CLASS(CKeypadView), CSize(0,0), pContext )
When I break when the OnUpdate() is called from the OnInitialUpdate() the pointer now reads NULL. Why?
------------------------------------------------
I am not discouraged because every wrong attempt discarded is another step forward
-- Thomas Edison --
|
|
|
|
|
Hello, the codegurus around the world.;)
OnInitUpdate() function is called a couple of times before acutally
its view is created (?) or is visiable.
So, you must add the validation code to check if some controls in OnInitUpdate() have their own HWND or CWnd (not NULL).
Please, don't send me your email about your questions directly.
Have a nice day!
Sonork - 100.10571:vcdeveloper
-Masaaki Onishi-
|
|
|
|
|
I removed the code that tries to access the CDocument from OnUpdate(), but even when I try to access the document later on (using GetDocument() ), it still doesn't have a pointer to the document. All other views still have a valid pointer.
Make no little plans; they have no magic to stir your blood to action. Make big plans, aim high in work and hope.
-- Daniel Burnham
|
|
|
|
|
I was wondering... is it possible to create an executable (.exe) that has a dll entry-point as well as a normal application entry-point, that is: a WinMain function that would be called when the file is executed, and a DllMain that would be called if the file is loaded by LoadLibrary (or something similar).
Thanks for any info
Enjoy!
Marc
|
|
|
|
|
That is a curious question. I do not know but you could give it a try. Place those and a few other functions in your .exe's code and put "__declspec(dllexport)" in front of them and see what happens. Run "dumpbin /EXPORTS" at a command prompt to see if it really worked.
I do a related thing in my company's product. We often run multiple instances (sometimes dozens) of the same process so I have nearly all of the code in a DLL. The main function for this process looks like this :
int main(int ac, char*av[])
{
return MyLibrary(ac,av);
}
This gives each process minimal memory usage.
|
|
|
|
|
Mark:
A dll and a exe are similar, you can export function from a exe or from a dll, you can make all a application that is in a dll. The diference is that you need to know that you are calling a dll or a exe, because if you are calling a exe, this will be callin the winmain function or other function that you want to determine how entry point, but if you are calling a dll that have a application in, you need to know the ameof the function...
Sometimes I make that, I make a exe and this app, call dll like plugins....
best regards
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
I know, but I was just wondering if it was possible to have both things in one file. Of course, it is possible to export functions from the exe file, but if it needs to be able to initialize itself before these functions are called a DllMain function would be nice in addition to WinMain. (of course, i could call an initialization routine from the exported functions, but that's not as fun )
Actually what I'm trying to do is to make an .exe file which hosts shell extentions This way I would only have to distribute one file, and not an external dll
Enjoy!
Marc
|
|
|
|
|
When I use the menu command
Project>Add to Project>Components and Controls
VS opens the gallery window as it should, but it is empty. No ActiveX controls are listed. I checked the path, and it is opening into the 'Gallery' folder. So, in my attempts to figure out what the heck is up, I tried to add a (known) ActiveX control from my C:\WINNT\SYSTEM32 folder. Visual Studio complained that the control was not registered. So, I fired up the ActiveX Control Test Container to check out what controls are registered. The Test Container listed quite a few controls; all of the controls that should be listed in my Gallery window.
Anyway, as I see it, this all proves one thing...the ActiveX controls are all registered correctly on my computer, but for some reason Visual Studio doesn't know how to find them...any suggestions?
I'm running Windows2000, and I have the latest VS update, for all that's worth. Thank you very much for any help, I'd really like to have this functioning like usual.
~Cam Desautels
|
|
|
|
|
This is a good question. It's happened to me in the past as well and I've never known why. I hope someone has an answer.
Regards,
Alvaro
|
|
|
|
|
Hi Search for the following topic in MSDN,
It might be of some help.
"Reusing Code Topics"
|
|
|
|
|
Yes, i had actually checked out a number of these topics, but I did find something interesting:
The Gallery regenerates links to registered ActiveX controls every time you open it, based on the current state of the registry. This has certain implications:
If you delete a link to a registered ActiveX control, the link will still appear the next time you open the Gallery.
If you delete a registered ActiveX control (.OCX or .DLL file), but do not unregister it, the link will still appear the next time you open the Gallery. Of course the link will be inoperative.
If you copy an ActiveX control to your machine, but do not register the file, the link does not appear because the Gallery does not recognize the control.
...anyway, the important part is that the list is regenerated from the registry. I figured as much, but that doesn't explain the problem...grr...
|
|
|
|
|
I am creating a wizard using VC++ MFC, but I'm having trouble adding a bitmap header to the property sheet. My bitmap gets clipped by the property pages. What is the standard procedure to accomplish this?
Paul Jahans
|
|
|
|
|
If what you want is to allocate a little more space on top of the property sheet, add this snippet on your OnInitDialog() :
CRect rectWnd;
GetWindowRect(rectWnd);
SetWindowPos(NULL, 0, 0,
rectWnd.Width(),
rectWnd.Height() + 100,
SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
CWnd *pWnd=GetWindow(GW_CHILD);
while(pWnd!=NULL){
CRect rect;
pWnd->GetWindowRect(rect);
rect.OffsetRect(0,100);
ScreenToClient(rect);
pWnd->MoveWindow(rect,FALSE);
pWnd=pWnd->GetNextWindow();
}
(Of course you'll want to change the offset to fit the dimensions of the bitmap header.)
Joaquín M López Muñoz
Telefónica, Investgación y Desarrollo
|
|
|
|
|
I have added a Menu Item to Popup default item File. After adding the Coommand Handler, when I run the app, the Menu item that I added appears Grayed. I am not sure why that is happening when the properties are not set to be disabled nor the code is written to do so. What would make the item Enabled or non-grayed by default.
|
|
|
|
|
Well, seems like MFC is not being able to locate the Command handler you wrote for that menu item. You could check if the handler is correct by creating a non popup menu (a fixed menu on the main windows, for instance) and inserting a menu item with the same ID. If the command handler is correct that item should be enabled (and the problem lies elsewhere).
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
When I drag the Item to main bar, it is not grayed. Only when I nest it in the File option, it gets Grayed. I have the OnUpdateYourMenuItem too. Tried adding code to ENABLE the Item and still no luck.
|
|
|
|
|
Do you have a a OnUpdateYourMenuItem(CCmdUI *pCmdUI) handler for this menu item ? If you don't the menu item is disabled by default.
|
|
|
|
|
I did edit the ID few days back but, surprisingly, it doesn't behave that way when I have it at top level. Only when I make it a subitem, or within a popup, it gets grayed for no reason. I rebuild the files but no effect.
|
|
|
|
|
The reason that changes to resource.h do not always result in a recompilation is that VC++ insists on putting a line that says NO_DEPENDENCY at the top of it. I find this incredibly annoying. Why couldn't they make it a selectable option ?
|
|
|
|
|
You are exactly right and that is why it annoys me so much. I have figured out how to play their game though and remove the NO_DEPENDENCY line with a minimum of headache. I do this in nearly every project I work on. With the speed of computers these days I can think of no good reason to have anything NOT dependent on resource.h that uses it. It only causes problems and does provide no benefit.
|
|
|
|
|
Finally I found out the solution. I didn't associate the Menu to Main Frame. Instead I did to one of the views. Surprisingly it let me pick a view.
|
|
|
|
|
Hi.
One of the applications I've coded refuse to work correctly on WinXP (but was working fine for months under Windows 2000). I wonder if someone else notice this kind of problem.
More specificaly, I'm using anonymous pipes to make the two parts of my application communicate, but unfortunately the created process never get the handle of the pipes the main process creates. It results in the fact the the child process get the standard STDIN/OUT/ERR handles when it does GetStdHandle().
[Note: I'm not using CreateProcess, but CreateProcessWithLogonW. I can send a part of the code if it helps.]
|
|
|
|
|
Any body here Know where I can find some documentation about that?
Best Reagrds....
Tomorrow is Friday!!!
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
The foundational paper by Charles Simonyi.
It is my impression that Hungarian notation has fallen into some discredit during the last years, mainly because it promotes a very loose way of type checking. Languages more modern than C (like C++) have stricter type checking systems that render this kind of nmenomics redundant in the best case (or false in the worst, if you changed the type of a variable and forgot to rename it).
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Gracias Joaquin,
Muy util, tu información....
Best Regards!!!!
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|