Click here to Skip to main content
15,899,679 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: URGENT -- creating msi package for a vc++ application Pin
Anonymous17-Mar-04 18:56
Anonymous17-Mar-04 18:56 
GeneralCDC Pin
Anonymous17-Mar-04 12:26
Anonymous17-Mar-04 12:26 
GeneralRe: CDC Pin
gUrM33T17-Mar-04 14:22
gUrM33T17-Mar-04 14:22 
GeneralCPropertySheet SetActiveWindow in DoModal hangs Pin
Gizi Gyorgy17-Mar-04 11:14
Gizi Gyorgy17-Mar-04 11:14 
GeneralSubclassing CDateTimeCtrl Pin
Pir8ofTampa17-Mar-04 10:48
Pir8ofTampa17-Mar-04 10:48 
GeneralOnSize & MoveWindow Release Mouse Pin
leemidgley17-Mar-04 10:42
leemidgley17-Mar-04 10:42 
GeneralRe: OnSize & MoveWindow Release Mouse Pin
Prakash Nadar17-Mar-04 16:51
Prakash Nadar17-Mar-04 16:51 
GeneralService Stop Error Pin
Deian17-Mar-04 10:24
Deian17-Mar-04 10:24 
Hello, the following code always crashes with "Error: Attempt to access invalid address".

void CServicesDlg::OnBstop() <br />
{<br />
	TRACE("Services::OnBstop\n");<br />
	<br />
	DWORD dwError;<br />
	// get service information<br />
	int nSel = m_ctlListServices.GetSelectionMark();<br />
<br />
	if(nSel == -1)<br />
	{<br />
		return;<br />
	}<br />
	else<br />
	{<br />
		TCHAR szService[BUFF_LEN];<br />
		// get the text of second column<br />
		m_ctlListServices.GetItemText(nSel, 1, szService, BUFF_LEN);<br />
<br />
		SC_HANDLE hSCM = OpenSCManager(m_strPCName, NULL, SC_MANAGER_ALL_ACCESS);<br />
		if(hSCM == NULL)<br />
		{<br />
			dwError = GetLastError();<br />
			ErrorDescription(dwError);<br />
			AfxMessageBox("OpenSCManager failed");<br />
			TRACE("Services:hSCM is NULL\n");<br />
			return;<br />
		}<br />
		SC_HANDLE hService = OpenService(hSCM, szService, SERVICE_ALL_ACCESS);<br />
		if(hService == NULL)<br />
		{<br />
			dwError = GetLastError();<br />
			ErrorDescription(dwError);<br />
			AfxMessageBox("OpenSCManager failed");<br />
			TRACE("Services:hService is NULL\n");<br />
			return;<br />
		}<br />
<br />
		// stop service<br />
		if(ControlService(hService,SERVICE_CONTROL_STOP,NULL)==0)<br />
		{<br />
			dwError = GetLastError();<br />
			ErrorDescription(dwError);<br />
		}<br />
		// refresh<br />
		OnBrefresh();<br />
<br />
		CloseServiceHandle(hService);<br />
		CloseServiceHandle(hSCM);<br />
	}		<br />
}

My question is, where is the bug? Confused | :confused: Confused | :confused: Confused | :confused:
GeneralEncryption of user data - opinion needed Pin
Anonymous17-Mar-04 9:52
Anonymous17-Mar-04 9:52 
GeneralRe: Encryption of user data - opinion needed Pin
alex.barylski17-Mar-04 10:53
alex.barylski17-Mar-04 10:53 
GeneralRe: Encryption of user data - opinion needed Pin
Anonymous17-Mar-04 13:59
Anonymous17-Mar-04 13:59 
GeneralNeed help with scrolling a listview Pin
d817-Mar-04 9:47
d817-Mar-04 9:47 
GeneralRe: Need help with scrolling a listview Pin
d817-Mar-04 10:04
d817-Mar-04 10:04 
GeneralRe: Need help with scrolling a listview Pin
alex.barylski17-Mar-04 10:46
alex.barylski17-Mar-04 10:46 
Generalswap bytes in a ushort/ulong Pin
Jürgen Eidt17-Mar-04 9:34
Jürgen Eidt17-Mar-04 9:34 
GeneralRe: swap bytes in a ushort/ulong Pin
Rick York17-Mar-04 10:28
mveRick York17-Mar-04 10:28 
GeneralRe: swap bytes in a ushort/ulong Pin
Jürgen Eidt17-Mar-04 16:14
Jürgen Eidt17-Mar-04 16:14 
GeneralRe: swap bytes in a ushort/ulong Pin
Gary R. Wheeler18-Mar-04 2:06
Gary R. Wheeler18-Mar-04 2:06 
GeneralRe: swap bytes in a ushort/ulong Pin
Jürgen Eidt18-Mar-04 9:41
Jürgen Eidt18-Mar-04 9:41 
GeneralRe: swap bytes in a ushort/ulong Pin
Gary R. Wheeler18-Mar-04 12:03
Gary R. Wheeler18-Mar-04 12:03 
GeneralRe: swap bytes in a ushort/ulong Pin
Jürgen Eidt18-Mar-04 15:01
Jürgen Eidt18-Mar-04 15:01 
GeneralI need help in doing 8 bit binary addition Pin
juntupally17-Mar-04 9:13
juntupally17-Mar-04 9:13 
GeneralRe: I need help in doing 8 bit binary addition Pin
Rick York17-Mar-04 10:30
mveRick York17-Mar-04 10:30 
GeneralInitInstance Pin
0v3rloader17-Mar-04 8:55
0v3rloader17-Mar-04 8:55 
GeneralRe: InitInstance Pin
gUrM33T17-Mar-04 14:31
gUrM33T17-Mar-04 14:31 

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.