Click here to Skip to main content
15,919,423 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Implementing HTTP Client Pin
2249177-Apr-04 1:23
2249177-Apr-04 1:23 
GeneralAnother problem scrolling large document Pin
Still learning how to code6-Apr-04 22:22
Still learning how to code6-Apr-04 22:22 
GeneralRe: Another problem scrolling large document Pin
Roger Allen6-Apr-04 22:52
Roger Allen6-Apr-04 22:52 
GeneralProblem with setting timeout in C++ Pin
ArFuk6-Apr-04 22:07
ArFuk6-Apr-04 22:07 
GeneralRe: Problem with setting timeout in C++ Pin
Rage6-Apr-04 22:21
professionalRage6-Apr-04 22:21 
GeneralRe: Problem with setting timeout in C++ Pin
ArFuk6-Apr-04 22:45
ArFuk6-Apr-04 22:45 
GeneralRe: Problem with setting timeout in C++ Pin
Maxwell Chen6-Apr-04 23:38
Maxwell Chen6-Apr-04 23:38 
GeneralProblem with windows and frames. Pin
Victor Nikol6-Apr-04 21:58
Victor Nikol6-Apr-04 21:58 
GeneralPossible errors when using CDialog::Create(); Pin
anderslundsgard6-Apr-04 21:05
anderslundsgard6-Apr-04 21:05 
QuestionHow much voltage is required to operate a seven segment LED Pin
Member 9936936-Apr-04 20:38
Member 9936936-Apr-04 20:38 
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 

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.