|
You are not giving me a lot of information to go on.
Anyway, if you add CYourButton in the class view and then use the Class Wizard to add a message handler for WM_LBUTTONDOWN (in CYourButton), your derived button class should look something like this:
.h:
class CYourButton : public CButton
{
public:
CYourButton();
public:
public:
public:
virtual ~CYourButton();
protected:
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
DECLARE_MESSAGE_MAP()
};
.cpp:
CYourButton::CYourButton()
{
}
CYourButton::~CYourButton()
{
}
BEGIN_MESSAGE_MAP(CYourButton, CButton)
ON_WM_LBUTTONDOWN()
END_MESSAGE_MAP()
void CYourButton::OnLButtonDown(UINT nFlags, CPoint point)
{
TRACE("> Left mouse button down\n\r");
CButton::OnLButtonDown(nFlags, point);
}
Cheers,
Fredrik
"Felix qui potuit rerum cognoscere causas."
|
|
|
|
|
Fredrik Thank you very much,
seems like i had to put presubclasswindow in my dialog class.
Now it's working.
Thanx
Shinya
|
|
|
|
|
How to input Greek in VC++(.h, .cpp)?
How to input Greek in VC++ resource(.rc)?
How to show Greek in English Windows98 or Windows2000?
Thank!
|
|
|
|
|
I have a "parent" application. I want to create and destroy a child process using the parent application. I am successfully creating a new process (notepad) but unable to destroy it. Can any one tell me how to destroy a process ?
For creation of process i am doing something like:
STARTUPINFO si;
PROCESS_INFORMATION pi;
GetStartupInfo(&si);
::CreateProcess(NULL, "notepad",
NULL,
NULL,
TRUE,
0,
NULL,
NULL,
&si,
&pi);
and for ending process i am doing:
DWORD exitCode ;
BOOL a =::GetExitCodeProcess(pi.hProcess, &exitCode);
::ExitProcess(exitCode);
But when i try to end process my parent process destroys itself. Very strange that if i use TerminateProcess instead of ExitProcess , the child process successfully ends. But i want to use ExitProcess because MSDN recommends it. What is the problem here ?
Imtiaz
|
|
|
|
|
Imtiaz Murtaza wrote:
But when i try to end process my parent process destroys itself. Very strange that if i use TerminateProcess instead of ExitProcess, the child process successfully ends.
It's not strange at all. This is exactly what the docs say will happen. ExitProcess() exits the current process, TerminateProcess() terminates another process.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Note that TerminateProcess is extremely brutal. If you can, try to find top-level windows belonging to that process (see EnumWindows and GetWindowThreadProcessId ) and send them a WM_CLOSE message. This will allow the process to tidy up properly before it quits.
|
|
|
|
|
Mike Dimmick wrote:
Note that TerminateProcess is extremely brutal.
Absolutely. I like being brutal
But yes, it's not really a good idea to use. It doesn't allow the process to finish whatever it's doing, and files and settings may become corrupted.
Mike Dimmick wrote:
If you can, try to find top-level windows belonging to that process (see EnumWindows and GetWindowThreadProcessId) and send them a WM_CLOSE message.
If it has a window and is behaving itself this will work. If it has no window, use PostThreadMessage() to post a WM_QUIT message to the application's main thread (use the toolhelp library to get the thread id of the main thread of the process). If this doesn't work, then TerminateProcess() is the only alternative (or do nothing of course).
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Hi, all
i capture the images from the video input source(eg. cam) by using directshow's ISampleGrabberCB's callback function. but now i need to change the output's resolution from 320*240 to 640*480, the capture image's size also need to be changed into 640*480, anyone knows how can i do that? thanks
|
|
|
|
|
1/ Find the output pin of the source filter
2/ Query the pin for the IAMStreamConfig interface
3/ Use IAMStreamConfig::GetNumberOfCapabilities() to find the number of alternative output configurations
4/ Use IAMStreamConfig::GetStreamCaps() to evaluate all the possible AM_MEDIA_TYPE's
5/ Remember to delete the AM_MEDIA_TYPE's after you're finished with them.
You are probably going to have to specify a media subtype as well as the resolution. Typically MEDIASUBTYPE_RGB24 for most web cams
The following code is far from perfect... but it's what i'm using at the moment
CComPtr<IPin> findPin(CComPtr<IBaseFilter>& pFilter, PIN_DIRECTION dir)
{
PIN_DIRECTION pinDir;
CComPtr<IEnumPins> pPinEnum;
pFilter->EnumPins(&pPinEnum);
while(1)
{
CComPtr<IPin> pPin;
if( pPinEnum->Next(1,&pPin,0) == S_OK )
{
pPin->QueryDirection(&pinDir);
if(pinDir == dir)
{
return pPin;
}
}
else
{
return CComPtr<IPin>();
}
}
}
void setFormat(int width, int height, const GUID& subtype)
{
int size;
int count;
VIDEO_STREAM_CONFIG_CAPS vscc;
CComPtr<IPin> pPin = findPin(pSrc_,PINDIR_OUTPUT);
CComQIPtr<IAMStreamConfig> pConfig(pPin);
pConfig->GetNumberOfCapabilities(&count, &size);
for(int i = 0; i < count; i++)
{
AM_MEDIA_TYPE *pMt;
pConfig->GetStreamCaps(i, &pMt, (BYTE*)&vscc);
if( (vscc.InputSize.cx == width) &&
(vscc.InputSize.cy == height) &&
(pMt->subtype == subtype) )
{
pConfig->SetFormat(pMt);
DeleteMediaType(pMt);
return;
}
DeleteMediaType(pMt);
}
}
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
I have been working with tapi to init the modem, answer a phone call(all this works so far!!), and then stream what the caller says(raw 16 bit data) into a buffer. The problem i am having is in my waveInOpen(...) call to set up the data connection with the phone call. waveInOpen returns with an error saying the device is already in use. Any help or suggestions would be great.
here is what i am doing:
1. open the line with lineOpen( ) (i have monitor and owner privleges)
2. Once i am connected to a call i get the waveID with lineGetID(....)
3. I then try to call waveInOpen( &m_hRecord, m_iCallID, &m_Format, m_ThreadID, NULL, CALLBACK_THREAD) where m_iCallID is the id return in step 2 and this returns the error.
Does anyone know how to open a tapi call with waveInOpen to have access to the raw data? Thanks for the help.
Steve G
|
|
|
|
|
((Hi All,
I have an application where I needed to trap mouse events, specially right click so that when user right clicks I can do whatever I want to..so I created a mouse hook and when I run the applciation it also traps the left click of mouse and doesn't do what is required..I mean if I click on button it doesnt seem to remember what it has to do..can this be solved..any help from out there is highly appreciated..Any pointers ideas or code is most welcome..Thanks a lot in advance..
Himanshu
|
|
|
|
|
I will assume you set up the hook using SetWindowsHookEx(WH_MOUSE,...) . In your MouseProc, are you calling CallNextHookEx() and returning the value it returns to you?
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
Thanks for ur reply..but I am not sure what was the idea..I am using setwindowshookex to set the mouse hook..but I am not sure how to make left click work..here is the piece of code..
LRESULT CALLBACK MyTaskMouseHookLL(int nCode, WPARAM wp, LPARAM lp){
if (nCode == HC_ACTION)
{
if (wp == WM_LBUTTONDOWN) MessageBeep(0);
if (wp == WM_RBUTTONDOWN) MessageBeep(0);
}
return CallNextHookEx(g_hHookMousedLL, nCode, wp, lp);
}
Please correct me if I am wrong anywhere..or if u can provide me a piece of code that does the work..will be great...I shall be waiting for ur response..
thanks a lot in advance..
Himanshu
|
|
|
|
|
Provider=Microsoft.Jet.OLEDB.4.0
is for Access2000 and
Provider=Microsoft.Jet.OLEDB.3.51
is for Access97
Now I want to use Access2002
may I change the Provider Version?What is it?
Thanks
YES, I am here.
|
|
|
|
|
Angel Kid wrote:
Provider=Microsoft.Jet.OLEDB.4.0
This will work with Access 2002. You have to make sure that Jet engine 4.0 is installed.
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
Hello Guys!!!
I want to detect internet connection on a Windows system. I have tired using InternetGetConnectedState function but i am getting "unresolved external symbol __imp__InternetGetConnectedState@8" linker error. Can anybody help me out cause i need the code urgently...
Thanx in advance.
Abhi
|
|
|
|
|
You have to include in Wininet.h (which obviously you did) and link the Wininet.lib library.
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
Hi Tony!!
Ya. It worked linking the Wininet.lib. But still there seems to be problem.
I am getting "'INTERNET_CONNECTION_OFFLINE' : undeclared identifier"
Here`s my code. Can u have a look at it.
#include "stdafx.h"
#include "Wininet.h"
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
BOOL bConnected = FALSE;
DWORD dwFlags;
bConnected = InternetGetConnectedState ( &dwFlags, 0 );
if ( bConnected )
if ( dwFlags & INTERNET_CONNECTION_OFFLINE )
bConnected = FALSE;
if (bConnected )
MessageBox(0,"WOW ! Internet is Connected !","",0);
else
MessageBox(0, "Oops ! Internet is not Connected !","",0);
return 0;
}
|
|
|
|
|
Which version of the Platform SDK do you have? It doesn't exist in the one that comes with VC6 but does exist in the October 2002 version that I've got. It's in wininet.h , so if you don't have it, then you'll need to download the latest Platform SDK.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
I should have read your reply first.
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
Toni78 wrote:
***Clickety police
What clickety?
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
I screwed up the titles. I meant to write that in the other message. Sorry for the confusion. I need some sleep.
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
No problem
Have a good sleep
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Ryan Binns wrote:
Have a good sleep
Thank you. Should I reply with have a nice day? Just curios, what time is it down there?
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
Toni78 wrote:
Should I reply with have a nice day?
That would be appropriate
Toni78 wrote:
what time is it down there?
1352
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|