|
-
Jul 26th, 2002, 06:06 PM
#1
Thread Starter
PowerPoster
Comparing two strings (not working)
I have hooked my window and I am trying to know when a menu window is created as a new window is created. The class for the menu window is #32770 (I think) so I am using the following chunk of code to check when a menu window is created:
PHP Code:
LRESULT CALLBACK CallWndProc(int nCode, WPARAM wParam, LPARAM lParam)
{
CWPSTRUCT *cw;
string classname;
switch (nCode)
{
case HC_ACTION:
cw = (CWPSTRUCT*)lParam;
GetTheClassName(cw->hwnd, classname);
// MessageBox(cw->hwnd,classname.c_str(),"",MB_OK);
if(strcmp(classname.c_str(),"#32770") == 0)
{
MessageBox("A menu window was created","",MB_OK);
//A menu window was created
}
return CallNextHookEx(myhook,nCode,wParam,lParam);
}
return CallNextHookEx(myhook,nCode,wParam,lParam);
}
void GetTheClassName(HWND hWnd, string &classdest)
{
char classname[128];
GetClassName(hWnd,classname, 128);
classdest = classname;
}
Now if I uncomment the line MessageBox(cw
>hwnd,classname.c_str(),"",MB_OK); before I use the if statement, some of the class names ARE "#32770" so it should actually return 0 from strcmpy but it's NOT. It never shows the message box inside the if statement which says "A menu window was created".
-
Jul 26th, 2002, 06:40 PM
#2
Frenzied Member
Try making a temp VAR to hold your string compare and then if that VAR
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com

-
Jul 26th, 2002, 06:53 PM
#3
Thread Starter
PowerPoster
-
Jul 28th, 2002, 11:15 AM
#4
Frenzied Member
Well what is the VAR equal to when you run it? 0, -1, > 0 ?
Maybe there is a return in your string
Try if(strcmp(classname.c_str(),"#32770") >= 0)
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com

Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|