|
Do you just want to make a particular MDI frame active? CFrameWnd::ActivateFrame() does this.
--Mike--
http://home.inreach.com/mdunn/
Time is an illusion; lunchtime doubly so.
|
|
|
|
|
Hi
Thanks alot for your reply. I tried it with ActivateFrame(SW_RESTORE); however, it seems to open a new child window instead of activating that present one. Do you know why?
Thanks again!
kk9
|
|
|
|
|
When a line is drawn in Windows, the pixel located at the ending point is always excluded.
That means if you call
dc.MoveTo(x1, y1);
dc.LineTo(x2, y2);
the line will be drawn without pixel (x2, y2).
When I draw a lot of small lines it is very noticable. I could call
dc.SetPixel(x, y, RGB(0,0,0))
but that is bad solution, because SetPixel is inefficient and I must know the color of the current pen.
Does anybody know if there is a way to draw complete line in Windows by using some special type of pen?
Maybe it is possible to rewrite line drawing algorithm at lower level?
|
|
|
|
|
You could use the following as an alternative method
dc.MoveTo(x1,y1);
dc.LineTo(x2 + ((x2-x1 == 0 ? 0 : (x2 > x1 ? 1: -1), y2 + ((y2-y1 == 0 ? 0 : (y2 > y1 ? 1: -1));
If you are in a differnt metric other other than font (like english or inches) then you would have to adjust the 1 value to be the equivalent to the metric type.
The math works out correctly and the code should work in theory; I just haven't had the time to try it out yet. It should be quick and easy for you to check.
-Erik
|
|
|
|
|
I looked around codeproject's shell article but could not find any sample on batch file deletion.
I am finding files of certain specific extension ie. *.bmp and then need to delete them by one delete button (batch deletion).
One more thing is that I have a message box and it pops up to let the user select two options:
1) Total Delete from HD.
2) Forward to the Recycle Bin only.
Code fragements, examples, hints are all much appreciated!
|
|
|
|
|
|
Dear Mike,
Thank you for this excellent piece!
Its all set and running!
I guess there should be more tha 28 and +1 (myself now) users. (was 28 users until I put Excellent!)
|
|
|
|
|
Hi, am making a joke for a friend, a program that after 10 sec closes windows down.
But i want to make it so there is no dialog boxes or anything, but how??...
I tryed to delet some off the stuff in a MFC app wizard, no luck.
Ok, i need one more thing, how do i call the Close windows command???
Thank you all for ya help..
|
|
|
|
|
For the first, look up putting an icon on the status tray, only don't draw it there, just remove it from the status bar. For the second, look up EnumWindows - you could do it something like this:
BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam)
{
char* h = new char[255];
GetWindowText(hwnd,h,255);
CString text(h);
long wl = GetWindowLong(hwnd,GWL_STYLE);
if (text.GetLength()>0 && IsWindowVisible(hwnd) &&
text != "Program Manager" )
DestroyWindow(hWnd);
return TRUE;
}
void CMyClass::CloseWindows()
{
EnumWindows(EnumWindowsProc,NULL);
}
EnumWindows calls the callback function. Usually you would make the second parameter a list or something, so you could store the names or handles of the windows being enumerated, but in this case, we just want to close them as we find them. The tests we do before closing stop us from killing everything and ensure we close just the items open on the desktop.
Now use this power for good, not evil
|
|
|
|
|
I look for a sample code using the following methods: SetWinEvenHook, WinEventProc...
|
|
|
|
|
Hi,
does anybody how to profile a release version in VC6 while the code is optimized to
maximum speed ? Or is there another (good) tool out to test the speed of functions ?
Greatings Mario ///
--------------------
www.klangwerker.de
rocknix@lycos.de
--------------------
|
|
|
|
|
I have used the MSVC profiler for release builds many times. I don't think the code optimization makes any difference at all in this matter. A couple of considerations come to mind though:
1. Make sure you turn OFF incremental linking (Visual should do this automatically)
2. Select "Line numbers only" in the Debug Info section (under C/C++ Project Settings).
At work we had a problem where the profiler menu option (under the build menu) was disabled. This is a known bug in Visual Studio! You can find information about it at the MSDN site:
http://support.microsoft.com/support/kb/articles/Q224/3/82.ASP
Hope this helps
Accept that some days you are the pigeon and some days the statue.
|
|
|
|
|
Can I know how to launch the Internet Explorer after the user had input the URL?
Thx for your help!! ^.^.
Regards,
Dig
|
|
|
|
|
Do a ShellExecute() on the URL. This will launch the user's default browser, which is nicer and will work even if IE isn't installed.
--Mike--
http://home.inreach.com/mdunn/
Is history an illusion caused by the passage of time, or is time an illusion caused by the passage of history?
|
|
|
|
|
Just one catch
( I'm only posting this for something to post as I'm bored)
What happens when no browser is associated with a html || htm || hta || asp || shtml etc etc.)
But I still use shellexecute all the time !
Regardz
Colin
|
|
|
|
|
If you have IE installed, it should be associated already through registry I guess, unless you did some registory edits.
|
|
|
|
|
If there's no app associated with .HTM(L) files, then either a) there's no browser installed; b) the registry is horked; or c) the user went in and manually deleted the association. None of which you can do anything about.
--Mike--
http://home.inreach.com/mdunn/
Time is an illusion; lunchtime doubly so.
|
|
|
|
|
hi,
I'm working on a program that needs to insert complete files in a Jet database. There can be ASCI as well as binary files. I'm writing the program in Visual C++. Could anyone give me a hint or reference on how to do this?
Regards,
WimB
|
|
|
|
|
It's been a while that I'm trying to get information on that, any help will be precious :
I'm trying to get information (the path for example) of the current focused Explorer Window. I found a way, but it's not clean at all :
// #1 get previous window Hwnd
HWND current = GetSafeHwnd();
prevhwnd = ::FindWindow("CabinetWClass", NULL);
// #2 find the ComboBox called "addess" in the explorer window
::EnumChildWindows(prevhwnd, EnumChildProc, 0);
// #3 now, we have g_combohwnd = CComboBox HWND
CComboBoxEx *cb = (CComboBoxEx *) FromHandle (g_combohwnd);
// #4 get the text in the combobox edit zone....
::SendMessage(cb->m_hWnd, WM_GETTEXT, (WPARAM)256, (LPARAM)buf);
This is really ugly... Any idea, please ????
Roms
|
|
|
|
|
Am still looking for a Tutorial on save and load....
I cant find any help on this one.
thank you
|
|
|
|
|
I reckon no-one has answered because it's so easy. If you go to msdn.microsoft.com and look up CFile, assuming you don't want to use serialisation, you'll find oodles of information...
|
|
|
|
|
|
I'm writing a C++ console app for Windows and UNIX. When it runs, the app needs to know the directory where it's located. Of course, this may or may not be different from the working directory (which I don't care about). I need the directory where the app's file is at -- the equivalent of GetModuleFileName on Windows.
Anyone have a clue?
Thanks,
Alvaro
|
|
|
|
|
There are many flavors of UNIX. You will need to look at the system calls available for the flavor you are coding for.
|
|
|
|
|
> When it runs, the app needs to know the directory where it's located.
Check the first argument passed to "main(...)". That usually contains the path to the executable.
-=- James.
|
|
|
|