Click here to Skip to main content
15,921,697 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Help with vector/array Pin
Stephen Hewitt26-Mar-07 13:29
Stephen Hewitt26-Mar-07 13:29 
Questionhow to get mouseposition outside window Pin
Goggelmoggel26-Mar-07 3:04
Goggelmoggel26-Mar-07 3:04 
AnswerRe: how to get mouseposition outside window Pin
Christian Graus26-Mar-07 3:08
protectorChristian Graus26-Mar-07 3:08 
AnswerRe: how to get mouseposition outside window Pin
prasad_som26-Mar-07 3:10
prasad_som26-Mar-07 3:10 
AnswerRe: how to get mouseposition outside window Pin
Emil - Gabriel26-Mar-07 3:17
Emil - Gabriel26-Mar-07 3:17 
QuestionProblem with connecting to MySQL db from my own windows service application Pin
anumadhu26-Mar-07 2:50
anumadhu26-Mar-07 2:50 
AnswerRe: Problem with connecting to MySQL db from my own windows service application Pin
JudyL_MD26-Mar-07 10:16
JudyL_MD26-Mar-07 10:16 
GeneralRe: Problem with connecting to MySQL db from my own windows service application Pin
anumadhu27-Mar-07 1:43
anumadhu27-Mar-07 1:43 
yes, i am initalizing the ServiceStatus in the myServiceMain(int arg, char**argv) itself.

i am connecting MySQL to database using this statement:

try
{
usbDB.OpenEx(szConnectString_USB,CDatabase::noOdbcDialog);
}
catch(CException *e)
{
WriteIntoLogFile("db open Exception here");// And my log file is showing this stmt as the last stmt in it.
return;
}

myServiceMain is as follows....

void myServiceMain(int argc, char **argv)
{
int result=-1;

usbObj.WriteIntoLogFile("At DataSentinelMain");
ServiceStatus.dwServiceType = SERVICE_WIN32;
ServiceStatus.dwCheckPoint = 0;
ServiceStatus.dwCurrentState = SERVICE_START_PENDING;
ServiceStatus.dwControlsAccepted =SERVICE_ACCEPT_STOP|SERVICE_ACCEPT_SHUTDOWN;
ServiceStatus.dwServiceSpecificExitCode = 0;
ServiceStatus.dwWaitHint =0;
ServiceStatus.dwWin32ExitCode = 0;

hStatus=RegisterServiceCtrlHandlerEx((LPCWSTR)SERVICE_NAME_USB,(LPHANDLER_FUNCTION_EX)ControlHandler, 0);
usbObj.WriteIntoLogFile("Aftr calling RegisterServiceCtrlHandler");
if(hStatus==(SERVICE_STATUS_HANDLE)0)
{
usbObj.WriteIntoLogFile("hstatus returned SERVICE_STATUS_HANDLE INVALID");
return;
}

SetServiceStatus(hStatus,&ServiceStatus);
usbObj.WriteIntoLogFile("before RegisterDeviceNotifications");
result=usbObj.RegisterForDeviceNotifications (hStatus);

ServiceStatus.dwCurrentState=SERVICE_RUNNING;
SetServiceStatus(hStatus,&ServiceStatus);

if(result!=1)
{
usbObj.WriteIntoLogFile("RegisterDeviceNotification returned invalid value");
return;
}

usbObj.WriteIntoLogFile("After the call of RegisterDeviceNotification");

InitService();//27March 07
usbObj.WriteIntoLogFile("After the call to InitService");

/* Enumerate the USB DEVICES */
result=0;
while(ServiceStatus.dwCurrentState = SERVICE_RUNNING)
{
result++;
usbObj.WriteIntoLogFile("Call to USBServiceFunc from While of ServiceStatus_running");
usbObj.USBService ();
usbObj.WriteIntoLogFile("after and end of USBServiceFunc");
if(result>100)
{
ServiceStatus.dwCurrentState = SERVICE_STOPPED;
SetServiceStatus(hStatus,&ServiceStatus);
return;
}
Sleep(5000);
}

ServiceStatus.dwCurrentState = SERVICE_STOPPED;
SetServiceStatus(hStatus,&ServiceStatus);
return;
}

usbObj.USBService ()
{
/*this contains a method called usbObj.OpenDevices()..where the db is opened using the above stms..*/
}

i have seen even the MySQL.. service also.. which is getting started before the start of my own service.

but still i am unable to connect to the MySQL db at my local machine.

any idea...pls?

Anee
GeneralRe: Problem with connecting to MySQL db from my own windows service application Pin
JudyL_MD27-Mar-07 3:08
JudyL_MD27-Mar-07 3:08 
GeneralRe: Problem with connecting to MySQL db from my own windows service application Pin
anumadhu27-Mar-07 3:28
anumadhu27-Mar-07 3:28 
GeneralRe: Problem with connecting to MySQL db from my own windows service application Pin
JudyL_MD27-Mar-07 3:42
JudyL_MD27-Mar-07 3:42 
GeneralRe: Problem with connecting to MySQL db from my own windows service application Pin
anumadhu27-Mar-07 4:13
anumadhu27-Mar-07 4:13 
GeneralRe: Problem with connecting to MySQL db from my own windows service application Pin
JudyL_MD27-Mar-07 4:19
JudyL_MD27-Mar-07 4:19 
GeneralRe: Problem with connecting to MySQL db from my own windows service application Pin
anumadhu28-Mar-07 1:50
anumadhu28-Mar-07 1:50 
GeneralRe: Problem with connecting to MySQL db from my own windows service application Pin
JudyL_MD28-Mar-07 2:14
JudyL_MD28-Mar-07 2:14 
GeneralRe: Problem with connecting to MySQL db from my own windows service application Pin
anumadhu28-Mar-07 21:06
anumadhu28-Mar-07 21:06 
QuestionRe: Problem with connecting to MySQL db from my own windows service application Pin
anumadhu28-Mar-07 23:18
anumadhu28-Mar-07 23:18 
AnswerRe: Problem with connecting to MySQL db from my own windows service application Pin
anumadhu30-Mar-07 2:12
anumadhu30-Mar-07 2:12 
Questionwhat is the role of #pragma pack(1) Pin
mo_nica88126-Mar-07 2:37
mo_nica88126-Mar-07 2:37 
AnswerRe: what is the role of #pragma pack(1) Pin
David Crow26-Mar-07 2:46
David Crow26-Mar-07 2:46 
AnswerRe: what is the role of #pragma pack(1) Pin
Cedric Moonen26-Mar-07 2:50
Cedric Moonen26-Mar-07 2:50 
AnswerRe: what is the role of #pragma pack(1) Pin
Nibu babu thomas26-Mar-07 3:16
Nibu babu thomas26-Mar-07 3:16 
GeneralRe: what is the role of #pragma pack(1) Pin
Emil - Gabriel26-Mar-07 3:30
Emil - Gabriel26-Mar-07 3:30 
GeneralRe: what is the role of #pragma pack(1) Pin
Nibu babu thomas26-Mar-07 3:32
Nibu babu thomas26-Mar-07 3:32 
GeneralRe: what is the role of #pragma pack(1) Pin
David Crow26-Mar-07 3:59
David Crow26-Mar-07 3:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.