|
When i run the following command in console at non-admin account
runas.exe /u:Administrator cmd.exe"
Note: It will prompt to ask admin password :
if we enter admin pwd the console says it will run at admin account(at titlebar)
In that console ,i have typed boot.ini and press enter.
The boot.ini file is opened in notebad.If i edit that it will saved.
can i achieve this via VC++.
I need to get pwd in dialog and pass to console (for Note:)
|
|
|
|
|
pooja_friends wrote: can i achieve this via VC++.
Yes
SHELLEXECUTEINFO shExecInfo;
shExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
shExecInfo.fMask = NULL;
shExecInfo.hwnd = NULL;
shExecInfo.lpVerb = _T("runas");
shExecInfo.lpFile = _T("notepad.exe");
shExecInfo.lpParameters = _T("c:\\boot.ini");
shExecInfo.lpDirectory = NULL;
shExecInfo.nShow = SW_MAXIMIZE;
shExecInfo.hInstApp = NULL;
ShellExecuteEx(&shExecInfo)
|
|
|
|
|
Thanks its working
If run the above code,it asks "which user account do you want to run this program"
I need to set administrator as default without asking user.Get password from user and login to edit boot.ini from command line.
how i do that.
|
|
|
|
|
Prompt for the password yourself in your application, and use CreateProcessWithLogonW .
|
|
|
|
|
can u give me sample code for CreateProcessWithLogonW please
|
|
|
|
|
It's fully documented in MSDN.
|
|
|
|
|
Hi,
I am trying to write to a 24 col printer which has a centronics connector i.e., parallel printer connector and if I write to the LPT1 using following code it works fine.
hLPT = CreateFile("LPT1",GENERIC_WRITE, 0,
0, CREATE_ALWAYS, FILE_FLAG_NO_BUFFERING, 0);
if(hLPT == INVALID_HANDLE_VALUE)
{
AfxMessageBox("Cannot open port");
return 0 ;
}
WriteFile(hLPT,str,size,&lLen,NULL);
ch = 0x0F;
WriteFile(hLPT,&ch,1,&lLen,NULL);
CloseHandle(hLPT);
But as I am using USB to Parallel convertor I have used "USB001" in place of LPT1 But it is not printing. Is there any solution for this.
Thankx
Murali. S
|
|
|
|
|
Possibly you've to read the converter specification (and possibly again ask for support the converter's manufacturer).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
How do you compile this whole project in Visual C++ Express Edition ? The link is below ?
http://www.codeproject.com/KB/cpp/loggerservice.aspx
Will simply creating a new project and inserting all the files and then clicking Build Solution help ?
I don't want you to do this for me. I want to learn how all this will happen?
Any link to guide would be really appreciated.
|
|
|
|
|
Apparently there are project files in the zip. So, just extract everything somewhere and double click on the .dsw file. VC will ask you if you want to convert the project (because it was done with VC6) and say yes. Then just recompile it.
|
|
|
|
|
There are two .dsw files now which one to compile? I opened both and clicked on Build Solution but in one I got this error
d:\usr\src\logger\stdafx.h(28) : fatal error C1083: Cannot open include file: 'atlbase.h': No such file or directory
And in another I got this ?
d:\usr\src\logger\loggertest\stdafx.h(15) : fatal error C1083: Cannot open include file: 'afxwin.h': No such file or directory
I'm using Visual C++ 2008 Express Edition
modified on Thursday, July 24, 2008 6:21 AM
|
|
|
|
|
Would I be able to compile this project with Visual C++ 2008 Express Edition I have heard that it does not suppports MFC, what to do now
|
|
|
|
|
manzoor10 wrote: it does not suppports MFC, what to do now
You can either convert all the ATL/MFC code so it no longer uses those
or you can obtain a full version of Visual Studio.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
None that I know of.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I didn't look at the article in details but you could perhpas only reuse the files that are not part of the application itself (so, only the usefull sources). But again, you'll have to see it for yourself which ones are needed...
|
|
|
|
|
Hi Experts,
I am creating tree of logical drive(c,d, etc..) as soon as user click on eithr drive leeter or folder name but If the tree is being made for drive c and user click on drive d inbetween then what is fast and accurate method to end the thread of drive c and begin thread of drive d.
|
|
|
|
|
When you are creating a thread?
-@SuDhIrKuMaR@-
|
|
|
|
|
As user click on drive letter
|
|
|
|
|
If it worker thread :- check for a boolean variable every time before finding new file. if you want to close that thread simply set the boolean variable ( and write the exit code of thread from there), as the loop is checking it everytime before going to find new file.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David CrowNever mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/IV
Support CRY- Child Relief and You
|
|
|
|
|
GetExitCodeThread(hTread->m_hThread, &exitcode);
if (exitcode != STILL_ACTIVE )
It will tell you the status of the thread,Then take a decision what to do.
-@SuDhIrKuMaR@-
|
|
|
|
|
sorry if i sound rude, I believe he looking for solution/logic for instantly ending of thread.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You/xml>
|
|
|
|
|
Now let us have two classes one is a base class & there is a virtual method. Again there is a derived class & we override that method & the access is private, through the base class pointer we assign the derived class object & call the virtual method then which method will be called & why?
|
|
|
|
|
The derived one will be called.
This will be decided at run-time, as the pointer is pointing to a derived class, the derived class version should be called.
--
"Programming is an art that fights back!"
|
|
|
|
|
You are correct. Let me give the snapshot.
class BaseClass
{
public:
virtual void Display();
};
void BaseClass:isplay()
{
printf("Hello BaseClass\n");
}
class DerivedClass : public BaseClass
{
private:
void Display();
};
void DerivedClass:isplay()
{
printf("Hello DerivedClass\n");
}
int main(int argc, char* argv[])
{
printf("Hello World!\n");
BaseClass* pBaseClass = NULL;
DerivedClass* pDerivedClass = new DerivedClass();
pBaseClass = pDerivedClass;
pBaseClass->Display();
delete pDerivedClass;
return 0;
}
In this case the method is private in the derived class, so if we can call this private method from another class then what is the meaning of encapsulation in C++?
|
|
|
|