Click here to Skip to main content
15,898,374 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Nedd help/direction to create a UI Pin
Klerik8221-Dec-05 10:27
Klerik8221-Dec-05 10:27 
GeneralRe: Nedd help/direction to create a UI Pin
TheGreatAndPowerfulOz21-Dec-05 10:35
TheGreatAndPowerfulOz21-Dec-05 10:35 
GeneralRe: Nedd help/direction to create a UI Pin
David Crow21-Dec-05 10:36
David Crow21-Dec-05 10:36 
QuestionRun hidden on startup Pin
lynchspawn21-Dec-05 9:48
lynchspawn21-Dec-05 9:48 
AnswerRe: Run hidden on startup Pin
TheGreatAndPowerfulOz21-Dec-05 9:54
TheGreatAndPowerfulOz21-Dec-05 9:54 
GeneralRe: Run hidden on startup Pin
Blake Miller22-Dec-05 6:04
Blake Miller22-Dec-05 6:04 
AnswerRe: Run hidden on startup Pin
Rajesh R Subramanian21-Dec-05 17:17
professionalRajesh R Subramanian21-Dec-05 17:17 
QuestionGetActiveWindow returns NULL Pin
wilbur_logan21-Dec-05 9:45
wilbur_logan21-Dec-05 9:45 
Hi All,
I am a novice and would appreciate any help you guys can give me here. I want to write a code which will tell me with which window the user is currently interacting. The code I am using is

#include <windows.h>

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
int test;
HWND hwnd;
MSG Msg;
TCHAR szBuf[80];
int nMaxCount;
DWORD d;
int nCmdShow;

while(1)
{
hwnd=GetActiveWindow();

if(hwnd == NULL)
{
MessageBox(NULL, "No window is currently active!","Error!" MB_ICONEXCLAMATION | MB_OK);
return 0;
}

ShowWindow(hwnd, nCmdShow);
UpdateWindow(hwnd);

test=GetWindowText(hwnd,szBuf,80);

}

}

Here GetActiveWindow returns NULL .If I use GetForegroundWindow, I get the handle of the IDE i.e VC++ and so on. How do I write a code which will tell me which is the window the user is currently interacting with?. My ultimate aim is to figure out which is the currently active window and grab images from the window. So in this case would I need to run an exe from my main code which will give me the handle to the active window? Any better idea how do I do it? Waiting for replies from the experts out there!!
-confused newbie
AnswerRe: GetActiveWindow returns NULL Pin
TheGreatAndPowerfulOz21-Dec-05 9:52
TheGreatAndPowerfulOz21-Dec-05 9:52 
GeneralRe: GetActiveWindow returns NULL Pin
wilbur_logan21-Dec-05 10:02
wilbur_logan21-Dec-05 10:02 
GeneralRe: GetActiveWindow returns NULL Pin
TheGreatAndPowerfulOz21-Dec-05 10:18
TheGreatAndPowerfulOz21-Dec-05 10:18 
GeneralRe: GetActiveWindow returns NULL Pin
wilbur_logan21-Dec-05 10:40
wilbur_logan21-Dec-05 10:40 
AnswerRe: GetActiveWindow returns NULL Pin
Rajesh R Subramanian21-Dec-05 17:22
professionalRajesh R Subramanian21-Dec-05 17:22 
GeneralRe: GetActiveWindow returns NULL Pin
wilbur_logan22-Dec-05 7:39
wilbur_logan22-Dec-05 7:39 
QuestionErase item from std::vector? Pin
Lord Kixdemp21-Dec-05 9:38
Lord Kixdemp21-Dec-05 9:38 
AnswerRe: Erase item from std::vector? Pin
TheGreatAndPowerfulOz21-Dec-05 9:39
TheGreatAndPowerfulOz21-Dec-05 9:39 
GeneralRe: Erase item from std::vector? Pin
Lord Kixdemp21-Dec-05 9:51
Lord Kixdemp21-Dec-05 9:51 
GeneralRe: Erase item from std::vector? Pin
toxcct21-Dec-05 21:38
toxcct21-Dec-05 21:38 
GeneralRe: Erase item from std::vector? Pin
Lord Kixdemp24-Dec-05 16:11
Lord Kixdemp24-Dec-05 16:11 
QuestionEvent Pin
sam117321-Dec-05 8:49
sam117321-Dec-05 8:49 
AnswerRe: Event Pin
TheGreatAndPowerfulOz21-Dec-05 9:38
TheGreatAndPowerfulOz21-Dec-05 9:38 
GeneralRe: Event Pin
sam117321-Dec-05 10:54
sam117321-Dec-05 10:54 
GeneralRe: Event Pin
Blake Miller22-Dec-05 6:07
Blake Miller22-Dec-05 6:07 
QuestionSwapping items in ListBox? Pin
Lord Kixdemp21-Dec-05 8:17
Lord Kixdemp21-Dec-05 8:17 
AnswerRe: Swapping items in ListBox? Pin
David Crow21-Dec-05 8:27
David Crow21-Dec-05 8:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.