Click here to Skip to main content
15,910,980 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Directory changes detection Pin
Michael Dunn9-Aug-01 15:51
sitebuilderMichael Dunn9-Aug-01 15:51 
GeneralPing From Code Pin
AJ1239-Aug-01 0:21
AJ1239-Aug-01 0:21 
GeneralRe: Ping From Code Pin
9-Aug-01 1:04
suss9-Aug-01 1:04 
GeneralMFC DLLs and Static Libraries Pin
8-Aug-01 21:30
suss8-Aug-01 21:30 
GeneralRe: MFC DLLs and Static Libraries Pin
Tomasz Sowinski9-Aug-01 4:06
Tomasz Sowinski9-Aug-01 4:06 
GeneralAdding minimize button to a toolbar window Pin
Reno Tiko8-Aug-01 19:57
Reno Tiko8-Aug-01 19:57 
GeneralPlease help me with some buttons... Pin
8-Aug-01 18:08
suss8-Aug-01 18:08 
GeneralRe: Please help me with some buttons... Pin
Derek Waters8-Aug-01 21:10
Derek Waters8-Aug-01 21:10 
1) You just need to a create a normal command button to do this. In the command handler, you just need to call:

ShowWindow(SW_MINIMIZE);


2) To access an outside readme file, I assume you mean you want to use the user's default viewer to view an external file. If so, the easiest way is to use ShellExecute with the "open" verb, which will look up the user's selected text file viewer for you. I usually try to open the file in Notepad if it fails:

int viRes = (int)ShellExecute(GetSafeHwnd(), "open", "my_file_to_read.txt", NULL, "C:\\Temp", SW_SHOW );
if (viRes == SE_ERR_NOASSOC)  // The user has no associated viewer for ".txt"
{
	STARTUPINFO			vtStartupInfo;
	PROCESS_INFORMATION	vtProcessInfo;
	CString				vcstrCommand;
	CString				vcstrParams;
	DWORD				vdwLen;

	vdwLen = GetWindowsDirectory(vcstrCommand.GetBuffer(_MAX_PATH), _MAX_PATH);
	vcstrCommand.ReleaseBuffer(vdwLen);

	vcstrCommand += "\\Notepad.exe";
	vcstrParams = vcstrCommand + " ";
	vcstrParams += m_cstrLogFilename;

	memset(&vtStartupInfo, 0, sizeof(vtStartupInfo));
	vtStartupInfo.cb = sizeof(vtStartupInfo);
	if (!CreateProcess(vcstrCommand, vcstrParams.GetBuffer(vcstrParams.GetLength()), NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS, NULL, NULL, &vtStartupInfo, &vtProcessInfo))
	{
		vcstrParams.ReleaseBuffer();
		CString	vcstrMsg;
		vcstrMsg.Format("The logfile \"%s\" could not be opened using Notepad.", (LPCTSTR)m_cstrLogFilename);
		AfxMessageBox(vcstrMsg);
	}
	else
		vcstrParams.ReleaseBuffer();
}
else if (viRes < 32) // ShellExecute returns < 32 to indicate an error.
{
	CString	vcstrMsg;
	vcstrMsg.Format("The logfile \"%s\" could not be opened using your default viewer.", (LPCTSTR)m_cstrLogFilename);
	AfxMessageBox(vcstrMsg);
}


Hope this helps.

------------------------
Derek Waters
derek@lj-oz.com
GeneralRe: Please help me with some buttons... Pin
9-Aug-01 7:22
suss9-Aug-01 7:22 
GeneralSSPI context Pin
Farah Mansor8-Aug-01 16:08
Farah Mansor8-Aug-01 16:08 
GeneralRe: SSPI context Pin
Tomasz Sowinski9-Aug-01 3:54
Tomasz Sowinski9-Aug-01 3:54 
GeneralRe: SSPI context Pin
Farah Mansor9-Aug-01 15:20
Farah Mansor9-Aug-01 15:20 
GeneralRe: SSPI context Pin
Tomasz Sowinski10-Aug-01 0:44
Tomasz Sowinski10-Aug-01 0:44 
GeneralRe: SSPI context Pin
Farah Mansor12-Aug-01 23:58
Farah Mansor12-Aug-01 23:58 
GeneralRe: SSPI context Pin
Tomasz Sowinski13-Aug-01 0:28
Tomasz Sowinski13-Aug-01 0:28 
QuestionHow to kill the child process,who creates others processes, and it's all sub-processes? Pin
8-Aug-01 16:01
suss8-Aug-01 16:01 
AnswerRe: How to kill the child process,who creates others processes, and it's all sub-processes? Pin
Tomasz Sowinski9-Aug-01 4:13
Tomasz Sowinski9-Aug-01 4:13 
GeneralCListCtrl Pin
Mathew8-Aug-01 14:57
Mathew8-Aug-01 14:57 
GeneralRe: CListCtrl Pin
Tomasz Sowinski9-Aug-01 3:14
Tomasz Sowinski9-Aug-01 3:14 
GeneralRe: CListCtrl Pin
Mathew9-Aug-01 11:34
Mathew9-Aug-01 11:34 
GeneralRe: CListCtrl Pin
Tomasz Sowinski10-Aug-01 0:25
Tomasz Sowinski10-Aug-01 0:25 
Generalhello, i need a little help with some code Pin
Cnoob8-Aug-01 14:57
Cnoob8-Aug-01 14:57 
GeneralRe: hello, i need a little help with some code Pin
Christian Graus8-Aug-01 15:09
protectorChristian Graus8-Aug-01 15:09 
GeneralGlobal variables Pin
otvac8-Aug-01 14:42
otvac8-Aug-01 14:42 
GeneralRe: Global variables Pin
Christian Graus8-Aug-01 14:44
protectorChristian Graus8-Aug-01 14:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.