|
Take a look at Managed Templates[^]
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
emira67 wrote: Visual C++ recognise getvalue and setvalue function ,but couldn't print anything and gave a lot of error interested with array1 template
Do you mean compilation errors? If so, tell us what they were...Because after correcting the obvious syntax error (you missed off the trailing }; of the template class definition), that code compiled, linked and ran inside a C++ WinForms application built in VS2008
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
It was compiler error that VS2008 gave.These errors lik these:
error C3861: 'function': identifier not found
error C2065: 'A' : undeclared identifier
In fact I declared this items!!!
Could you help me please?
|
|
|
|
|
emira67 wrote: In fact I declared this items!!!
But obviously not somewhere that the code that used the items was able to see them.
emira67 wrote: Could you help me please?
If you posted some more detail (the filename that you put the template class & function declaration in, the code that uses the matrix and function), then possibly. However, your code is syntactically and semantically correct - you've just organised it so that the code that uses those things can't see them. Check through your code to understand why!
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
hi all,
i have written a small service.now when i install the service, the service gets installed what i feel but is not able to start. using an installer i am installing the service application in windows vista.
it gives out an error during installation, when the service is getting started.
it throws an error as follows:
Create process failed: error code 14001. the application has failed to start because the application configuration is incorrect. reinstalling the application may fix the problem.
i tried reinstalling, however the same problem persists...
i am pasting the code below,, for initial main, service installation and service start functions..please can i get some help on fixing the error....
*///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void __cdecl _tmain(int argc, char **argv)
{
HKEY hKeyHandle;
DWORD dwDataToWrite = 1;
if( argc == 3 )
{
printf("ERROR:\tIncorrect number of arguments\n\n");
return;
}
char *arg1 = argv[1];
char *arg2 = argv[2];
if(_strnicmp(arg1, "install", 7) == 0)
{
if(!PathFileExists(arg2 ))
{
exit(1);
}
if (InstallService(arg2))
{
MessageBox(NULL,"Service installed successfully",Message,MB_OK);
}
else
{
MessageBox(NULL,"Error in service installation",Message,MB_OK);
exit(2);
}
}
else if (lstrcmpi( arg1, TEXT("uninstall")) == 0 )
{
if(!ServiceDelete())
{
MessageBox(NULL,"Error in Un-installing",Message,MB_OK);
exit(3);
}
}
else if (lstrcmpi( arg1, TEXT("enable")) == 0 )
{
if (!EnableService())
{
MessageBox(NULL,"Error in enabling",Message,MB_OK);
exit(4);
}
}
else
exit(0);
SERVICE_TABLE_ENTRY DispatchTable[] = {
{ SRVCNAME, (LPSERVICE_MAIN_FUNCTION) SvcMain },
{ NULL, NULL } };
StartServiceCtrlDispatcher(DispatchTable);
}
// Service main function for the service
VOID WINAPI SvcMain(DWORD dwArgs,LPTSTR *lpszArgv)
{
DWORD dwErr = 0;
debug_log("In Service Main-The Entry Point for Service");
// Register the handler function to service
svcStatusHandle = RegisterServiceCtrlHandlerEx(TEXT(SRVCNAME),(LPHANDLER_FUNCTION_EX)SvcCtrlHandler,NULL);
if(!svcStatusHandle)
{
debug_log("Failed to register service handler function error(%d) returned",GetLastError());
(VOID)ReportServiceStatus(SERVICE_STOPPED,dwErr,0);
return;
}
// service status members remain same as set here.
svcStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
svcStatus.dwServiceSpecificExitCode = 0;
if(!ReportServiceStatus( SERVICE_START_PENDING, NO_ERROR, 3000 ));
CleanupHandles();
//Start the service...
ServiceStart(dwArgs,lpszArgv);
debug_log("Exiting Service Main");
}
//Function for installing the service in SCM database
BOOL InstallService(char *szPath)
{
SC_LOCK sclLock;
LPQUERY_SERVICE_LOCK_STATUS lpqslsBuf;
SERVICE_DESCRIPTION sdBuf;
DWORD dwBytesNeeded;
BOOL bSuccess=TRUE;
SC_ACTION sca[3];
SERVICE_FAILURE_ACTIONS sfaBuf;
debug_log("Installing service now...");
//Get a handle to SCM database..
schSCManager = OpenSCManager(NULL,NULL,SC_MANAGER_CREATE_SERVICE | SC_MANAGER_ALL_ACCESS | SC_MANAGER_LOCK | SC_MANAGER_QUERY_LOCK_STATUS);
if (schSCManager == NULL)
{
debug_log("Failed to open SCM database, error-(%d) returned\n",GetLastError());
return false;
}
else debug_log("Connection to SCM database success");
LPCTSTR lpszBinaryPathName= szPath;
// If database opened create the service
schService = CreateService(schSCManager,SRVCNAME,SRVCNAME,SERVICE_ALL_ACCESS,SERVICE_WIN32_OWN_PROCESS | SERVICE_INTERACTIVE_PROCESS,SERVICE_AUTO_START, SERVICE_ERROR_NORMAL,lpszBinaryPathName,NULL,NULL,NULL,NULL,"");
if(schService == NULL)
{
debug_log("Error in creating service,[%d] error code returned",GetLastError());
return false;
}
else debug_log("Service %s created and installed",SRVCNAME);
CloseHandle(schService);
// service config change to specify action on failure
debug_log("Acquiring lock on SCM database");
sclLock = LockServiceDatabase(schSCManager);
if (sclLock == NULL)
{
if (GetLastError() != ERROR_SERVICE_DATABASE_LOCKED)
{
debug_log("Database Lock failed");
return FALSE;
}
// Allocate buffer to det details about the lock
lpqslsBuf = (LPQUERY_SERVICE_LOCK_STATUS)LocalAlloc(LPTR,sizeof(QUERY_SERVICE_LOCK_STATUS)+ 256);
if (lpqslsBuf == NULL)
{
debug_log("Local alloc failed");
return FALSE;
}
// Get the lock status information
if(!QueryServiceLockStatus(schSCManager,lpqslsBuf,sizeof(QUERY_SERVICE_LOCK_STATUS)+256,&dwBytesNeeded))
{
debug_log("Query lock status failed");
return FALSE;
}
if (lpqslsBuf->fIsLocked)
{
debug_log("Already locked by %s",lpqslsBuf->fIsLocked);
}
else
LocalFree(lpqslsBuf);
}
//if database is locked make the changes
schService= OpenService(schSCManager,SRVCNAME,SERVICE_ALL_ACCESS | SERVICE_CHANGE_CONFIG);
if (schService == NULL)
{
debug_log("Open service failed");
return FALSE;
}
sca[0].Type = SC_ACTION_RESTART;
sca[0].Delay = 1;
sca[1].Type = SC_ACTION_RESTART;
sca[1].Delay = 1;
sca[2].Type = SC_ACTION_RESTART;
sca[2].Delay = 1;
sfaBuf.cActions = 3;
sfaBuf.lpsaActions = sca;
sfaBuf.dwResetPeriod = INFINITE;
sdBuf.lpDescription = "Test Service";
if (!ChangeServiceConfig2(schService,SERVICE_CONFIG_FAILURE_ACTIONS,&sfaBuf))
{
debug_log("Change service config failed");
bSuccess = FALSE;
}
UnlockServiceDatabase(sclLock);
CleanupHandles();
debug_log("Exiting install service...");
return bSuccess;
}
// Start the service
VOID ServiceStart(DWORD dwArgc, LPTSTR *lpszArgv)
{
debug_log("Inside Service Start,Service Started");
SERVICE_STATUS_PROCESS ssStatus;
DWORD dwOldCheckPoint;
DWORD dwStartTickCount;
DWORD dwWaitTime;
DWORD dwBytesNeeded;
// Acquire handle to the SCM database.
schSCManager = OpenSCManager(NULL,NULL,SC_MANAGER_ALL_ACCESS);
if (schSCManager == NULL)
{
debug_log("OpenSCManager failed (%d)\n", GetLastError());
return;
}
// Handle to the service.
schService = OpenService(schSCManager,SRVCNAME,SERVICE_ALL_ACCESS);
if (schService == NULL)
{
debug_log("OpenService failed (%d)\n", GetLastError());
CloseServiceHandle(schSCManager);
return;
}
// Start the service.
if (!StartService(schService,0,NULL) )
{
debug_log("StartService failed error-(%d) returned\n", GetLastError());
CleanupHandles();
return;
}
// Check if the service has started
if (!QueryServiceStatusEx(schService,SC_STATUS_PROCESS_INFO,(LPBYTE) &ssStatus,sizeof(SERVICE_STATUS_PROCESS),
&dwBytesNeeded ) )
{
debug_log("Service status 1 query failed,error[%d] returned",GetLastError());
return;
}
// Check the system start time....
dwStartTickCount = GetTickCount();
dwOldCheckPoint = ssStatus.dwCheckPoint;
while (ssStatus.dwCurrentState == SERVICE_START_PENDING)
{
dwWaitTime = ssStatus.dwWaitHint / 10;
if( dwWaitTime < 1000 )
dwWaitTime = 1000;
else if ( dwWaitTime > 10000 )
dwWaitTime = 10000;
Sleep( dwWaitTime );
// Check the status again.
if (!QueryServiceStatusEx(schService,SC_STATUS_PROCESS_INFO,(LPBYTE) &ssStatus,sizeof(SERVICE_STATUS_PROCESS),
&dwBytesNeeded ) )
{
debug_log("Service status 2 query failed,error[%d] returned",GetLastError());
break;
}
if ( ssStatus.dwCheckPoint > dwOldCheckPoint )
{
// Service is running with system start
dwStartTickCount = GetTickCount();
dwOldCheckPoint = ssStatus.dwCheckPoint;
}
else
{
if(GetTickCount()-dwStartTickCount > ssStatus.dwWaitHint)
{
//Service hasn't been started with system start
debug_log("Service has not started with system startup");
break;
}
}
}
// Determine whether the service is running
if (ssStatus.dwCurrentState == SERVICE_RUNNING)
{
debug_log("Service has been started successfully.\n");
}
else
{
debug_log("Service not started. \n");
debug_log(" Current State: %d\n", ssStatus.dwCurrentState);
debug_log(" Exit Code: %d\n", ssStatus.dwWin32ExitCode);
debug_log(" Check Point: %d\n", ssStatus.dwCheckPoint);
debug_log(" Wait Hint: %d\n", ssStatus.dwWaitHint);
}
// Start the action to be performed by the service..
debug_log("Starting the service init process now,work to be performed by service");
ServiceInit();
debug_log("Exiting Service Start now..");
CleanupHandles();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////******
all the variables used have been declared and there are no compilation error...
using visual studio 2008 for service application development for windows vista...
Thankuou...
|
|
|
|
|
No need to paste the full code of your application. Please read the posting guidelines ("How to get an answer to your question") before posting...
For your problem: are you using VC2005 or VC2008 ? If yes, you have to instal the VC redistributable package on the target platform. This will install the C-runtime and MFC libraries.
You can find this for VC2005 here[^]. IF you need another version of VC (2008, or with a service pack installed), you'll have to search a bit on the website.
|
|
|
|
|
Or you can build you application with Static MCF and CRTL libraries instead of using DLLs. Base distribution for Vista does not include the VS2008 runtime yet.
|
|
|
|
|
i am using vs2008.
i did install the redistributable package on the machine..and still the same problem persists....
|
|
|
|
|
Did you install the redistributable package for VC2008 ?
Otherwise, as someone else mentioned, another solution would be to statically link to the C-runtime and MFC dlls.
|
|
|
|
|
Code Block 1
int iWindExtX = 3500;
int iWindExtY = 4375;
pDC->SetMapMode (MM_ISOTROPIC);
pDC->SetWindowOrg(0,0);
pDC->SetViewportOrg(0,0);
pDC->SetWindowExt(iWindExtX , iWindExtY);
pDC->SetViewportExt(972, 1404);
m_pDC->Rectangle(0, 0, iWindExtX, iWindExtY);
Code Block 2
int iWindExtX = 2500;
int iWindExtY = 4500;
pDC->SetMapMode (MM_ISOTROPIC);
pDC->SetWindowOrg(0,0);
pDC->SetViewportOrg(0,0);
pDC->SetWindowExt(iWindExtX , iWindExtY);
pDC->SetViewportExt(972, 1404);
m_pDC->Rectangle(0, 0, iWindExtX, iWindExtY);
In the above two code blocks the window extend size only differs.
My question is whether drawn rectangle using above two code blocks are of same size?
If differs then please tell me how?
|
|
|
|
|
|
Hi,
I want to read all the entries that are applied through group policy using wmi.
How can i do that ?????????????
“You will never be a leader unless you first learn to follow and be led.”
–Tiorio
"Coming together is a beginning, staying together is progress, and working together is success." Henry Ford
|
|
|
|
|
Hello to all,
can anyone provide me the different IOCTL codes for FTDI driver. I am using FT232BM chip and want IOCTL codes of FTDI driver to change lattency time of the driver.It is really very urgent so plz help me out.
Thanks and Regards,
Anay
|
|
|
|
|
Don't you have some kind of documentation which was supplied with the chip ? I'm afraid those codes are specific to the manufacturer so, unless somebody already worked with this chip, nobody here will be able to help you...
|
|
|
|
|
As Cédric already mentioned above and I mentioned here[^], you should consult the vendor, or FTDI in this case, and the documentation they provide.
Iain Clarke suggested nearly half a year ago here[^] that you should use the D2XX solution since it is easier to use. The API of the DLL documented in this PDF[^] also contains a function called FT_SetLatencyTimer() and I think it would reasonable to assume that the function does set the latency timer...
I guess I must have misunderstood something because all I did was to Google for "FTDI" and the first hit was the home page of FTDI where I found this, to my understanding, useful information.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Hi All,
Please help me in this issue...
///using vc++///
I want to get the C M Y K values from a tiff file. I already getting the RGB values using Image class(gdi +).. Please share your ideas..
Regards,
Spk
|
|
|
|
|
You don't need to get the CMYK values directly from the TIFF file if you already have the RGB values, because the RGB values can be converted to CMYK values. You can find an information for this conversion here[^].
Nuri
|
|
|
|
|
|
No problem man! Cheers!
|
|
|
|
|
CMYK colors are device-specific. doing the simple RGB->CMYK conversion (as linked in the reply above) is an approximation to CMYK, but not a very good one. it will be OK for some images, but total crap for many.
if you want to convert RGB to CMYK with any kind of accuracy and consistency, you need to know two things: the color profile of the device that created the RGB image and the color profile of the device that will render the image. then you can use a CMS (Color Management System) to convert between the two.
MSDN[^]
i've had good luck with little CMS[^]
|
|
|
|
|
Thank you for this useful information Chris!
In the past i've been done some RBG->CMYK conversions and everything was OK.
But now I understand that this was an approximation and I was a lucky man.
Thanks again!
Nuri
|
|
|
|
|
It seems like Microsoft's image functions will read a CMYK file, but it's immediately converted to RGB. Aurigma.com makes class libraries that will read CMYK images as CMYK, without conversion. Their class libraries also provide image processing and conversion.
|
|
|
|
|
Hi All
I am geting debug assertion failed Line 3232 in file dbcore.cpp.Code is here
Database database;
try
{
if(database.OpenEx(_T("Driver={MySQL ODBC 5.1 Driver};Server=localhost;Database=;User=root; Password=root;Option=3;"), CDatabase::noOdbcDialog))
{
AfxMessageBox("Connection Successfully");
CString szSql = "SHOW DATABASES";
CRecordset rs(&database);
rs.Open( CRecordset::forwardOnly, szSql);
while (!rs.IsEOF())
{
CString szBuf;
rs.GetFieldValue("DATABASE", szBuf);
rs.MoveNext();
}
rs.Close();
}
}
catch(CException *e)
{
AfxMessageBox("Connection Failed");
}
i am geting assertion in this line
rs.Open( CRecordset::forwardOnly, szSql);
Debug assertion failed Line 3232 in file dbcore.cpp.
I see line 3232 in dbcore.cpp file.There i found this syntax
ASSERT(m_nFields != 0);
Can any one tell how can i solve that debug assertion.
Plz help me
|
|
|
|
|
|
Thanks for reply.
I use CDBException class for catch the error.But it's showing same Assertion.
|
|
|
|
|