Click here to Skip to main content
16,004,974 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralHELP MEEEEEEEEEEEEEEEEEEEEEEEEEEEE Pin
Renjith Ramachandran9-Jun-04 8:42
Renjith Ramachandran9-Jun-04 8:42 
GeneralRe: HELP MEEEEEEEEEEEEEEEEEEEEEEEEEEEE Pin
Harold Bamford9-Jun-04 12:21
Harold Bamford9-Jun-04 12:21 
GeneralRe: HELP MEEEEEEEEEEEEEEEEEEEEEEEEEEEE Pin
Renjith Ramachandran9-Jun-04 19:01
Renjith Ramachandran9-Jun-04 19:01 
GeneralDownloading a file into segments trouble... Pin
BlackKettle9-Jun-04 8:32
BlackKettle9-Jun-04 8:32 
GeneralDetecting when a window is created Pin
Tim James Reynolds9-Jun-04 8:28
Tim James Reynolds9-Jun-04 8:28 
GeneralRe: Detecting when a window is created Pin
palbano9-Jun-04 9:53
palbano9-Jun-04 9:53 
GeneralRe: Detecting when a window is created Pin
Tim James Reynolds10-Jun-04 2:39
Tim James Reynolds10-Jun-04 2:39 
GeneralRe: Detecting when a window is created Pin
gamitech9-Jun-04 9:54
gamitech9-Jun-04 9:54 
The answer is actually very simple you could make a thread tha will enable
HHOOK CBT = SetWindowsHookEx(WH_CBT, (HOOKPROC)CBTProc, hInst, (DWORD)NULL);
and the callback function for this is:
LRESULT CALLBACK CBTProc(int code, WPARAM wParam, LPARAM lParam);
and in this function you have to
char path[1024],path1[1024];

LRESULT CALLBACK CBTProc(int code, WPARAM wParam, LPARAM lParam)
{
if(code==HCBT_CREATEWND)
{
//you can get the module filname of the win created
GetModuleFileName(NULL, path, sizeof(path));

if(strcmp(path,path1)!=0))
{/*
here you could end the process that has just opened if don't want it opened
notice that in the path you can write a certain path that you don't want to be opened
*/
HANDLE hProc=NULL;
DWORD dwProcessId=NULL ;
HWND hnd=NULL;
LPDWORD lpExitCode=0;

GetWindowThreadProcessId(hnd, &dwProcessId);
hProc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, (DWORD)dwProcessId);
GetWindowThreadProcessId((HWND)wParam, &dwProcessId);
GetExitCodeProcess(hProc,lpExitCode);
TerminateProcess(hProc, (UINT)lpExitCode);
}
strcpy(calea1,calea);
}
return CallNextHookEx(CBT, code, wParam, lParam);
}
I have made this in a DLL but I thing is going to work with a thread.
Hope I helped although I am in highschool Smile | :)

gabby
GeneralRe: Detecting when a window is created Pin
Tim James Reynolds10-Jun-04 2:50
Tim James Reynolds10-Jun-04 2:50 
GeneralRe: Detecting when a window is created Pin
Tim James Reynolds10-Jun-04 3:52
Tim James Reynolds10-Jun-04 3:52 
QuestionWhat's the message when I leave a non modal dialog? Pin
doctorpi9-Jun-04 7:59
doctorpi9-Jun-04 7:59 
AnswerRe: What's the message when I leave a non modal dialog? Pin
David Crow9-Jun-04 8:15
David Crow9-Jun-04 8:15 
AnswerRe: What's the message when I leave a non modal dialog? Pin
BlackKettle9-Jun-04 8:22
BlackKettle9-Jun-04 8:22 
GeneralProcessing Arrow Keys in a Modeless Dialog (DLL) Pin
Justin Cooke9-Jun-04 6:08
Justin Cooke9-Jun-04 6:08 
GeneralRe: Processing Arrow Keys in a Modeless Dialog (DLL) Pin
mangellj9-Jun-04 9:55
mangellj9-Jun-04 9:55 
GeneralRe: Processing Arrow Keys in a Modeless Dialog (DLL) Pin
Justin Cooke10-Jun-04 10:46
Justin Cooke10-Jun-04 10:46 
Generalcan't delete all items from CListBox Pin
kfaday9-Jun-04 5:47
kfaday9-Jun-04 5:47 
GeneralRe: can't delete all items from CListBox Pin
palbano9-Jun-04 5:53
palbano9-Jun-04 5:53 
GeneralRe: can't delete all items from CListBox Pin
kfaday9-Jun-04 6:14
kfaday9-Jun-04 6:14 
GeneralRe: can't delete all items from CListBox Pin
walster9-Jun-04 7:36
walster9-Jun-04 7:36 
GeneralRe: can't delete all items from CListBox Pin
Ravi Bhavnani9-Jun-04 9:04
professionalRavi Bhavnani9-Jun-04 9:04 
GeneralRe: can't delete all items from CListBox Pin
Shi Zhu9-Jun-04 17:14
Shi Zhu9-Jun-04 17:14 
GeneralCWnd::OnEraseBkgnd usage Pin
kfaday9-Jun-04 5:24
kfaday9-Jun-04 5:24 
GeneralRe: CWnd::OnEraseBkgnd usage Pin
Iain Clarke, Warrior Programmer9-Jun-04 5:46
Iain Clarke, Warrior Programmer9-Jun-04 5:46 
GeneralRe: CWnd::OnEraseBkgnd usage Pin
kfaday9-Jun-04 6:16
kfaday9-Jun-04 6:16 

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.