16 May 2013

How to enable and use the "Run As" feature in Windows Server 2003

Enable the Secondary Logon Service

By default, the Secondary Logon service starts automatically when you start Windows. However, an administrator can disable the service. To enable the service if it is disabled:
Log on as Administrator or as a member of the Administrators group.
Click Start, point to Administrative Tools, and then click Computer Management.
Expand Services and Applications, and then click Services.
In the right pane, right-click Secondary Logon, and then click Properties.
Click the General tab.
In the Startup type box, click Automatic, and then click Start under Service status.
Click OK, and then close the Computer Management window.
Use Run As to Start a Program as Another User

To use the "Run as" feature to start a program as another user:
Locate the program that you want to start in Windows Explorer, the Microsoft Management Console (MMC), or Control Panel.
Press and hold down the SHIFT key while you right-click the .exe file or icon for the program, and then click Run as.
Click The following user.

In the User name and Password boxes, type the user name and password of the user whose credentials you want to use to run the program, and then click OK.
NOTE: You can also use the runas command from a command prompt. For more information, click Start, and then click Run. In the Open box, type cmd, and then click OK. At the command prompt, type runas /?, and then press ENTER.

01 March 2013

SysOperationProgress - using progress bar in operation

SysOperationProgress is a class to use operation progress indicator

find the below sample code for an example:

static void SysOperationProgress_PrimeNumber(Args _args)
{
#avifiles
boolean checkPrime,_showProgess = true;
SysOperationProgress progressBar = new SysOperationProgress();//
int counter,out;
;
counter = 1;
out = 1000;
while(counter < out)
{
checkPrime = ((counter mod 2)!=0 && (counter mod 3) !=0);

if(checkPrime)
{
info(strfmt("its a prime number %1",counter));
}
progressBar.setCaption(strfmt("Generating the prime number for %1",counter));
progressBar.setAnimation(#aviUpdate);//#AviFindFile);
progressBar.setText(strfmt("Processing %1 out of %2",counter,out));
counter++;
}
}

27 February 2013

New line or break lines with windows applications like OutLook,HTML and XML

When ever sending the email by using the parameters:
to show receive email line by line in out look have to use
while passing the parameter:

Ex:
while()
{
log = strfmt('Messge for body line'+ '');// to break lines when interfacing with windows applications

}
Class::emailNotification('abc@yahoo.com','xyx@yahoo.com','Subject txt',log)



//in log varialble there are multibple lines so
is the tab to break lines and show in out look mail.

Static void emailNotification(str fromEmail, str toEmail,str subject, str body)
{
SysMailer mailer = new SysMailer();
SysEmailParameters parameters = SysEmailParameters::find();
;
if (parameters.SMTPRelayServerName)
{
mailer.SMTPRelayServer(parameters.SMTPRelayServerName,
parameters.SMTPPortNumber,
parameters.SMTPUserName,
SysEmailParameters::password(),
parameters.NTLM);
}
else
{
mailer.SMTPRelayServer(parameters.SMTPServerIPAddress,
parameters.SMTPPortNumber,
parameters.SMTPUserName,
SysEmailParameters::password(),
parameters.NTLM);
}
mailer.fromAddress(fromEmail);
mailer.tos().appendAddress(toEmail);
mailer.subject(subject);
mailer.htmlBody(body);
mailer.sendMail();
}
Thanks for reading..:-)

21 February 2013

Date Time / UTCDateTime

static void DateTime(Args _args)
{
UtcDateTime dateTime;
;
dateTime = DateTimeUtil::newDateTime(systemdateget(),DateTimeUtil::time(DateTimeUtil::getSystemDateTime()));
info(datetime2str(dateTime));

}

08 February 2013

X++ code to open a form or menuitem AXAPTA

how to open a form by using x++ code:

static void OpenDisplayMenuItem()
{
Args args = new Args();
;
args.record(VendTable::find("XYZ"));
new MenuFunction(MenuItemDisplayStr(VendTable),MenuItemType::Display).run(Args);
}

------
static void OpenForm()
{ FormRun formRun;
Args args = new Args();
;
args.name(formstr(VendTable));
args.record(CustTable::find("XYZ"));

formRun = ClassFactory.formRunClass(args);
formRun.init();
formRun.run();
formRun.wait();
}

AX2012