-
I got 1 error!!
Here I have it:
BOOL TextOut(
HDC hdc, // handle to device context
int nXStart, // x-coordinate of starting position
int nYStart, // y-coordinate of starting position
LPCTSTR lpString, // pointer to string
int cbString; // number of characters in string
);
char *f_name = "Matt";
TextOut(HDC, 10, 10, *f_name, strlen(*f_name));
but I get:
89 book_windows.cpp
parse error before `,'
-
TextOut(HDC, 10, 10, *f_name, strlen(*f_name));
HDC is a type you can't use it as a variable.
are you using MFC?
theirs another textout for MFC.
-
What do I put?
I use Dev-C++ MinGW. How do I print text?
-
the
TextOut() given previously.
using HDC as a param is invalid since its a type thats whats causing the error.
you need too get a handle to your windows DC an use that.
-
Ok, a Q about that
How would I do that. I am a little new to Win programming. But I can do menus. How do I do that?
-
do you have the variable hWnd(handle to the window)?
-
I have..
-
then use this
HDC hDC = GetDC(hwnd);
char *f_name = "Matt";
TextOut(hDC, 10, 10, *f_name, strlen(*f_name));
-
To get a HDC try -
HDC hdc;
hdc = GetDC(hwnd); hwnd bing the handle of the window you are working with
[EDIT]Doh....didnt realise this thread was in use - sorry guys[/EDIT]
-
Now I get..
I get these:
85 book_windows.cpp
default argument `GetDC(hwnd)' uses local variable `hwnd'
85 book_windows.cpp
default argument missing for parameter 2 of `BOOL TextOutA(HDC__ * = {error}, int, int, const TCHAR *, int)'
88 book_windows.cpp
`hDC' undeclared (first use this function)
88 book_windows.cpp
(Each undeclared identifier is reported only once
88 book_windows.cpp
for each function it appears in.)
88 book_windows.cpp
passing `char' to argument 1 of `strlen(const char *)' lacks a cast
-
worry not Fordy good answer.
-
im honstly a little confused. could you post some code?
-
Code
Code:
BOOL TextOut(
HDC hDC = GetDC(hwnd), // handle to device context
int nXStart, // x-coordinate of starting position
int nYStart, // y-coordinate of starting position
LPCTSTR lpString, // pointer to string
int cbString // number of characters in string
);
char *f_name = "Matt";
TextOut(hDC, 10, 10, *f_name, strlen(*f_name));
}
-
Sorry but why are you declaring the whole TextOut function? Its included in windows.h
Try
Code:
HDC hDC = GetDC(hwnd);
char *f_name = "Matt";
TextOut(hDC, 10, 10, *f_name, strlen(*f_name));
-
ok i see
don't put this in the code
BOOL TextOut(
HDC hDC = GetDC(hwnd), // handle to device context
int nXStart, // x-coordinate of starting position
int nYStart, // y-coordinate of starting position
LPCTSTR lpString, // pointer to string
int cbString // number of characters in string
);
just use this,
HDC hDC = GetDC(hwnd);
char *f_name = "Matt";
TextOut(hDC, 10, 10, *f_name, strlen(*f_name));