Click here to Skip to main content
15,903,362 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How much voltage is required to operate a seven segment LED Pin
Rory Solley6-Apr-04 22:02
Rory Solley6-Apr-04 22:02 
AnswerRe: How much voltage is required to operate a seven segment LED Pin
Prakash Nadar6-Apr-04 22:26
Prakash Nadar6-Apr-04 22:26 
Generaljpeg convert to bmp Pin
daoyu20006-Apr-04 18:47
daoyu20006-Apr-04 18:47 
GeneralRe: jpeg convert to bmp Pin
Antony M Kancidrowski7-Apr-04 2:21
Antony M Kancidrowski7-Apr-04 2:21 
GeneralRe: jpeg convert to bmp Pin
daoyu20007-Apr-04 23:48
daoyu20007-Apr-04 23:48 
GeneralRe: jpeg convert to bmp Pin
Antony M Kancidrowski8-Apr-04 2:25
Antony M Kancidrowski8-Apr-04 2:25 
GeneralRe: jpeg convert to bmp Pin
daoyu20008-Apr-04 4:25
daoyu20008-Apr-04 4:25 
GeneralApplication change to Service can not receive message Pin
tank10256-Apr-04 18:00
tank10256-Apr-04 18:00 
I wrote a Service prog and create a window in this service to receive remote program's user defined(WM_user+2330) message.but everything is fine except the window cann't receive message.
anyway,my servicetype is SERVICE_INTERACTIVE_PROCESS,why?
thanks a lot!

class CTsapiWnd : public CWnd
{
public:
.......................
void DoCreate()
{ CreateEx(0, AfxRegisterWndClass(CS_GLOBALCLASS), "",0,0,0,0, 0, 0, 0, 0);}
.........................
}

CTsapiWnd * m_TsapiWndPtr;
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
int nRetCode = 0;
ee=1;
m_TsapiWndPtr=NULL;
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
{
// TODO: change error code to suit your needs
cerr << _T("Fatal Error: MFC initialization failed") << endl;
nRetCode = 1;
}
else
{
SERVICE_TABLE_ENTRY DispatchTable[] =
{
{ ServiceName, ServiceMain},
{ NULL, NULL }
};
StartServiceCtrlDispatcher(DispatchTable);
}
return nRetCode;
}

void WINAPI ServiceMain(DWORD argc, LPTSTR argv[])
{
hSStat = RegisterServiceCtrlHandler( ServiceName, ServerCtrlHandler);
if (hSStat == 0)
LogEvent (_T("Cannot register control handler"), 100, TRUE);
LogEvent (_T("Control handler registered successfully"), 0, FALSE);
HDESK hdeskCurrent;
HDESK hdesk;
HWINSTA hwinstaCurrent;
HWINSTA hwinsta;
hwinstaCurrent = GetProcessWindowStation();
if (hwinstaCurrent == NULL)
{
LogEvent(_T("get window station err"),0,FALSE);
}

hdeskCurrent = GetThreadDesktop(GetCurrentThreadId());
if (hdeskCurrent == NULL){
LogEvent(_T("get window desktop err"),0,FALSE);
}
hwinsta = OpenWindowStation("winsta0", FALSE,
WINSTA_ACCESSCLIPBOARD |
WINSTA_ACCESSGLOBALATOMS |
WINSTA_CREATEDESKTOP |
WINSTA_ENUMDESKTOPS |
WINSTA_ENUMERATE |
WINSTA_EXITWINDOWS |
WINSTA_READATTRIBUTES |
WINSTA_READSCREEN |
WINSTA_WRITEATTRIBUTES);
if (hwinsta == NULL)
{
LogEvent(_T("open window station err"),0,FALSE);
}
if (!SetProcessWindowStation(hwinsta))
{
LogEvent(_T("Set window station err"),0,FALSE);
}
hdesk = OpenDesktop("default", 0, FALSE,
DESKTOP_CREATEMENU |
DESKTOP_CREATEWINDOW |
DESKTOP_ENUMERATE |
DESKTOP_HOOKCONTROL |
DESKTOP_JOURNALPLAYBACK |
DESKTOP_JOURNALRECORD |
DESKTOP_READOBJECTS |
DESKTOP_SWITCHDESKTOP |
DESKTOP_WRITEOBJECTS);
if (hdesk == NULL)
{
LogEvent(_T("Open desktop err"),0,FALSE);
}
if (!SetThreadDesktop(hdesk))
{
LogEvent(_T("Set ThreadDesktop err"),0,FALSE);
}
SetStatus(hSStat, SERVICE_START_PENDING);

m_TsapiWndPtr=new CTsapiWnd;
m_TsapiWndPtr->DoCreate();
Sleep(1000);
..............................................
setStatus(hSStat, SERVICE_RUNNING);
LogEvent(_T("SERVICE_RUNNING"),0,FALSE);
while(ee)
{
Sleep(1000);
}
SetStatus(hSStat, SERVICE_STOPPED);
LogEvent (_T"SERVICE_STOP"), 0, FALSE);Confused | :confused:
}
GeneralRe: Application change to Service can not receive message Pin
2249176-Apr-04 19:11
2249176-Apr-04 19:11 
GeneralRe: Application change to Service can not receive message Pin
tank10256-Apr-04 19:45
tank10256-Apr-04 19:45 
GeneralRe: Application change to Service can not receive message Pin
tank10257-Apr-04 5:25
tank10257-Apr-04 5:25 
Questionhow to convert??? Pin
don7cry6-Apr-04 17:37
don7cry6-Apr-04 17:37 
AnswerRe: how to convert??? Pin
Christian Graus6-Apr-04 18:31
protectorChristian Graus6-Apr-04 18:31 
GeneralRe: how to convert??? Pin
Maxwell Chen6-Apr-04 18:44
Maxwell Chen6-Apr-04 18:44 
GeneralRe: how to convert??? Pin
Ravi Bhavnani7-Apr-04 1:25
professionalRavi Bhavnani7-Apr-04 1:25 
GeneralRe: how to convert??? Pin
don7cry7-Apr-04 18:17
don7cry7-Apr-04 18:17 
GeneralStrange Visual C++ behavior - Computationally heavy app. Pin
Indrawati6-Apr-04 17:27
Indrawati6-Apr-04 17:27 
GeneralRe: Strange Visual C++ behavior - Computationally heavy app. Pin
Maxwell Chen6-Apr-04 17:29
Maxwell Chen6-Apr-04 17:29 
GeneralRe: Strange Visual C++ behavior - Computationally heavy app. Pin
cmk6-Apr-04 21:13
cmk6-Apr-04 21:13 
QuestionHow to use CDataGrid Pin
yingkou6-Apr-04 17:08
yingkou6-Apr-04 17:08 
QuestionLPPICTUREDISP -- CPictureHolder --- How to release memory? Pin
SNathani6-Apr-04 13:12
SNathani6-Apr-04 13:12 
Generaluse of template class and operator-&gt; Pin
tparry6-Apr-04 11:43
tparry6-Apr-04 11:43 
GeneralRe: use of template class and operator-&gt; Pin
Guido Loupias7-Apr-04 3:29
Guido Loupias7-Apr-04 3:29 
QuestionX10 C/C++ API? Pin
Ravi Bhavnani6-Apr-04 11:11
professionalRavi Bhavnani6-Apr-04 11:11 
AnswerFound it! Pin
Ravi Bhavnani6-Apr-04 12:44
professionalRavi Bhavnani6-Apr-04 12:44 

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.