|
I'm trying to modify the icecast server so that i can be used as a service. When I use the SC_HANDLE to declare a variable, the compiler gives me a:
error C2275: 'SC_HANDLE' : illegal use of this type as an expression
error. I don't understand what i'm doing to cause that. Here it is in context:
int
main (int argc, char **argv)
{
g_bService = FALSE;
g_bStop = FALSE;
SC_HANDLE hManager;
SC_HANDLE hResult;
SC_HANDLE hService;
hManager = OpenSCManager(NULL,NULL,SC_MANAGER_ALL_ACCESS);
if (hManager)
{
hService = OpenService(hManager,"icecast",SERVICE_ALL_ACCESS);
if (hService)
{
g_bService = TRUE;
SERVICE_TABLE_ENTRY DispatchTable[] =
{
{"icecast", IcecastMain},
{ NULL, NULL}
};
if (!StartServiceCtrlDispatcher(DispatchTable))
{
SvcDebugOut("[ICECAST] StartServiceCtrlDispatcher error=%d\n",GetLastError());
}
}
}
else
{
IcecastMain(argc, argv);
}
startup_mode ();
return 0;
}
It give me an error on the first 3 variable declaration of SC_HANDLE.
Here is the SC_HANDLE declaration from winsvc.h:
DECLARE_HANDLE(SC_HANDLE);
typedef SC_HANDLE *LPSC_HANDLE;
Any Help would be greatly appreciated.
Stephen Caldwell
Blackfission, CEO
http://bf.steffc.yi.org:81
|
|
|
|
|
Hi all.
I'd like to know how it is possible to know the (x,y,cx,cy) of a menu (CRect information ?) or do i have to count the number of item * Item Heigh ?
Who knows ?
|
|
|
|
|
I have a CDialog derived class. I'm trying to make the background colour of the dialog match the dithered title bar. (Like MSN messenger does).
I thought it would be a simple as creating a brush with COLOR_GRADIENTACTIVECAPTION and setting the brush in WM_CTLCOLORDLG. However all I get is the first colour and not the gradient effect.
Can somebody point me in the right direction on how to achieve this effect.
Michael
|
|
|
|
|
Check out the GradientFill() function which will draw a rect (or even a triangle!) with a gradiated color.
--Mike--
http://home.inreach.com/mdunn/
"....." -- Silent Bob
your with and
|
|
|
|
|
So long as you aren't writing for Windows 95 or NT 4.0, and have a Platform SDK installed. Otherwise you'll have to draw the gradient yourself ( no big deal ).
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
Can anyone tell me how I can create a Modeless Dialogbox inside an MDI Window. If I create a dialog as modeless, using the Create function, and set the parent to the MainFrame MDI window, the dialog appears non-focused, as if it is disabled but you can still do everything with it.
I found the solution once before, but can't recall it
Any help will be appreciated...
|
|
|
|
|
Dear Sir/Madam,
Can I have a way to convert the view class in MFC Exe project into a DLL
to be used by other program? Since many functions are include in my View
class, it's not so easy to extract them as independent ones. So I am
wondering if I can make the whole view class as a DLL and use it in other
project. Thank you for your any suggestion.
Best regards,
C. Lei
|
|
|
|
|
Yes it is possible to export the view class.
You can export classes from an MFC Extension
DLL, but u got to be sure that it does not
have any dependencies, like using the data
from the document object. If any dependencies
are there then include those classes also.
|
|
|
|
|
Help!
I'm using the Rich Edit control (version3 on win2k) and
I'm trying to code
up a 'Page View' option for an editor I'm writing, the sort of
thing that'll Zoom up/down the text view by a percetage or to
the whole page or page width - you know the sort of thing.
I've got the zooming up working through the new EM_SETZOOM message
and appropriately selected ratio values for nNum and nDenom
but I can't get the zoom down to work, which is vital for the page view.
Has anyone been able to do this?
Are there any other cunning ways to do this?
|
|
|
|
|
|
add this line after the "includes"
#pragma comment(lib,"ddraw.lib")
regards
|
|
|
|
|
|
gern geschehen
|
|
|
|
|
You need to add the .lib library of Direct Draw in the settings of yor project, do ALT+F7, or prject/settings in the menu of vc++, select the link tab, and add the library. Y don't have the MSDN here, but i think that is ddraw.lib
Cheers....
Carlos Antollini.
|
|
|
|
|
- Please take a look at the two macros:
#define DEBUG(x) cout<<#x"="<
|
|
|
|
|
# and ## are preprocessor commands. #x results in the substitution "x" while x##y results in xy .
DEBUG(var) becomes cout<<"var""="<<var<<endl;
FIELD(MyField) becomes char* MyField_string; int MyField_size
And if you're wondering what happens to "var" "=" , the preprocessor concatentates adjacent string literals, so that becomes "var=" .
--Mike--
http://home.inreach.com/mdunn/
"....." -- Silent Bob
your with and
|
|
|
|
|
Thanks Mike pal!
- I still have a question. Do you mean x##y results in a single identifier?
- Can you help?
- Have a nice day?
Thanks,
Maer
|
|
|
|
|
|
I have two dialogs.
I the main dialog which is shown when the app is starting, I write this in the OnInitDialog():
CSecondDialog dlg; // this is the other dialog!
dlg.m_checkbox.SetCheck(1); // m_checkbox is a simple Check Box control, I puted it on the dialog with drag-and-drop
The program crashes and the debuger shows this
_AFXWIN_INLINE void CButton::SetCheck(int nCheck)
{ ASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, BM_SETCHECK, nCheck, 0); }
Is there any options for the Check box that isn't avaible?
or....
|
|
|
|
|
It is failing because the checkbox hasn't been created yet, the check box won't be created until the InitDialog function of CSecondDialog has been completed.
The easiest solution would be to create a BOOL flag for the checkbox, set that and then inside the CSecondDialog::InitDialog do the SetCheck code. Either that or use the built in DDX functionality of CDialog.
Michael
|
|
|
|
|
Well , I successed to create my first ATL and it is works.
But the problem that remains is that I dont success to use full at the controls of the ATL Dialog. [ATL object][Miscellaneous][Dialog]
the code line's :
--------------------------------------------
CEdit* pText = (CEdit*)GetDlgItem(IDC_EDIT1);
pText->SetWindowText("Hello! ");
pText->UpdateWindow();
-------------------------------------------
or:
--------------------------------------------
CStatic* image = (CStatic*)GetDlgItem(IDC_PICTURE);
image->......
.....
----------------------------------------
cause to crush the program in run time.
How can I use at the controls correctly ?
|
|
|
|
|
Where is this code being called from, is it before or after the InitDialog. Also what error message are you getting?
Off the top of my head, I thought the GetDlgItem returned a HWND so you can't cast it to a CEdit.
In my ATL/WTL dialogs I do the following,
declare a CEdit variable in the dialog class
CEdit m_editDest
and then in my InitDialog
m_editDest = GetDlgItem(IDC_NUMBER);
m_editDest.LimitText(64);
Michael
|
|
|
|
|
GetDlgItem returns CWnd* , so the code that mimi writed is correct.
apparently there are another problem.
|
|
|
|
|
CWnd::GetDlgItem returns a CWnd*, but ::GetDlgItem returns a HWND. CWindow::GetDlgItem ( the ATL function ) returns a HWND also.
As the code mimi provides does not call GetDlgItem in the scope of an instance of CWnd, unless it is inside an MFC CWnd derived class, Michael is correct.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
If mimi is using an ATL Wizard created dialog, then CWnd doesn't exist. The only GetDlgItem in the Atl DialogImpl class is the one which returns the HWND. Although looking at the answers further down it looks like he isn't using ATL correctly.
Michael
|
|
|
|