|
Alan Chambers wrote:
Not like you to be posting questions Chris,
yeah, there are some things i just never do much of - this is one of them.
looks like i'll end up doing something like what you're describing. i was hoping for a cleaner way. oh well.
-c
Garbage collection, making life better - for weenies!
|
|
|
|
|
Chris, see my 3rd serialization article, specifically the section "Serializing a heterogenous collection class". I have sample code that uses the factory pattern to implement this. Send me mail if you'd like me to send it to you (virtual NDA assumed ).
/ravi
Let's put "civil" back into "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I am writing a simple program which makes calls of a DLL. My program crashes shortly after making a call to any function of the DLL, even when the function doesnt do anything and returns void. My memory manager gives me a message about operator delete, suggesting that some memory has been messed up somewhere. Initially, the function call appears to be succesful, it just crashes as i step through amongst some dissasembly code.
Thanks in advance
James
|
|
|
|
|
Sounds like a mismatched calling convention. For example, the DLL routines are using __stdcall while the caller thinks the routines are all _cdecl. This causes all sorts of nasty stack thrashing.
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?
|
|
|
|
|
Think I found a Bug in the API Function TabbedTextOut. When Parameter nCount is 1 and nTabOrigin is 80 and lpnTabStopPositions is 67 (pointer to int with value 67) the Function behaves like nTabOrigin is 0. nTabOrigin can be only 13 greater than the int-value lpnTabStopPositions points to. With an array with more than one value the Origin parameter works well.
Can someone report this bug to MS?
|
|
|
|
|
Hello,
I need to know how to create a new child MDI window. I have a program that opens bitmap images, but it doesn't put them on a new window. I want to know how to write my own OnFileNew command basically. Mayeb my problem is with my fileOpen, since it doesn't open new windows?
If anyone has any advice on how do this, or even better, KNOWS how to do this, I would be very happy.
thanks a lot
NickOne
|
|
|
|
|
Look at the code in the OnFileNew handler. It does what you want,just copy the relevant bits.
|
|
|
|
|
Hi people,
I've just set up some scrollbars with the guidance of a nice cp article, but there's a small thing I'd like to change:
The code makes the scrollbar disappear when it's no longer needed.
However, some apps (like Notepad) always show the scrollbar and just hide the thumb instead.
Anyone know how to do that?
Thanks,
Ren
|
|
|
|
|
EnableScrollBar(SomeHwnd, SB_VERT, ESB_DISABLE_BOTH);
does the trick with the vertical scrollbar...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Hi,
Thanks for the help. Your code solved the problem, but I found another approach as well.
Here's my OnSize handler:
void COverviewWnd::OnSize(UINT nType, int cx, int cy)
{
SCROLLINFO si;
si.cbSize = sizeof(SCROLLINFO);
si.fMask = SIF_PAGE|SIF_RANGE|SIF_DISABLENOSCROLL;
si.nPage = cy;
si.nMax = rctTotal.Height();
si.nMin = 0;
SetScrollInfo(SB_VERT, &si);
CWnd::OnSize(nType, cx, cy);
}
Apparently SetScrollInfo automatically calculates whether the scrollbar is necessary or not by comparing nPage (the available space) and nMax (the total space the document occupies).
It's default behavior is to hide the scrollbar when it's no longer needed, but you can set the SIF_DISABLENOSCROLL flag to have it disabled instead.
You probably knew this, but I wrote it down anyway for those who don't.
Greetings,
Ren
|
|
|
|
|
I know this is a really stupid question, but I'm use to programming on Unix systems.
I wrote a program using MS Visual C++, and I want to pass in a value into the argsv.
so I can run it at the command prompt something like: "whatever.exe filename.txt"
of course this doesn't work. Any ideas?
ICXC
NIKA
|
|
|
|
|
Why doesn't it work, I have done that lots of times...
Starting a program with "whatever.exe filename.txt" from the command promt I mean, and it works just fine.
What exactly are you trying to do that don't work?
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
It works when I use the ms-dos command prompt. when I just go to start and run, then browse, then try to do it, it's a no go.
ICXC
NIKA
|
|
|
|
|
You have to write "someprogram.exe" somefile.txt instead of "someprogram.exe somefile.txt"
Then it works
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
I'm not sure whether this is what you're after, but in a Windows-based app you can use the variables __argc and __argv just as you did with the usual main parms in an Unix console program.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
WinMain(), as you've seen, doesn't have the argc/argv params. You can access them via the lpCmdLine parameter to WinMain(). Alternatively, there are __argc and __argv variables that the CRT sets up for you that work like argc/argv.
--Mike--
Just released - RightClick-Encrypt - Adds fast & easy file encryption to Explorer
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
hi!
I wish, in my program to send Message via
"SendMessage" to the "NotePad".
For a start, I want to send a WM_KEYDOWN
to write a letter in notePad's writable area.
I have the handle of the notePad.
if any one can assist me, I would be very
very thankful.
Eynat
"things can only get better!"
|
|
|
|
|
Try it.
You will probably have to send a WM_CHAR as well.
Jason Henderson quasi-homepage articles "Like it or not, I'm right!"
|
|
|
|
|
|
Thank you for your help.
what I really need to do is:
I need to, from without the note pad, close a modal messageBox.
modal - messageBox is reffered to the messagebox you get once you try to exit the notepad and you're asked if you wanna save the changes .
this msgbox I need to eliminate , I assume, with a message from an outer application.
If anyone has an idea or has done such a thing before - I would be glad/relieved to know - for this is part of a very urgent assinment I have to accomplish.
Thank you (again) ,Eynat
"Things can only get better"
|
|
|
|
|
Yes, you can use this trick to do that.
You'll find 2 windows in notepad - the main frame window (whose handle you can FindWindow based on the caption - e.g. "Untitled - Notepad") - and its child, which is an edit box.
To type text into notepad, post the key stuff to the edit box.
To send a key that will close the messagebox (Y, N, ESC), send it to the main window.
|
|
|
|
|
Anyone knows how to deal with ghost windows in XP? How to get rid of the ghost windows in windows XP system with Platform SDK? Thanks.
Windows XP: If a top-level window stops responding to messages for more than several seconds, the system considers the window to be hung and replaces it with a ghost window that has the same Z order, location, size, and visual attributes. This allows the user to move it, resize it, or even close the application. However, these are the only actions available because the application is actually hung. When in the debugger mode, the system does not generate a ghost window.
reference from MSDN.
|
|
|
|
|
I'm using the following code to open a URL in the user's browser:
CString strUrl = "http://www.codeproject.com";
if ((int) ::ShellExecute (m_hWnd, "open", strUrl, "", "", SW_SHOW ) <= 32) {
...
}
This causes the same (I suspect the most recently opened) IE window to display the site. Does anyone know how I can force the system to open a new instance of the browser each time the code executes?
Thanks muchly!
/ravi
Let's put "civil" back into "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
For the verb, try running IE explicitly.
::ShellExecute(m_hWnd, "open", "iexplore http://www.codeproject.com/", "", "", SW_SHOW)
There might be another way also, and of course this would only work if IE is included in the path, so you may want to check the registry for validating this beforehand.
Jeremy L. Falcon<nobr>
Homepage : Sonork = 100.16311
"But everybody darlin' sometimes bites the hand that feeds."
"Remember in this game we call life that no one said it's fair."
"Just because you're winnin' don't mean you're the lucky ones."
Song: Breakdown - Album: Use Your Illusion II - Artist: Guns N' Roses
|
|
|
|
|
related-- (if you are invoking IE explicitly
using ShellExecute)
IE has some command line options
see MS KB article Q178058
try the -new option
but as long as you are limiting to IE,
go all out and use the exposed automation...
|
|
|
|