|
... initialise local variable storage to 0
Not that I have noticed. In fact, Visual C++ 6.0 and .NET 2002 both set unassigned variables to something like 0xCDCDCDCD.
Also in Debug mofe, apart from the preprocessor variable _DEBUG being defined, changes are made to several system functions, including new and delete to help catch problems with memory allocation. Allocated blocks of memory have guard bands around them. All user-written functions have code added at the beginning and end to look for problems.
If you release a Debug build, beware - there is debugging information in the .EXE file, a wonderful opportunity for hackers. Makes life so much easier for people to disassemble your program. Try writing a program that WILL crash, and compile it both in Debug mode and in Releae mode. Run the Release version outside the Visual C++ environment, as if it was an ordinary program being run. When it crashes, the system will offer to help debug it. Accept the defaults offered, and you will find yourself back in Visual C++, wondering what on earth you are looking at. Do the same with the Debug build and you will see the difference.
Note that the checks for unassigned variables are not foolproof, unfortunately. I have sometimes have the Debug version work perfectly, and the Release version of the same code crashes due to unasigned variables not being detected.
Shraddhan
|
|
|
|
|
i have to send messages between two applications. the communication should be synchronised. i.e the sender should wait till it gets a acknowledgement from the receiver. how can i proceed. please help..
|
|
|
|
|
|
To complete Mr Dunn' post, this is a code snippet that may help you. It is an answer to one of my questions on this forum, one or two years ago, where I tried to exchange CStrings between two apps. (Thanks to jhwurmbach and peterchen).
Another option is a WM_COPYDATA message. You will receive a copy of the data (but this is valid only while the message is processed, so create your own copy on the client side)
for a CString:
Sender:
CString myString = ...
COPYDATASTRUCT cds;
cds.dwData = 0;
cds.cbSize = (myString.GetLength()+1) * sizeof(TCHAR);
cds.lpData = (LPCTSTR) myString;
::SendMessage(hwndReceiver, WM_COPYDATA, (WPARAM) hwndSender, (LPARAM) &cds);
Receiver - WM_COPYDATA handler:
HWND sender = (HWND) wParam;
COPYDATASTRUCT & cds = *(COPYDATASTRUCT *)cds.lpData;
CString receivedString = (LPCTSTR) cds.lpData;
Note: this does not handle passing from UNICODE app to ASCII/MBCS app (or vice versa) correctly
~RaGE();
|
|
|
|
|
|
Hello all,
using a console application i want to print a webpage(html/htm) saved on my disk.How can i do that? i have done a lot of work on it & i am unable to find the solution.I am wondering whether there is a solution to it in vc++.Shellexecute definitely doesn't print in this case.Kindly Help.
Regards,
Ankush
Ankush Mehta
|
|
|
|
|
Hello all,
I have .eml (Internet E-Mail Message) Type of file on my disk. I want to print it.Do i need to automate outlook express(How??) or is there any other better way..
Regards,
Ankush
Ankush Mehta
|
|
|
|
|
Is there any way to manually define resource id without conflict with others?
|
|
|
|
|
|
Sig improved! new one is nice
|
|
|
|
|
|
Sig can be made still smaller.
-Prakash
|
|
|
|
|
If you mean code to return an ID that isn't used you could use the EnumChildWindows and GetWindowLong with the GWL_ID parameter to conjure one up. If you're not talking about making one at runtime "Owner drawn" has a point - although generally the dialog editor will make sure you get a unique one.
Steve
|
|
|
|
|
I have a macro that renumber resources in resource.h sequentially. Depending of what did you mean with your question, it might help.
Igor Green
http://www.grigsoft.com/ - files and folders comparison tools
|
|
|
|
|
Dear members
Plz suggest me some code to colourize the scrollBars of a MDI application
Thanks
rohini sharma
|
|
|
|
|
|
Ahh, colour spelt with a "u". As an Australian programmer I always have to "misspell" colour (when wearing my programming hat).
Steve
|
|
|
|
|
See WM_CTLCOLORSCROLLBAR (for scrollbar controls only).
Also see Flat Scroll Bars - In particular the FlatSB_SetScrollProp function.
Steve
|
|
|
|
|
Hi,
My PC is having dual screen setup and I would to display a child window of my MFC application to be displayed on second screen. Is there any way to make the application to display like tht??? I would also like to know if there is a way to make the main application to be displayed on secondary screen, so that the child window can show up on the primary screen??
thanks,
-Pavan
-- modified at 22:50 Thursday 12th January, 2006
|
|
|
|
|
A child window is always within the boundaries of its parent, so you can't have a parent window and a child window on separate screens. You can, however, put a non-child window on a different screen. After all, it's only a change in the position of the window.
Use EnumDisplayMonitors() to get the display rectangles of all the installed monitors.
Hope this helps,
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
With two monitors, you just have a larger screen. So if with one monitor you have a screen that is 1024 x 768, with two monitors both set to the same resolution, the screen will be 2048 x 768 if they are arranged side by side, or 1024 x 1536 if one is logically above the other. (I find the vertical arrangement confusing, but very handy for word processing when you want two views on the same document.)
Be warned though, that with two monitors the screen coordinates can now be negative. The primary monitor will always have it top left corner at 0, 0 but the secondary monitor (assuming that you ONLY have two) can be placed to cover any rectangle that touches the primary monitor's screen area. So the secondary monitor could be up and to the ledt and have its top left corner at -1024, -700. You will find it tricky to navigate your mouse between the two in this case.
Also, now that you have two monitors, make a point of checking out code to handle monitors. Some companies write software that pops up dialogs that can not be moved, and which come up right in the middle of the screen. So the dialog is half on one monitor and half on the other. Make sure this does not happen to your code!
Shraddhan
|
|
|
|
|
So I edit the afxdlg.rtf file in ignorance and completely whacked all the tags and other formatting, and subsequently attempted to re-generate the help files.
The upshot is that the help files are hosed.
AfxDlg.rtf is auto-generated by the MFC AppWizard; is there a way to RE-generate this file?
|
|
|
|
|
Nick Cassavaugh wrote: AfxDlg.rtf is auto-generated by the MFC AppWizard; is there a way to RE-generate this file?
As far as I remember, the file AfxDlg.rtf is generated by the AppWizard, but leaves lots of places for you to modify. If you have totally lost the original file, you could create a new project like your current one, copy the file, and delete the new project. Then make a copy of it just in case.
But why are you using the old style help compiler? Use the newer HTML help system. You get a better product, and if you have to start from the beginning anyway, there is not much lost.
Shraddhan
|
|
|
|
|
Hi,
I am trying to launch a process (a Web browser) from inside a screensaver app using ShellExecuteEx. I can get the new process spawned, but it terminates when the screensaver quits. Is there a way to launch it as an independent process so it stays active after the screensaver quits? Thx.
Bodhi
|
|
|
|
|
I'm surprised to hear that - Once a process is launched it should be independent of the process that spawned it. Have you any more info?
Steve
|
|
|
|