|
yes thanks its working
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
You can execute DOS commands with ShellExecute and have the DOS window hidden. Try this:
ShellExecute(
NULL,
"open",
"cmd",
"/C \"Dir/ar>File.txt\"",
NULL,
SW_HIDE
);
Steve
|
|
|
|
|
I have set this from the property window but doesn't set.what should i do?
I am working in win32(.NET).
Amit
|
|
|
|
|
Hi Amit.
Though I am not sure abt .NET environment as I haven't used it before, but this code snippet certainly works for VC++. See if it is helpful for you
Here I have trapped the WM_CTLCOLOR message for the dialog box on which the static control resides.
HBRUSH CMyDialog::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
if( nCtlColor == CTLCOLOR_STATIC )
{
pDC->SetBkMode(TRANSPARENT);
pDC->SetTextColor(RGB(255,255,255));
hbr = static_cast < HBRUSH >(GetStockObject(NULL_BRUSH));
}
return hbr;
}
Sameer Thakur
|
|
|
|
|
thanks sameer. you are right I have completed it in the same way as
you shown me in vc++.
|
|
|
|
|
|
can anybody please tell me what's the coding for changing filled color n line color of an ellipse and a rectangle using C++ (Graphical User Interface)?
|
|
|
|
|
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
|
|
|
|