|
MsmVc wrote: AnyBody Copy or past in particullar drive like C:\. then make copy these file in some different directory like D:\.
Are you wanting this second copy to take the place of the first copy, or do you want it to happen in addition to?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Hi all,
I have one query. I am able to run any .exe using createProcess() by giving the complete path of exe as first parameter.
If I want to run diskmgmt.msc then I click on Start->run-> "type here diskmgmt.msc". Now I want to execute this disk management by using createprocess method.
Please suggest me that how can I do this?
Thanks.
|
|
|
|
|
Madan Chauhan wrote: If I want to run diskmgmt.msc then I click on Start->run-> "type here diskmgmt.msc". Now I want to execute this disk management by using createprocess method.
The process for running msc files is C:\WINDOWS\system32\mmc.exe .
So for e.g. you wanna run an msc file called perfmon.msc then you've got to pass it on as a command line argument...
C:\WINDOWS\system32\mmc.exe perfmon.msc
So for disk management msc file we'll go like this...
C:\WINDOWS\system32\mmc.exe diskmgmt.msc
Another option is to use ShellExecuteEx without worrying about which exe should be used for opening a file. The Shell will decide. But limitations being that you cannot wait on the process handle.
Nibu babu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
mmc.exe (Microsoft Management Console) is the host executable that actually runs when you open diskmgmt.msc . So spawn mmc.exe by using CreateProcess() . For instance,
STARTUPINFO si;
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
PROCESS_INFORMATION pi;
ZeroMemory( &pi, sizeof(pi) );
CreateProcess( NULL,
_T("mmc.exe diskmgmt.msc"),
NULL,
NULL,
FALSE,
0,
NULL,
NULL,
&si,
&pi );
Well, If you just want to open the DiskManagementConsole, then ShellExecute() can do it more easily.
ShellExecute( 0, _T("open"), _T("diskmgmt.msc"), 0, 0, SW_SHOW );
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
|
ptr_Electron wrote: Application crashes even before window is displayed, I found it is @ the below statement. But onlye in the release build, fine with the debug build
Why repost? Asking in the same thread will get you more polite answers?
BTW adding debug information to your release builds will help, then check in debugger to see which variable is NULL.
Nibu babu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
Hello,
I am trying to change the Back Ground color of highlight when a text is selected in Rich edit control to Yellow color.
The problem is it does not leave the default Black color and mixes the Yellow with Black to generate a Highlight of Blue instead of yellow.
Mentioned below is the code:
void CEditSubClass::OnChange()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CEdit::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
CString strText;
int nLengthofString , i;
this->GetWindowText(strText);
nLengthofString = this->GetWindowTextLength();
//get pointer to htmlsourcebar
CMainFrame* pWnd = (CMainFrame*)(AfxGetMainWnd());
ASSERT_VALID(pWnd);
CHtmlSourceView* pHtmlView = pWnd->GetHtmlSourceBar();
CString m_txtHtmlViewSourceUpper;
//populate the FINDTEXTEX structure
FINDTEXTEX ft;
ft.chrg.cpMin = 0;
ft.chrg.cpMax = -1;
ft.lpstrText = (LPSTR) LPCTSTR(strText);
//find text
i = pHtmlView->m_ctlHtmlViewSource.FindText(FR_DOWN,&ft);
COLORREF crBkYellow = RGB(255,255,0);
CHARFORMAT2 fmt;
::memset(&fmt,0,sizeof(fmt));
fmt.cbSize = sizeof(fmt);
fmt.dwMask = CFM_BACKCOLOR;
fmt.dwEffects = 0;
fmt.crBackColor = crBkYellow;
long lResult = ::SendMessage(pHtmlView->m_ctlHtmlViewSource.GetSafeHwnd(), EM_SETCHARFORMAT, (WPARAM)SCF_SELECTION, (LPARAM)&fmt);
//set the selection
pHtmlView->m_ctlHtmlViewSource.SetSel(i,i+nLengthofString);
pHtmlView->m_ctlHtmlViewSource.HideSelection(FALSE,TRUE);
}
I would be thankful to some one who can help me out.
Ritesh
|
|
|
|
|
Hello everyone,
My question is about how many instances' copies are made when inserting new elements into map. Here is my code and questions.
1.
I think when not using pair, there will be one instance copied, from string instance named MikeName to the int key "1" related string instance in the map, and map maintains a separate indepenent copy of string instance from MikeName other than just making a reference to DavidName?
2.
And using pair will make one additional instance copy, from from string instance named MikeName to pair (pair will maintain a separate instance other than just making a reference), and from pair to string instance in the map.
#include <string>
#include <iostream>
#include <map>
#include <utility>
using namespace std;
int main()
{
string MikeName = "Mike";
string DavidName = "David";
map<int, string> Employees;
Employees[1] = MikeName;
pair<int, string> p(2, DavidName);
Employees.insert(p);
return 0;
}
thanks in advance,
George
|
|
|
|
|
George_George wrote: My question is about how many instances' copies are made when inserting new elements into map. Here is my code and questions.
You can simply test this by putting a simple custom class into a map that has a copy constructor and an assignment operator and keep a counter as a member.
Increment the counter in copy constructor/assignment operator. "Also don't forget to copy or assign the counter else you will lose the counter value." Print out this counter to check counter value. You can give an instance a unique name to differentiate between different instances. May be write a small test app!
Or else you can debug through and find.
Nibu babu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
Thanks Nibu,
I found using pair there will be an additional copy -- and my further question is why should we use pair? In what situations should it have more benefits?
regards,
George
|
|
|
|
|
George_George wrote: and my further question is why should we use pair? In what situations should it have more benefits?
It's a long story, and this[^] is one such story.
BTW IMO googling on these questions will help you more, instead of waiting 3 hours for someone to answer your queries.
Nibu babu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
Thanks Nibu,
I have taken one hour to do reading for the great document you referred. But from the document, there is no conclusion what is the special benefits of using pair. Do you have any ideas or comments?
regards,
George
|
|
|
|
|
George_George wrote: I have taken one hour to do reading for the great document you referred
George_George wrote: Do you have any ideas or comments?
Some stl containers do take/return a pair object, that's one of the reason why I would use a pair.
George_George wrote: But from the document, there is no conclusion what is the special benefits of using pair.
Exactly that's why I said it's a long story.
Nibu babu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
Hi Nibu,
Nibu babu thomas wrote: Some stl containers do take/return a pair object, that's one of the reason why I would use a pair.
It means we have to use it...
Any way, could you list your reaons (besides the above one) why and when using pair has special benefits please?
regards,
George
|
|
|
|
|
George_George wrote: It means we have to use it... Smile
Yeah sometimes!
George_George wrote: Any way, could you list your reaons (besides the above one) why and when using pair has special benefits please?
From MSDN:
The two most common uses for a pair are as return types for functions that return two values and as elements for the associative container classes map Class and multimap Class that have both a key and a value type associated with each element. The latter satisfies the requirements for a pair associative container and has a value type of the form pair<const mapped_type="">.
Nibu babu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
Thanks for finding that, but the latter makes additional one copy, correct?
regards,
George
|
|
|
|
|
Hi all,
I am working on RPC client programing(VC6.0).
As I got info from CP that MIDL to be used for client and server stubs.
I have designed an RPC server test application and My client and server
able to communicate succesfully with the stubs generated by MIDL.
But If I have an Linux server or any third party windows server, then how to design my client?
How can I get the client stub.
Regards,
Sunil Kumar
|
|
|
|
|
there are basically two RPC 'derivatives'/Implementations for a better word
Microsoft
ONC/Sun
unfortunately, Microsoft isnt compatable with ONC/Sun (and v-v) .. so, if you're on a windows box for example, and you want to RPC to a *nix box, you need a win32 port of ONC RPC - luckily, someone else has thought of this and (last time I checked) there were two versions out there.
it really depends on the implementation/version of RPC the 'other end' is using
thats a very brief sketch only, you'll need to research more than that
'g'
|
|
|
|
|
Thanka a lot for your info.
Regards,
Sunil Kumar
|
|
|
|
|
Hi guyz,
I just want to know if there's a limit on vector size.
What is the maximum vector size?
I'm using a vector of CString and store about 100K+ absolute path
and experience program hang. Am I reaching the vector's limit?
Hope you can help me thanks.
|
|
|
|
|
TooShy2Talk wrote: I just want to know if there's a limit on vector size.
Use max_size member function of std::vector.
Nibu babu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
Hi,
Does anyone use these classes, or the new Ribbon control in the MFC update?
Has anyone considered inheriting from them?
I'm looking to insert a DateTime picker control into a ribbon, and thinking of inheriting from CMFCRibbonBase element. I've had a look around, and cant find anyone else inheriting from these. Surely someone has tried it?!?!
thanks,
Mark.
|
|
|
|
|
Hi All,
Can Anyone guide me on how to pass float or double argument in _beginthread() function in argument list (3rd) argument?
I need to complete my assinment asap so it would be great if anyone can help me out.
Thanks.
|
|
|
|
|
you can just pass the address to the call of _beginthread and do a cast to a (double *) in the thread function.
|
|
|
|
|
You can pass a pointer as Rick suggested. I'll add this...
make sure the object pointed to stays in scope
double mydouble = 4.2;
_beginthread(&mythreadproc, 0, &mydouble); <code><-- BAD!!! mydouble may go out of scope before spawned thread uses it!</code>
return;
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|