|
Are you using MFC or win32, The api that you are calling is of win32.
For win32 api you need to have a valid window handle to send the notification to.
if you are using MFC then first parameter is not required.
In win32 you can use IsWindow(HWND) api to check wheather the hWnd is valid or not.
Since you say you are biggener, You should check in ur code wheather you are creating any window, if so are you storing the pointer somewhere else.
In Windows, The ui are targeted for certain function or api using the windows handle.
Simple speaking you need a valide windows handle to call the above api.
Hope i clear ur problem.
"Fear not of those who can kill the body and not the soul, rather fear Him who can kill both body and soul" - Bible
Prakash,
India.
|
|
|
|
|
Mr.Prakash wrote:
Are you using MFC or win32, The api that you are calling is of win32.
Im using MFC w/the vc++ mfc app wizard.
passing it NULL instead ov hWind worked just fine.
thank you.
|
|
|
|
|
Strange, dont know how it works, I need to go back to books to understand that.
Is it really working the way you are expecting it??
If you dont mind try replaying the NULL with m_hWnd its a predifined window handle in MFC.
"Fear not of those who can kill the body and not the soul, rather fear Him who can kill both body and soul" - Bible
Prakash,
India.
|
|
|
|
|
'm_hWnd' gives me an undeclared identifier error.
Null is working exactly how i expected; and my code refreshes the screen at 90 million mph, causing everything to flicker uncontrollably.
I geuss the next thing i need to learn is about 'frame rate'.
|
|
|
|
|
1. If you pass InvalidateRect(NULL, rect) , it invalidates all application windows. So I don't wonder, that it flickers.
2. Where are you calling the InvalidateRect from? Generally, in MFC you must retrieve a pointer to redrawn window (CWnd* ) and then call CWnd::InvalidateRect(CRect rc, BOOL erase) . You needn't to deal with HWND 's.
Robert-Antonio
"CRAY is the only computer, which runs an endless loop in just 4 hours"
|
|
|
|
|
a pointer? hmm. thanks for the info - I'll have to look into it next time I get a chance.
|
|
|
|
|
You can just use this->Invalidate(TRUE); from within the window you want to repaint's loop.
|
|
|
|
|
this->Invalidate(TRUE); gives me 'Invalidate' : is not a member of 'CMyApp'. I think I am calling it in the wrong place. how do I access one object's members from another object?
|
|
|
|
|
How can i add a background image for a slidercontrol.
|
|
|
|
|
|
|
Hi
I'm using SRVANY for using an existing program as Windows service.
I have too problems with it.
--- First problem:---
I get this error in my windows event viewer 'application'.
I only get this error when the service runs, the user logs off and the user logs in the second time. Then something really weird happens (don't know why). I can't navigate using the application's menu. It's like the application has frozen, but this isn't the case neither. I have some sort of scheduler which checks every minute what to do inside the program, and the scheduler runs and quits perfectly. So the program doesn't "freeze".
I only get this when the application runs as service on my Windows 2000 computer. I installed it at another PC too and there it works great (same OS). WinXP does the job well too.
Error:
The COM+ Event System detected a corrupt IEventSubscription object. The COM+ Event System has removed object ID {FAF488EC-AE99-48A8-8550-07AD2EBDDFAE}. The subscriber will no longer be notified when the event occurs.
<just edited="">
Before that error, i get this error too:
The COM+ Event System failed to fire the Logoff method on subscription {99582471-B2F3-4F46-A30B-4E22AF2E24A4}. The subscriber returned HRESULT 800706BA.
There is something that happens on logoff that isn't correct.
--- Second problem ---
I have read some articles about services which use either the local system account (which has access to local resources and can be interactive) and you can alsoo use it with a domain user which would have access to the netwerk, the ennoying part of the second choice is that the application can not be interactive anymore. The problem is that the application has to be interactive and has to have access to shares.
Is the changing of 'Registry: Lanmanserver parameters' the only workaround this? Is it possible to connect to a share with other users' credentials? (given you know his domain user account and his password) so the program uses the credential's of the user instead of the localsystem account.
Anyone can help me with this?
Greetings,
Jens
|
|
|
|
|
Hello there,
currently I develop a W2k service with Visual C++ 6. In the last few days this service crashs without an assert- or access-violation-message. Has anybody some experience with this behaviour?
Thanks,
Gero
|
|
|
|
|
It is not neccessarty that you should get an assert or access violation message before it crashes... It could be the logic of the service that is causeing the windows operating system to interminate without notice.
One reason could be stack overflow, normally (as to my experience) applications terminate without notice if there is a stack overflow, recurssive function, or infinite loop, etc.
1.Why do people not wearing a wrist watch look at their wrist for time when people ask for time.
2.Why do people ask for time from people who are not wearing a wrist watch.
Prakash,
India.
|
|
|
|
|
The crash also occured as the application ran in a console window and not as a service. And it also runs in Debug-Mode. So shouldn't be there an error message?
Gero
|
|
|
|
|
As i told ya it is not always neccessary that there should be a error message, I guess its a serious problem in the code that is causing premuture termination.
1.Why do people not wearing a wrist watch look at their wrist for time when people ask for time.
2.Why do people ask for time from people who are not wearing a wrist watch.
Prakash,
India.
|
|
|
|
|
Hello Mr. Prakash,
may be you're right. We do have ONE recursive function in our code. I also created a dummy recursive function which is called with no end condition. And I got the exact same behaviour as in our service app... no error message...
Thanks,
Gero
|
|
|
|
|
No Problem, just sharing my experience.
"Fear not of those who can kill the body and not the soul, rather fear Him who can kill both body and soul" - Bible
Prakash,
India.
|
|
|
|
|
Require some help in relation to the problem illustrated below
struct THREAD_CONTROL
{
HNADLE hDevice;
HANDlE hEvent;
};
HANDLE inThreadControl;
inThreadControl.hDevice = hDeviceWrite;
inThreadControl.hEvent = WriteEvent;
_beginthread(ThreadEZUSBWrite,0, &inThreadControl);
void ThreadEZUSBWrite(THREAD_CONTROL pThreadCtrl)
{
// TODO HERE
}
error C2664: '_beginthread' :
cannot convert parameter 1 from 'void (struct THREAD_CONTROL)' to 'void (__cdecl *)(void *)'
None of the functions with this name in scope match the target typ
Suggested appreciated
Kind Regards
Kevin
|
|
|
|
|
This is wrong way to pass multi paramater in thread, instead use
#include "process.h"
beginthread(MyFun,0,reinterpret_caste<cmyclass*>(this));
.
.
MyFunc(LPVOID pThis);
DWORD CMyclass::MyFunc(LPVOID pThis)
{
CMyClass *pThisObj = static_cast<cmyclass*>(pThis);
pThis->UseurClassFunctions.....
.
.
.
}
regards
Balkrishna Talele
|
|
|
|
|
Did you declare the prototype of the thread function before it is called?
and also the input parameter of the thread function is and should be void* not THREAD_CONTROL
so in a nutshell
//thread proc
void ThreadEZUSBWrite(void* pThreadCtrl)
{
THREAD_CONTROL *pControl;
pControl = (THREAD_CONTROL*) pThreadCtrl;
}
//and to start the thread.
...
_beginthread(ThreadEZUSBWrite,0, (void*)&inThreadControl);
...
1.Why do people not wearing a wrist watch look at their wrist for time when people ask for time.
2.Why do people ask for time from people who are not wearing a wrist watch.
Prakash,
India.
|
|
|
|
|
I've two global variables which I require defined in a header file, unfortunately I require this file to be included in more than one C++ file. However I get an error in relation to the global variables being defined twice. Any suggestions on a workaround?
Kind Regards
Caoimh
|
|
|
|
|
Put the definition in the .cpp
ex.
.cpp
int variable;
.h
extern int variable;
/Magnus
- I don't necessarily agree with everything I say
|
|
|
|
|
u forgot to type "extern"
some.h
int gGlobal;
fx.c
extern int gGlobal;
|
|
|
|
|
We normally dont define a variable in the header file as the header file is included in many cpp files, it causes redefination of the variable.
Instead we define the variable in a .cpp file or .c file and an extern in the .h file.
In windows application developed using the project wizard, it creates two files namely stdafx.h and stdafx.cpp
stdafx is by default included in each file that you add using the classwizard.
and stdafx.cpp is generally a empty file except for #include "stdafx.h"
So the best thing is to put the defination of the variable in the stdafx.cpp file and extern in stdafx.h file
forexample
in stdafx.cpp file
#include "stdafx.h"
int g_SomeGlobalVariable;
and in stdafx.h file
extern int g_SomeGlobalVariable;
hope this solves ur problem.
1.Why do people not wearing a wrist watch look at their wrist for time when people ask for time.
2.Why do people ask for time from people who are not wearing a wrist watch.
Prakash,
India.
|
|
|
|