TPU ChatChat on IRC
Internet Relay Chat?
Java Applet client
Who's on IRC?
help with windows programming
Posted by mc0282 [send private reply] at August 03, 2002, 05:42:59 PM hello i need little hand with this code . this my code and i having a little hard time with it .
THE HEADER FILE CODES
// Get Text from edit/hWnd
void GetText(HWND hWnd, char* cBuf, int nBufLen)
SendMessage(hWnd, WM_GETTEXT, (long) nBufLen, (LPARAM)(LPCSTR) cBuf);
LRESULT CALLBACK WndProc(HWND hWnd,UINT iMsg,WPARAM wParam,LPARAM lParam)
return 0 ;
int APIENTRY WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nShowCmd)
const char* AppName = "Melvyn";
wc.cbSize = sizeof(wc);
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(NULL,IDI_APPLICATION);
wc.hCursor = LoadCursor(NULL,IDC_ARROW);
wc.hbrBackground = (HBRUSH)GetStockObject(GRAY_BRUSH);
wc.lpszMenuName = NULL;
wc.lpszClassName = AppName;
wc.hIconSm = LoadIcon(NULL,IDI_APPLICATION);
hwnd = CreateWindowEx(WS_EX_CLIENTEDGE,AppName,"Melvyn",WS_OVERLAPPED,0,0,300,300,NULL,NULL,hInstance,NULL);
hE3 = CreateWindowEx(WS_EX_CLIENTEDGE, "edit", NULL, WS_CHILD | ES_MULTILINE, 5, 100, 100, 20, hwnd, NULL, hInstance, NULL);
if(hE3 =="melvyn" )
MessageBox(hwnd,"hello","cool",MB_OK); // just a example
return msg.wParam ;
AND I GET ERROR EVERYTHING TIME I TRY TO COMPILE IT I CAN'T UNDERSTAND ERROR IS LITTLE CONFUSING BUT EVERYONE MAKE MISTAKE
error C2446: '==' : no conversion from 'char *' to 'struct HWND__ *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
C:\Windows\Desktop\Visual C++\Mel\Mel.cpp(61) : error C2230: '==' : indirection to different types
Error executing cl.exe.
Mel.exe - 2 error(s), 0 warning(s)
IF YOU COULD FIX UP FOR ME OR EXPLAIN WHAT IM DOING WRONG LET ME KNOW THANK YOU
Posted by taubz [send private reply] at August 03, 2002, 07:39:19 PM It would have been helpful if you told us what line was line 61, but I guess it's the one with " if(hE3 =="melvyn" ) ".
Here's a translation of the error message, which should help you to translate similar errors in the future:
"error C2446: '==' : no conversion from 'char *' to 'struct HWND__ *'"
The compiler doesn't know how to compare a variable of type "char *" to a variable of type "struct HWND__*" and the errors occurs somewhere around an "==" operator.
From the line number, we can see that hE3 is defined as a HWND and "melvyn" is of course a char *. HWNDs aren't strings, they're handles of some sort. So, your attempt to compare the char* and the handle cannot be done.
Register as a new user