|
A way could be to avoid to open a blank file when opening the application.
To do so, in YourApp::InitInstance, set the m_nShellCommand attribute of the CCommandLineInfo object to CCommandLineInfo::FileNothing before processing it (ProcessShellCmd).
From MSDN:
BOOL CMyWinApp::InitInstance()<br />
{<br />
...<br />
CCommandLineInfo cmdInfo;<br />
ParseCommandLine(cmdInfo);<br />
cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;<br />
if (!ProcessShellCommand(cmdInfo))<br />
return FALSE;<br />
...<br />
};
HTH,
K.
Every gun that is made, every warship launched, every rocket fired, signifies in the final sense a theft from those who hunger and are not fed, those who are cold and are not clothed - Dwight D. Eisenhower
|
|
|
|
|
thanks for your response, but it doesn't seem to work!!!
I copy pasted the code in my InitInstance()
so now it looks like the following:
BOOL CMotionControllerApp::InitInstance()
{
// CG: The following block was added by the Splash Screen component.
\
{
\
CCommandLineInfo cmdInfo;
\
ParseCommandLine(cmdInfo);
\
\
CSplashWnd::EnableSplashScreen(cmdInfo.m_bShowSplash);
\
}
AfxEnableControlContainer();
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
// Change the registry key under which our settings are stored.
// TODO: You should modify this string to be something appropriate
// such as the name of your company or organization.
SetRegistryKey(_T("Local AppWizard-Generated Applications"));
LoadStdProfileSettings(); // Load standard INI file options
// Register the application's document templates. Document templates
// serve as the connection between documents, frame windows and
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CMotionControllerDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CMotionControllerView));
AddDocTemplate(pDocTemplate);
// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
//This is your code, it is at the correct spot?
cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;
// Dispatch commands specified on the command line
if (!ProcessShellCommand(cmdInfo))
return FALSE;
// The one and only window has been initialized, so show and update
// m_pMainWnd->ShowWindow(SW_SHOWMAXIMIZED);
// m_pMainWnd->UpdateWindow();
return TRUE;
}
Ehsan Behboudi
|
|
|
|
|
I don't understand why you have two calls to ParseCommandLine. The following implementation should be enough.
BOOL CMotionControllerApp::InitInstance()<br />
{<br />
AfxEnableControlContainer();<br />
<br />
<br />
#ifdef _AFXDLL<br />
Enable3dControls();
#else<br />
Enable3dControlsStatic();
#endif<br />
<br />
SetRegistryKey(_T("Local AppWizard-Generated Applications"));<br />
<br />
LoadStdProfileSettings();
<br />
<br />
CSingleDocTemplate* pDocTemplate;<br />
pDocTemplate = new CSingleDocTemplate(<br />
IDR_MAINFRAME,<br />
RUNTIME_CLASS(CMotionControllerDoc),<br />
RUNTIME_CLASS(CMainFrame),
RUNTIME_CLASS(CMotionControllerView));<br />
AddDocTemplate(pDocTemplate);<br />
<br />
CCommandLineInfo cmdInfo;<br />
ParseCommandLine(cmdInfo);<br />
<br />
CSplashWnd::EnableSplashScreen(cmdInfo.m_bShowSplash);<br />
<br />
cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;<br />
if (!ProcessShellCommand(cmdInfo))<br />
return FALSE;<br />
<br />
<br />
return TRUE;<br />
}
Is the ProcessShellCommand method overriden somewhere in your code?
Check your mail, I sent a small demo application to you.
HTH,
K.
Every gun that is made, every warship launched, every rocket fired, signifies in the final sense a theft from those who hunger and are not fed, those who are cold and are not clothed - Dwight D. Eisenhower
|
|
|
|
|
Hi,
I would like to hide the view of MDI, so only the toolbar and menu would be visible.
How can I do that?
|
|
|
|
|
Hello:
I'm having trouble with this code
//**************CODE**************//
HBITMAP bmpHandle = (HBITMAP) ::LoadImage(NULL, _T("C:\\test\\bmptest.bmp"),
IMAGE_BITMAP, 0,0, LR_LOADFROMFILE) ;
m_Images.SetBitmap(bmpHandle);
//************END CODE************//
I have a dialog box with a listbox control and a picture box or CStatic
control ;
when the application starts up, all the bmp files I have in a folder are
loaded in the listbox.
By clicking on anyone of these files I should see the image into the Picture
control or CStatic control.
The problem is, when I click on a file from the list, the bitmap is NOT displayed entirely in the Picture control, part of it is in and the other
part is out of the picture control, in other words there is a disparity in relation to the size of the control. How do I keep the entire bitmap into the
picture control box.
Do I need to resize the bitmap before loading it, and if so how?
Thanks
|
|
|
|
|
CString szFilename="C:\\test\\bmptest.bmp";
HBITMAP hBmp = (HBITMAP)::LoadImage(NULL,szFilename, IMAGE_BITMAP, 0, 0,
LR_LOADFROMFILE|LR_CREATEDIBSECTION);
CBitmap pic;
pic.Attach(hBmp);
BITMAP pic_header;
pic.GetBitmap(&pic_header);
CWnd* wp = GetDlgItem(IDC_STATIC_BITMAP_GLASROHR);
CDC *pDC = wp->GetDC();
CDC imageDC;
imageDC.CreateCompatibleDC(pDC);
imageDC.SelectObject( &pic);
pDC->BitBlt(3, 3, pic_header.bmWidth, pic_header.bmHeight, &imageDC, 0,
0, SRCCOPY);
imageDC.DeleteDC();
wp->ReleaseDC(pDC);
|
|
|
|
|
Consider the following scenario:
The London underground administration would like to store the following information for each line that it serves: name of line, name of stations for each line and their sequence, the interchange stations.
1.Write a program that reads a list of underground stations and lines into a double circular linked list that is created using dynamic memory allocation.
The underground stations to be used in the assignment are given below. The information about the stations should be written in the Underground.txt file.
Line Stations
District South Kensington
Picadilly South Kensington
Picadilly Knightsbridge
Picadilly Hyde Park Corner
Picadilly Green Park
Picadilly Picadilly Circus
Bakerloo Picadilly Circus
Bakerloo Charing Cross
Bakerloo Embankment
District Embankment
District Victoria
District Sloane Square
Victoria Green Park
Victoria Victoria
The format of the text file can be considered similar to one shown in the above table.
2.Support the program with the additional feature to add a node. This can be used if the station is opened. The user should specify which station should be added.
3.Support the program with the additional feature to delete a node. This can be used if the station is closed. The user should specify which station should be deleted.
4.Allow the user to enter two underground stations: the station of your departure and the station of your arrival. Find the shortest path to get to from one station to another one in terms of the number of underground stations passed. Print the list of stations and name of the lines that you have to pass to get to the station of your destination. Give summary how many lines you have to use, where you have to change and how many stations you have to pass in each line.
------------------------------------------------------------------------------------
Can anybody give me any suggestions on how I could start this assignment. Will I need 2 classes, one for Lines and one for Stations??? Or do I store them both in one class and call it Underground e.g.
struct Underground
{
char nameofstation[MAX CHARS];
char nameofline[MAXCHARS];
Underground *nextstn;
}
Is this correct?????
What do i need to do next????? Can somebody please help.....
|
|
|
|
|
Seems like a bit of school homework to me. You really should figure this out on your own.
|
|
|
|
|
hi all,
I have a round dialog, i use the OnColorCTL to color the background of the dialog to yellow. i use OnPaint and dc.TextOut to display text on the round dialog. also i want to draw an ellipse as a mark for the round dialog border
here is the code i use in the OnPaint():
void CRoundDlg::OnPaint()
{
CPaintDC dc(this);
CRect rect,rectTmp;
GetWindowRect(rect);
ScreenToClient(rect);
rectTmp = CRect(rect.left + 17 * SPACE_MARGINGS,
rect.top + 23 * SPACE_MARGINGS,
rect.Width(),
rect.Height());
CBrush* pOldBrush = dc.SelectObject(&m_brush);
dc.SetBkColor(MESSAGE_BOX_DIALOG_BK_COLOR);
dc.SetTextColor(MESSAGE_BOX_TEXT_COLOR);
dc.TextOut(rectTmp.left,rectTmp.top,m_szText);
dc.PatBlt(0, 0,rect.Width(),rect.Height(), PATCOPY);
CPen* pOldPen= dc.SelectObject(&m_Pen);
rect.DeflateRect(4,4,4,4);
dc.Ellipse(rect);
dc.SelectObject(pOldBrush);
dc.SelectObject(pOldPen);
}
trouble is that i see the rectangle but i don't see the text.....
can any1 help here?
thanks in advanced
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Looks like you are painting over the text, dude!
Swap the order of the TextOut and the PatBlt and you should see it.
|
|
|
|
|
thanks that helped me...but only when i moved it after the ellipse drawing...
thanks again
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Try moving the dc.TextOut() after the PatBlt(), or even later still. FYI I use a rounded dialog in ED without any problems.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
thanks that helped me...but only when i moved it after the ellipse drawing...
thanks again
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Anyone here knows how to calculate pi in visual c++ 6 to the 100ths maybe less maybe more. I just want to know how maybe an example but I would appreciate a method.
<marquee>Universal Project... Soon to be a .net
|
|
|
|
|
|
Ted Ferenc wrote:
as the saying goes http://www.anvari.org/fun/Computer/Bart_Uses_Google.html
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
Pick your favorite algorithm and do it yourself!
There are enough ready algorithms written in C/C++, just do a google search.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
PI/4=1-1/3+1/5-1/7+1/9-1/11.....
|
|
|
|
|
hi all,
I know the STL class deque is a sort of a sorted vector.
i have a data class as follows:
class CMyData
{
public:
CString m_szStr1;
CString m_szStr2;
}
then i insert this data class to the deque as follows:
m_deque.push_back(pMyData);
what do i need to write to determine the sorting rule??? according to what the deque sorts its elemets???
thanks in advanced
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Actually, a std::deque is not like a sorted vector -- it's a vector that has constant time insertion/removal from both ends (instead of just the end). The name "deque" means "double-ended queue".
http://www.sgi.com/tech/stl/Deque.html[^]
If you want a sorted collection, use a std::set .
- Mike
|
|
|
|
|
hi,
thanks for the reply, i know understand what you mean....
i can't use set because i can allow duplicated items....what else can u suggest?
thanks again
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
|
thanks a lot man
that helped me!
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Is it possible to easily wrap a popup menu into multiple columns. I would like something like the Start menu on Windows XP, but haven't been able to determine if this is a non-standard menu that Microsoft has implemented. I don't see anything in the SDK documentation to select between scrolling or wrapping popup menus.
Thanks.
Neal Stublen
http://www.awesoftware.com
|
|
|
|
|
You may be able to get somewhere using Owner Draw menus, other than that I think you are on your own.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|