|
For example, I want to launch the below file
C:\Windows\Tasks\Low Battery Alarm Program.job
What function can I use to launch the file in VC++ ?
|
|
|
|
|
Can it be executed by just double clicking on it?
If can, you can use ShellExecute(...) to start it, I think.
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
Hi,
Through my Windows service i want to create a COM control under some specific user credentials.Do achive this i am doing following set of activities.
a)Calling impesonation API
b)Laoding user profile,environment vaiables for impersonated account
c)Creating a browser control
d)Setting a authentication information that will be used to make calls on
the browser control using CoSetProxyBlanket() API
Even after following above steps, control is getting created under SYSTEM user account.Do need to use to do anything extra like setting DACL?.
What could be the problem?.
thanx in advance.
Here with i am attaching the code
//***************************************
HANDLE hProcToken;
IWebBrowser2 *g_WebBrowser2;
LPSTREAM g_lpStream;
void InitialiseControl()
{
if (!LogonUser( szUserName,
szDomain,
szPassword,
LOGON32_LOGON_NETWORK,
LOGON32_PROVIDER_DEFAULT,
&m_hToken))
{
if (ImpersonateLoggedOnUser(m_hToken))
{
//I am loading user profile,environment vaiables for impersonated
//account and setting WindowStation/Desktop to "winStat0/Desktop"
CoInitialize(NULL);
//Create IBrowserControl instance
HRESULT hr = CoCreateInstance( CLSID_InternetExplorer,NULL,
CLSCTX_INPROC_SERVER,IID_IWebBrowser2,
(void**)&g_WebBrowser2 );
hr = CoSetProxyBlanket(g_WebBrowser2,RPC_C_AUTHN_WINNT,
RPC_C_AUTHZ_NONE, NULL,
RPC_C_AUTHN_LEVEL_DEFAULT,
RPC_C_IMP_LEVEL_IMPERSONATE, // Allow impersonation
NULL,EOAC_DYNAMIC_CLOAKING);
//Marshal interface pointer as browser control is single threaded control
hr = CoMarshalInterThreadInterfaceInStream(
IWebBrowser2 ,g_WebBrowser2,
&g_lpStream );
}
}
} //End Of InitialiseControl
//This method loads HTML page and prints to default printer,this method is called from seperate thread
void Print( char* l_strFileName )
{
if (ImpersonateLoggedOnUser(m_hToken))
{
COleVariant vaURL( l_strFileName );
COleVariant noArg;
CoInitialize(NULL);
//Unmarshal interface pointer
hr = CoGetInterfaceAndReleaseStream( (IStream*)g_lpStream,
IID_IWebBrowser2,(void**)&g_WebBrowser2 );
hr = g_WebBrowser2->Navigate2(vaURL,&noArg,&noArg,
&noArg,&noArg);
//Wait till document gets loaded completely
hr = g_WebBrowser2->ExecWB (OLECMDID_PRINT,
OLECMDEXECOPT_DONTPROMPTUSER
,&noArg,&noArg);
}
}
|
|
|
|
|
The COM register utility allow you to activate activeX or COM server based on user. Normal regsvr32 can't do that but this one can.
You have to thank Rama Krishna for his wonderful article.
http://www.codeproject.com/w2k/regsvrex.asp
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
Hi all,
I am a Beginner in Vc++. I made some dialoge box which includes Three Command button, namely OK,Cancel any Apply.
I want to do operation like Enable/Disable on Apply Button.
So,Please provide me some idea to this work.
Regards
Rajesh
rajesh
|
|
|
|
|
this is the code for want you want about Apply Button
note:IDC_Apply is the id of your Apply Button
CButton* ApplyButton ;
ApplyButton =(CButton*)GetDlgItem(IDC_Apply);
ApplyButton->EnableWindow(false);
ApplyButton->EnableWindow(true);
|
|
|
|
|
Hmmmm
One small thing - EnableWindow takes a BOOL, not a bool.
EnableWindow(false) is not the same as EnableWindow(FALSE) which is what it should be.
Other thing, the 'ApplyButton=(CButton*)GetDlgItem' works only because of MFC. Most people, including me, are gulity of doing it this way - but the recomened MFC way (if you dont belive me, read MSDN) is actually like this.
CButton but;
but.Attach(GetDlgItem(IDC_Apply)->GetSafeHwnd());
but.EnableWindow(FALSE);
but.Detach();
More code I know, but your not relying on the evils of non RTTI-safe downcasting.
|
|
|
|
|
the function EnableWindow allow you to do that.
you can find it in one of the base classes of your control (here, a CButton) : Cwnd
BOOL Cwnd::EnableWindow(BOOL bEnable = TRUE);
<font style="color:green;">
TOXCCT >>> GEII power
|
|
|
|
|
I need some help designing a UI which supports both compact as well as full mode. Any ideas or articles written about this will be greatly appreciated. Also since i have a time constraints which language should i go for. Can code in VB,VC and C# but am not a UI guru.
|
|
|
|
|
FASTian wrote:
I need some help designing a UI which supports both compact as well as full mode.
What do you mean by "compact" and "full" mode?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
what i mean by compact mode is that while in compact mode we only show a limited UI meaning that it shows only neccessary values whereas full mode means that i might want to show graphs and other UI related material which is only adds on to the application.
|
|
|
|
|
Here are two different ways:
http://www.codeproject.com/dialog/dlgboxtricks.asp (see section titled Expanding and Contracting your dialog boxes)
http://www.codeproject.com/dialog/dlgexpand.asp
I prefer the latter.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
thanks for the help
|
|
|
|
|
hi.
any one have Network programming (Microsoft Press)in VC++ soft copy ... other help abut it..
thanx
|
|
|
|
|
Yes, and before you ask, you'll need to go and buy it, as it does not come with an MSDN style electronic copy of the book on CD.
|
|
|
|
|
Giles wrote:
it does not come with an MSDN style electronic copy of the book on CD
Network Programming in Microsoft Windows is available as a soft copy (CHM). I have it... It is about 2.2 MB
- Nirav
* Don't wish it was easier, wish you were better! *
|
|
|
|
|
Hi,,
PLZ send me CHM copy
or its link at zahid_ash@yahoo.com
thanx
|
|
|
|
|
Sent it... Check your mailbox and acknowledge!
* Don't wish it was easier, wish you were better! *
|
|
|
|
|
now I am using MSFlexGrid to show some datas and want to merge two rows into one row(two coloums into one coloum),codes below:
m_FlexGrid.SetCols(4);
VARIANT var;
var.vt=VT_I2;
for(int i=1;i<5;++i)
{
var.intVal=i;
m_FlexGrid.AddItem("Test",var);
}
m_FlexGrid.SetMergeCells(1);
m_FlexGrid.SetMergeRow(0,0);
m_FlexGrid.SetMergeRow(1,1);
m_FlexGrid.SetMergeRow(2,1);
it is the first time to use it, and not found some materials.so please help me,thanks a lot
|
|
|
|
|
hello friends,
i wish to Shell execute/create process either a word doc/pdf and then restrict cut/copy/paste/save/save as /print options (both menu & key shortcuts).
thank u very much
kumuda
|
|
|
|
|
Hi
Could someone tell me how I can get an arbitrary-length line from std::cin without fear of buffer overrrun, while still accomodating very long lines? I can use cin.getline(), but that way I have to define a buffer with a fixed size first.
Thanks!
|
|
|
|
|
#include <iostream>
#include <string>
int main() {
std::string line;
std::getline(std::cin, line);
std::cout << line << '\n';
}
That should do it. std::getline is a mightily useful function that works on any and all input streams. It resides in <string> . If you want to use an alternate "line separator" there is an overloaded std::getline for this as well.
Hope it helps.
--
Henrik Stuart (http://www.unprompted.com/hstuart/[^])
|
|
|
|
|
this is probably so simple but maths is not my strong point
I need a function to mathamatically round values.
Something like this
double Round(double val, long precision)
{
}
for example
Round(0.75621, 4) would return 0.7562
Round(0.75625, 4) would return 0.7563
Round(-0.75621, 4) would return -0.7563
Round(-0.75625, 4) would return -0.7562
any help would be great
|
|
|
|
|
|
too easy! thank you very much
|
|
|
|