|
-
Aug 5th, 2001, 10:44 AM
#1
Thread Starter
Addicted Member
EnumWindows
This code produces this error where I have commented
ERROR:
error C2664: 'EnumWindows' : cannot convert parameter 1 from 'int (void *,long)' to 'int (__stdcall *)(void)'
CODE:
Code:
#include <windows.h>
#include <stdio.h>
#include <string>
using namespace std;
BOOL CALLBACK EnumWindowsProc(HWND thehwnd, LPARAM lParam);
string fullmessage;
string windowlist;
int winnum;
int main()
{
char pcUserName[100];
char pcCompName[100];
unsigned long lLength = 100;
GetUserName(pcUserName, &lLength);
GetComputerName(pcCompName, &lLength);
printf("<USER>%s|<COMP>%s\n", pcUserName, pcCompName);
winnum = 0;
windowlist = "";
EnumWindows(*EnumWindowsProc, 0); //ERROR here
return 0;
}
BOOL CALLBACK EnumWindowsProc(HWND thehwnd, LPARAM lParam)
{
int slength;
char buffer[100];
char titletext[100];
char windownumlabel[20];
int retVal;
slength = GetWindowTextLength(thehwnd);
if (slength > 1)
{
if (IsWindowVisible(thehwnd) != 0)
{
winnum++;
retVal = GetWindowText(thehwnd, buffer, slength);
windowlist.insert(windowlist.length(), buffer);
windowlist.insert(windowlist.length(), "\n");
}
}
return 1;
}
Does anyone know how to fix this?
Last edited by Cbomb; Aug 6th, 2001 at 08:43 AM.
Cbomb
Techie 
-
Aug 6th, 2001, 08:43 AM
#2
Thread Starter
Addicted Member
Cbomb
Techie 
-
Aug 28th, 2001, 06:39 AM
#3
You should remove the asterisk before the EnumWindowProc
Code:
EnumWindows(EnumWindowProc, 0); // no asterisk here!!
That should do it.
All the buzzt
CornedBee
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
|