|
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...
|
|
|
|
|
Use "-new" command line option.
Best wishes,
Hans
|
|
|
|
|
Do you know how could i use the equivalent of C's escape sequences in VB to write strings like this: "a1 \"b1\" c1"?
rechi
|
|
|
|
|
Shame on you for cross posting! I'll answer this in the VB forum.
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
|
|
|
|
|
Thanx for your answer!
It's not an usual practice for me to cross-post; just an exception. Sorry!
rechi
|
|
|
|
|
Mmmhh ... In a dialog MFC app, I have a thread MainThread in which i start a thread ChildThread. The ChildThread has a priority set to LOWEST, and the MainThread set to ABOVE_NORMAL. However, when I debug step by step, the ChildThread seems to run with a greater priority than the MainThread(100/1 instructions ratio). Why ?
~RaGE();
|
|
|
|
|
How have you determined this ratio? Please note that it is higly unlikely you're calculating any significative figure within a steyp by step debugging process. Also, the number of instructions per second executed by a thread does not only depend on its priority, but also on the frequency of yielding operations it performs (ops for which the system deems it appropriate to pass the control to another thread till they complete, such as IO APIs.)
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Joaquín M López Muñoz wrote:
How have you determined this ratio?
I determined the ratio this way : I have two 'for' loops in the Child threads, doing some stuff. So when I launch the ChildThread from within the Main, it starts and finishes the first loop in the CT, does one instruction in the MT, does the second loop in the CT, and return for one instruction in the MT. Since the 'for' limit is 102 in both 'for' loops, I had my ratio
Joaquín M López Muñoz wrote:
Please note that it is higly unlikely you're calculating any significative figure within a steyp by step debugging process. Also, the number of instructions per second executed by a thread does not only depend on its priority, but also on the frequency of yielding operations it performs (ops for which the system deems it appropriate to pass the control to another thread till they complete, such as IO APIs.)
That´s exactly what i wanted to know when posting my thread. I thank you very much ...
~RaGE();
|
|
|
|
|
Probably a misimpression caused by debugger. How are you measuring this performance difference? Is the problem that the main thread is sitting in single step mode while the child is executing?
Also, be aware, setting priority is not the same as setting speed. It simply means that when given a choice between the 2 threads waiting for the same resource, the higher priority thread will go first (within limits).
|
|
|
|