|
It is a activex control,i want to use it to judge whether size of screen changed.
|
|
|
|
|
chybin wrote: It is a activex control,i want to use it to judge whether size of screen changed.
Handle WM_DISPLAYCHANGE Message!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
I cant find WM_DISPLAYCHANGE Message,this control have no message! I use VC++ 7.0.
|
|
|
|
|
chybin wrote: I cant find WM_DISPLAYCHANGE Message,this control have no message! I use VC++ 7.0.
you have manually add that in your application
i.e.
OnMessage(WM_DISPLAYCHANGE,OnDisplayChange)
Function Decalaration
LRESULT YOURCLASS:OnDisplayChange(WPARAM wParam,LPARAM lParam)
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Hi,
I have a timer which was working proeprly before adding threads, now i have added thread funtion after that timer is not displayed on the dialog window can anyone tell me what is the cause .....
-------------------------------------------
BOOL CStatusDlg::OnInitDialog()
{
CDialog::OnInitDialog();
HANDLE hr;
hr = CreateThread(NULL,0,(unsigned long (__stdcall *)(void *))WorkerThreadProc,this,0,0);
return TRUE;
}
---------------------------------------------------
UINT WorkerThreadProc(LPVOID Param)
{
CStatusDlg* status = (CStatusDlg *)Param;
time(&lStartTime);
SetTimer(NULL,ELAPSED_TIMER, 1000, NULL);
INDX.startIndex();
return true;
}
------------------------------------------------------
void CStatusDlg::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
if(nIDEvent == ELAPSED_TIMER)
{
time(&lStopTime);
cteElapsedTime = CTimeSpan(lStopTime-lStartTime);
CString csElapsedTime;
csElapsedTime.Format("%02d:%02d:%02d",
cteElapsedTime.GetHours(),
cteElapsedTime.GetMinutes(),
cteElapsedTime.GetSeconds());
if(IsWindowVisible())
{
m_TIME.SetWindowText(csElapsedTime);
}
}
CDialog::OnTimer(nIDEvent);
}
-----------------------------------------------------------------
Regards,
Vinay Charan.
|
|
|
|
|
I think the thread does not know to which dialog the timer belongs.
try change:
SetTimer(NULL,ELAPSED_TIMER, 1000, NULL);
to:
status->SetTimer(NULL,ELAPSED_TIMER, 1000, NULL);
Michel Wassink
We must make user friendly software. Where are friendly users?
|
|
|
|
|
Hi Michel Wassink,
I tryed as u said i am getting below error
status->SetTimer(NULL,ELAPSED_TIMER, 1000, NULL);
error C2660: 'SetTimer' : function does not take 4 parameters
Error executing cl.exe.
|
|
|
|
|
Sorry, my fault.
choose between:
status->SetTimer(ELAPSED_TIMER, 1000, NULL);
or
SetTimer(status->m_hWnd,ELAPSED_TIMER, 1000, NULL);
Michel Wassink
We must make user friendly software. Where are friendly users?
|
|
|
|
|
Hi Michel Wassink,
It's working fine thank you very much..
I have one more problem with timer can u please tell me how to stop the timer???
timer which i have added does not stop.
|
|
|
|
|
Use
KillTimer(ELAPSED_TIMER);
to stop the timer.
Michel Wassink
We must make user friendly software. Where are friendly users?
|
|
|
|
|
Hi,
I used KillTimer(ELAPSED_TIMER);
i got
error C2660: 'KillTimer' : function does not take 1 parameters
Error executing cl.exe.
then i used KillTimer(NULL,ELAPSED_TIMER);
then no error but timer is not stoping please give me some solution.
|
|
|
|
|
from within the thread:
status->KillTimer(ELAPSED_TIMER);
or
KillTimer(status->m_hWnd, ELAPSED_TIMER);
Michel Wassink
We must make user friendly software. Where are friendly users?
|
|
|
|
|
Hi Michel Wassink,
KillTimer(status->m_hWnd, ELAPSED_TIMER);
is working thank you very much..................
|
|
|
|
|
Hi Michel Wassink,
i tryed using
KillTimer(ELAPSED_TIMER);
error C2660: 'KillTimer' : function does not take 1 parameters
Error executing cl.exe.
can u please tell how to stop ....
|
|
|
|
|
vinaycool wrote: status->SetTimer(NULL,ELAPSED_TIMER, 1000, NULL);
do this :-
status->SetTimer(ELAPSED_TIMER, 1000, NULL);
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Hi,
This is working fine for me
SetTimer(status->m_hWnd,ELAPSED_TIMER, 1000, NULL);
i want to know how to stop the timer ....
|
|
|
|
|
vinaycool wrote: This is working fine for meSetTimer(status->m_hWnd,ELAPSED_TIMER, 1000, NULL);i want to know how to stop the timer ....
Ok, KillTimer(..) will stop the timer
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
hi,
I tryed using
KillTimer(ELAPSED_TIMER);
but i am getting error
error C2660: 'KillTimer' : function does not take 1 parameters
Error executing cl.exe.
|
|
|
|
|
Since you're using the raw API call, you have to provide it with the window handle the same way you called ::SetTimer().
It's supposed to be hard, otherwise anybody could do it!
Regarding CodeProject: "resistance is pointless; you will be assimilated"
|
|
|
|
|
Hi,
Thanks for the information it will be usefull for me.
|
|
|
|
|
vinaycool wrote: KillTimer(ELAPSED_TIMER);but i am getting error
what about KillTImer(status->m_hWnd,ELAPSED_TIMER)
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
vinaycool wrote: hr = CreateThread(NULL,0,(unsigned long (__stdcall *)(void *))WorkerThreadProc,this,0,0);
Since this is an MFC application, why are you not using AfxBeginThread() here.
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
HI all
I have a main application in VC++ and have a dll called AdminXA.dll (which is not part of the main project but .sln is available)
The main application calls functions from this AdminXA.dll . How can I debug the functions available in AdminXA.dll from the main app?
Note : AdminXA.dll is COM based and i can see AdminXA.tlh , .tli in Main Application's debug folder . And am able to debug till .tli file
Please help me
redindian
-- modified at 6:27 Thursday 18th May, 2006
|
|
|
|
|
This code works perfect without exceptions when calling it from the main appthread, but when called on a working thread (AfxBeginThread) httpOpenRequest gives a valid handle and the function works but a bunch of exception occures during the call and afterwards GetLastError returns ERROR_INSUFFICIENT_BUFFER.
I know I shouldn't be worried if I get a valid handle but anyway....
Any ideas?
code:
CONST TCHAR *szAcceptType = TEXT(HTTP_ACCEPT_TYPE);
HINTERNET hHTTPRequest = NULL;
CHECK_BOOL(NULL != (hHTTPRequest=::httpOpenRequest(hSession, // HTTP session handle
HTTP_VERB_HEAD, // HTTP Verb szURI, // Object Name
HTTP_VERSION, // Version
NULL, // Reference
&szAcceptType, // Accept Type
INTERNET_FLAG_NO_CACHE_WRITE | INTERNET_FLAG_KEEP_CONNECTION,
NULL))); // context call-back point
CHECK_BOOL(hHTTPRequest != INVALID_HANDLE_VALUE);
// REPLACE HEADER
CHECK_BOOL(::HttpAddRequestHeaders( hHTTPRequest, HTTP_ACCEPT, _tcslen(HTTP_ACCEPT), HTTP_ADDREQ_FLAG_REPLACE));
// SEND REQUEST
CHECK_BOOL(::HttpSendRequest( hHTTPRequest, // handle by returned HttpOpenRequest
NULL, // additional HTTP header
0, // additional HTTP header length
NULL, // additional data in HTTP Post or HTTP Put 0)); // additional data length
return hHTTPRequest;
CLEANUP:
m_dwError=::GetLastError();
#ifdef _DEBUG
LPVOID lpMsgBuffer;
DWORD dwRet=FormatMessage( FORMAT_MESSAGE_FROM_HMODULE | FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_IGNORE_INSERTS,
GetModuleHandle("wininet.dll"),
m_dwError,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
reinterpret_cast<lptstr>(&lpMsgBuffer),
0,
NULL);
// Display the string.
MessageBox( NULL, (LPCTSTR)lpMsgBuffer, "Error", MB_OK | MB_ICONINFORMATION );
LocalFree(lpMsgBuffer);
#endif
if (hHTTPRequest)
InternetCloseHandle(hHTTPRequest);
hHTTPRequest = NULL;
return hHTTPRequest;
|
|
|
|
|
I have interview at Tata Consultance services on VB/C++/VC++ tomorrow.Any body has link where I can find good tricky question and answers about this subject
|
|
|
|
|