|
The Rectangle and Ellipse functions use the device context's current pen and brush for the lines and fills.
case WM_PAINT:
{
PAINTSTRUCT ps;
HDC DC = BeginPaint(m_hWnd, &ps);
HPEN Pen = CreatePen(PS_SOLID, 2, RGB(255, 0, 0));
HBRUSH Brush = CreateSolidBrush(RGB(0, 0, 255));
HGDIOBJ OldPen = SelectObject(DC, Pen);
HGDIOBJ OldBrush = SelectObject(DC, Brush);
Rectangle(DC, 10, 10, 200, 200);
SelectObject(DC, OldPen);
SelectObject(DC, OldBrush);
DeleteObject(Pen);
DeleteObject(Brush);
EndPaint(m_hWnd, &ps);
}
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
I am trying to draw text on a bitmap, and the text has a lot of jaggies in it. I am using native Win32 calls like TextOut to draw the text.
The only way I have found to reduce the jaggies is to draw the bitmap really large, then scale it down through a StretchBlt call, which is very inefficient.
Is there another way to accomplish what I am looking for, either in Win32, or using the .NET framework?
Thanks!
|
|
|
|
|
Is it text that gets saved with the bitmap or just used at display time?
For saving you don't have a lot of choice. If the bitmap is small and it's later always displayed
zoomed then it's going to be jagged, unless some kind of smoothing/interpolation is used for the
zoom.
If used at display time then you could adjust the font size based on the zoom factor.
"Great job, team. Head back to base for debriefing and cocktails."
(Spottswoode "Team America")
|
|
|
|
|
When you create the font, either with CreateFont() or by setting up a LOGFONT , you can set a quality. Try ANTIALIASED_QUALITY and see if that gives better results.
|
|
|
|
|
how to run a batch file from mfc
|
|
|
|
|
You can use of CreateProcess
|
|
|
|
|
|
Code like this[^] will do the trick.
Steve
|
|
|
|
|
how to run msdos command from mfc for example ipconfig
|
|
|
|
|
Take a look at CreateProcess.
PROCESS_INFORMATION ProcessInfo;
STARTUPINFO StartupInfo;
ZeroMemory(&StartupInfo, sizeof(StartupInfo));<br />
StartupInfo.cb = sizeof (StartupInfo) ;
<br />
StartupInfo.dwFlags = STARTF_USESHOWWINDOW;<br />
StartupInfo.wShowWindow = false;<br />
<br />
if(CreateProcess("c:\\Windows\\System32\\defrag.exe", <br />
"defrag C: /v", <br />
NULL,NULL,FALSE,0,NULL,<br />
NULL,&StartupInfo,&ProcessInfo))<br />
<br />
...
Hope this helps.
|
|
|
|
|
Running DOS/Command-Line apps does not appear to be your problem, but rather how to capture the output from running one. Do an MSDN search for "redirected console handles" for ways to do this without doing redirection-to-file.
This may be the better way, if you have no other way to get the same information directly from the Win32 API, because the user your app may be running under may not have permission to create a file.
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
Perhaps this will help:
#include "StdAfx.h"
#include <process.h>
int main()
{
system("ipconfig");
return 0;
}
To output result to a file use this line instead:
system("ipconfig > C:\\Log.txt");
Steve
|
|
|
|
|
yes i got it for ipconfig. but when i tried the same for netsh as system("netsh -c interface dump > e:\boot\net") i cant get it. i have to redirect this output to my flash drive which will be in e:\
|
|
|
|
|
I tried this and it works just fine:
#include "StdAfx.h"
#include <process.h>
int main()
{
system("netsh -c interface dump > C:\\Log.txt");
return 0;
}
Looks like you're redirecting to a directory (or a file in the "boot" directory called "net" with no extension). Also, are you ecscaping your backslashes?
Steve
|
|
|
|
|
no net is a folder inside boot. see this is what i have done.
char para3[1024];
strcpy (para3, "\0");
strcat (para3, cRemovableDrive);
strcat (para3, ":\\boot\\net\\ipconf");
system("netsh -c interface dump > para3");
is this correct. the same thing which i have done for ipconfig (system("ipconfig > para3"))
works well
|
|
|
|
|
Using strcpy and fixed sized buffers is crap: use CString instead (after all, you're using MFC). Try this:
CString para3;
para3.Format(_T("%c:\\boot\\net\\ipconf.txt"), cRemovableDrive);
CString command;
command.Format(_T("netsh -c interface dump > %s"), para3);
system(command);
Steve
|
|
|
|
|
thanks a lot. its working well. but how to disable the command promt window while executing sytem command
-- modified at 0:29 Tuesday 6th March, 2007
|
|
|
|
|
That's not so easy. You'll have to do a lot more work.
Steve
|
|
|
|
|
Replace system with code something like this:
ShellExecute(
NULL,
"open",
"cmd",
"/C \"netsh -c interface dump > C:\\Log.txt\"",
NULL,
SW_HIDE
);
Steve
|
|
|
|
|
hi i have to get the output of netsh -c interface dump to a file. i coded as
char para3[1024];
strcpy (para3, "\0");
strcat (para3, "netsh -c interface dump > ");
strcat (para3, cRemovableDrive);
strcat (para3, ":\\boot\\net\\ipconf");
src=cOperatingSysDrive;
src+=":\\windows\\system32\\cmd.exe ";
hInt = ShellExecute(NULL,"open",src, para3,NULL,SW_HIDE);
but i didnt get the output in the file. anyone know this
|
|
|
|
|
Have you seen content of para3 , is it correct ?
It is good practice to intialize array on declaration , Modify your code to,
char para3[1024] = {'\0'};
strcat (para3, "netsh -c interface dump > ");
strcat (para3, cRemovableDrive);
strcat (para3, ":\\boot\\net\\ipconf");
|
|
|
|
|
i initialised the array. but now also i the file ipconf was not created
how to capture the output from netsh in mfc
-- modified at 11:25 Monday 5th March, 2007
|
|
|
|
|
ShellExecute() doesn't interpret the command line's redirection syntax, it takes the entire string you pass it and looks for a file with that name.
|
|
|
|
|
Hi,
How can you programatically find which bluetooth stack is present on a windows PC.
Regards,
Deepak
|
|
|
|
|
Hello,
How can I properly create and use a CPropertySheet object with vertically arranged pages?
Here I've uploaded a demo project with source code included. It's just a simple SDI application which has main view class CVerticalPropSheetView (derived from CView) containing property sheet CPropSheetDemo (derived from CPropertySheet) with 3 property pages:
http://forum.codenet.ru/attachment....=1&d=1173007311
http://www.rsdn.ru:80/File/35531/VerticalPropSheet.rar
I tried to follow the advice from one of topics at CodeGuru forum (http://www.codeguru.com/forum/archi...p/t-331500.html) however, I've discovered the following issues related to resizing of the property sheet's window in CVerticalPropSheetView::OnSize():
1) When changing size of CPropSheetDemo window so that its width is less than its height, the tabs of the bottom property pages are not properly drawn. It looks like only rectangle part of property sheet (width x width) is being drawn properly.
2) When changing height of CPropertySheet window so that it can't display all tabs, the spin control is displayed. However, it doesn't work (I can't choose tab using spin control).
Does anyone know how to resolve these issues? All above appears only when property pages are arranged vertically - e.g. until I comment the following lines of code in CPropSheetDemo::OnInitDialog():
// create the new font for property pages' titles
CreateNewFont(&m_Font,14,_T("Microsoft Sans Serif"));
// make our property sheet vertical-oriented
CWnd* pctrlTab=GetDlgItem(AFX_IDC_TAB_CONTROL);
if (pctrlTab!=NULL) {
pctrlTab->ModifyStyle(TCS_FOCUSONBUTTONDOWN,TCS_VERTICAL,0);
pctrlTab->SetFont(&m_Font);
}
Many thanks in advance!
dp
|
|
|
|